* fix duplicate parameter names

git-svn-id: trunk@2022 -
This commit is contained in:
peter 2005-12-21 11:20:41 +00:00
parent ad0f93da39
commit 3db35349ec
6 changed files with 76 additions and 76 deletions

View File

@ -497,13 +497,13 @@ end;
function TDataSet.GetFieldData(Field: TField; Buffer: Pointer; function TDataSet.GetFieldData(Field: TField; Buffer: Pointer;
NativeFormat: Boolean): Boolean; NativeFormat: Boolean): Boolean;
Const Const
TempBufSize = 1024; { Let's not exaggerate.} TempBufSize = 1024; { Let's not exaggerate.}
Var Var
Buf : Array[1..TempBufSize] of Char; Buf : Array[1..TempBufSize] of Char;
P : PChar; P : PChar;
begin begin
If NativeFormat then If NativeFormat then
Result:=GetFieldData(Field, Buffer) Result:=GetFieldData(Field, Buffer)
@ -518,7 +518,7 @@ begin
DataConvert(Field,P,Buffer,False); DataConvert(Field,P,Buffer,False);
If (P<>@Buf) then If (P<>@Buf) then
FreeMem(P); FreeMem(P);
end; end;
end; end;
Function DateTimeRecToDateTime(DT: TFieldType; Data: TDateTimeRec): TDateTime; Function DateTimeRecToDateTime(DT: TFieldType; Data: TDateTimeRec): TDateTime;
@ -541,22 +541,22 @@ begin
TS:=MSecsToTimeStamp(trunc(Data.DateTime)); TS:=MSecsToTimeStamp(trunc(Data.DateTime));
except except
end; end;
end; end;
Result:=TimeStampToDateTime(TS); Result:=TimeStampToDateTime(TS);
end; end;
Function DateTimeToDateTimeRec(DT: TFieldType; Data: TDateTime): TDateTimeRec; Function DateTimeToDateTimeRec(DT: TFieldType; Data: TDateTime): TDateTimeRec;
var var
TS : TTimeStamp; TS : TTimeStamp;
begin begin
TS:=DateTimeToTimeStamp(Data); TS:=DateTimeToTimeStamp(Data);
With Result do With Result do
case DT of case DT of
ftDate: ftDate:
Date:=TS.Date; Date:=TS.Date;
ftTime: ftTime:
Time:=TS.Time; Time:=TS.Time;
else else
DateTime:=TimeStampToMSecs(TS); DateTime:=TimeStampToMSecs(TS);
@ -570,14 +570,14 @@ Type
PDateTimeRec = ^TDateTimeRec; PDateTimeRec = ^TDateTimeRec;
Var Var
DT : TFieldType; DT : TFieldType;
begin begin
DT:=Field.DataType; DT:=Field.DataType;
case DT of case DT of
ftDate, ftTime, ftDateTime: ftDate, ftTime, ftDateTime:
if ToNative then if ToNative then
PDateTimeRec(Dest)^:=DateTimeToDateTimeRec(DT,PDateTime(Source)^) PDateTimeRec(Dest)^:=DateTimeToDateTimeRec(DT,PDateTime(Source)^)
else else
PDateTime(Dest)^:=DateTimeRecToDateTime(DT,PDateTimeRec(Source)^); PDateTime(Dest)^:=DateTimeRecToDateTime(DT,PDateTimeRec(Source)^);
end; end;
@ -594,25 +594,25 @@ procedure TDataSet.SetFieldData(Field: TField; Buffer: Pointer;
Const Const
TempBufSize = 1024; { Let's not exaggerate.} TempBufSize = 1024; { Let's not exaggerate.}
Var Var
Buf : Array[1..TempBufSize] of Char; Buf : Array[1..TempBufSize] of Char;
P : PChar; P : PChar;
begin begin
if NativeFormat then if NativeFormat then
SetFieldData(Field, Buffer) SetFieldData(Field, Buffer)
else else
begin begin
if Field.DataSize<=dsMaxStringSize then if Field.DataSize<=dsMaxStringSize then
P:=GetMem(Field.DataSize) P:=GetMem(Field.DataSize)
else else
P:=@Buf; P:=@Buf;
DataConvert(Field,Buffer,P,True); DataConvert(Field,Buffer,P,True);
SetFieldData(Field,P); SetFieldData(Field,P);
If (P<>@Buf) then If (P<>@Buf) then
FreeMem(P); FreeMem(P);
end; end;
end; end;
Function TDataset.GetField (Index : Longint) : TField; Function TDataset.GetField (Index : Longint) : TField;
@ -1560,16 +1560,16 @@ begin
Result:=(Bof and Eof); Result:=(Bof and Eof);
end; end;
Function TDataset.IsLinkedTo(DataSource: TDataSource): Boolean; Function TDataset.IsLinkedTo(ADataSource: TDataSource): Boolean;
begin begin
//!! Not tested, I never used nested DS //!! Not tested, I never used nested DS
if (DataSource = nil) or (DataSource.Dataset = nil) then begin if (ADataSource = nil) or (ADataSource.Dataset = nil) then begin
Result := False Result := False
end else if DataSource.Dataset = Self then begin end else if ADataSource.Dataset = Self then begin
Result := True; Result := True;
end else begin end else begin
Result := DataSource.Dataset.IsLinkedTo(DataSource.Dataset.DataSource); Result := ADataSource.Dataset.IsLinkedTo(ADataSource.Dataset.DataSource);
end; end;
//!! DataSetField not implemented //!! DataSetField not implemented
end; end;
@ -1991,12 +1991,12 @@ begin
Result := False; Result := False;
end; end;
Function TDataset.Lookup(const KeyFields: string; const KeyValues: Variant; const ResultFields: string): Variant; Function TDataset.Lookup(const KeyFields: string; const KeyValues: Variant; const ResultFields: string): Variant;
begin begin
Result := False; Result := False;
end; end;
Procedure TDataset.UnRegisterDataSource(ADatasource : TDatasource); Procedure TDataset.UnRegisterDataSource(ADatasource : TDatasource);

View File

@ -257,7 +257,7 @@ type
Function GetIndex : longint; Function GetIndex : longint;
procedure SetAlignment(const AValue: TAlignMent); procedure SetAlignment(const AValue: TAlignMent);
procedure SetIndex(AValue: Integer); procedure SetIndex(AValue: Integer);
Procedure SetDataset(Value : TDataset); Procedure SetDataset(AValue : TDataset);
function GetDisplayText: String; function GetDisplayText: String;
procedure SetDisplayLabel(const AValue: string); procedure SetDisplayLabel(const AValue: string);
procedure SetDisplayWidth(const AValue: Longint); procedure SetDisplayWidth(const AValue: Longint);
@ -314,7 +314,7 @@ type
constructor Create(AOwner: TComponent); override; constructor Create(AOwner: TComponent); override;
destructor Destroy; override; destructor Destroy; override;
procedure Assign(Source: TPersistent); override; procedure Assign(Source: TPersistent); override;
procedure AssignValue(const Value: TVarRec); procedure AssignValue(const AValue: TVarRec);
procedure Clear; virtual; procedure Clear; virtual;
procedure FocusControl; procedure FocusControl;
function GetData(Buffer: Pointer): Boolean; function GetData(Buffer: Pointer): Boolean;
@ -1123,7 +1123,7 @@ type
procedure Insert; procedure Insert;
procedure InsertRecord(const Values: array of const); procedure InsertRecord(const Values: array of const);
function IsEmpty: Boolean; function IsEmpty: Boolean;
function IsLinkedTo(DataSource: TDataSource): Boolean; function IsLinkedTo(ADataSource: TDataSource): Boolean;
function IsSequenced: Boolean; virtual; function IsSequenced: Boolean; virtual;
procedure Last; procedure Last;
function Locate(const keyfields: string; const keyvalues: Variant; options: TLocateOptions) : boolean; virtual; function Locate(const keyfields: string; const keyvalues: Variant; options: TLocateOptions) : boolean; virtual;
@ -1431,7 +1431,7 @@ type
property Params : TStrings read FParams Write FParams; property Params : TStrings read FParams Write FParams;
property OnLogin: TLoginEvent read FOnLogin write FOnLogin; property OnLogin: TLoginEvent read FOnLogin write FOnLogin;
end; end;
{ TCustomConnection } { TCustomConnection }
TCustomConnection = class(TDatabase) TCustomConnection = class(TDatabase)
@ -1458,7 +1458,7 @@ type
property AfterDisconnect : TNotifyEvent read FAfterDisconnect write SetAfterDisconnect; property AfterDisconnect : TNotifyEvent read FAfterDisconnect write SetAfterDisconnect;
property BeforeDisconnect : TNotifyEvent read FBeforeDisconnect write SetBeforeDisconnect; property BeforeDisconnect : TNotifyEvent read FBeforeDisconnect write SetBeforeDisconnect;
end; end;
{ TBufDataset } { TBufDataset }
@ -1550,12 +1550,12 @@ type
{ TParam } { TParam }
TBlobData = string; TBlobData = string;
TParamBinding = array of integer; TParamBinding = array of integer;
TParamType = (ptUnknown, ptInput, ptOutput, ptInputOutput, ptResult); TParamType = (ptUnknown, ptInput, ptOutput, ptInputOutput, ptResult);
TParamTypes = set of TParamType; TParamTypes = set of TParamType;
TParamStyle = (psInterbase,psPostgreSQL); TParamStyle = (psInterbase,psPostgreSQL);
TParams = class; TParams = class;
@ -1614,7 +1614,7 @@ type
Function GetDataSize: Integer; Function GetDataSize: Integer;
Procedure LoadFromFile(const FileName: string; BlobType: TBlobType); Procedure LoadFromFile(const FileName: string; BlobType: TBlobType);
Procedure LoadFromStream(Stream: TStream; BlobType: TBlobType); Procedure LoadFromStream(Stream: TStream; BlobType: TBlobType);
Procedure SetBlobData(Buffer: Pointer; Size: Integer); Procedure SetBlobData(Buffer: Pointer; ASize: Integer);
Procedure SetData(Buffer: Pointer); Procedure SetData(Buffer: Pointer);
Property AsBlob : TBlobData read GetAsString write SetAsBlob; Property AsBlob : TBlobData read GetAsString write SetAsBlob;
Property AsBoolean : Boolean read GetAsBoolean write SetAsBoolean; Property AsBoolean : Boolean read GetAsBoolean write SetAsBoolean;
@ -1986,7 +1986,7 @@ function TIndexDefs.IndexOf(const Name: string): Longint;
var i: LongInt; var i: LongInt;
begin begin
Result := -1; Result := -1;
for i := 0 to Count - 1 do for i := 0 to Count - 1 do
if AnsiSameText(Items[i].Name, Name) then if AnsiSameText(Items[i].Name, Name) then
begin begin
Result := i; Result := i;

View File

@ -174,10 +174,10 @@ type
TStringPart = record TStringPart = record
Start,Stop:integer; Start,Stop:integer;
end; end;
const const
ParamAllocStepSize = 8; ParamAllocStepSize = 8;
var var
p,ParamNameStart,BufStart:PChar; p,ParamNameStart,BufStart:PChar;
ParamName:string; ParamName:string;
@ -302,7 +302,7 @@ begin
Inc(p); Inc(p);
end; end;
until false; until false;
SetLength(ParamPart,ParamCount); SetLength(ParamPart,ParamCount);
SetLength(ParamBinding,ParamCount); SetLength(ParamBinding,ParamCount);
@ -840,14 +840,14 @@ begin
end; end;
end; end;
Procedure TParam.SetBlobData(Buffer: Pointer; Size: Integer); Procedure TParam.SetBlobData(Buffer: Pointer; ASize: Integer);
Var Var
Temp : String; Temp : String;
begin begin
SetLength(Temp,Size); SetLength(Temp,ASize);
Move(Buffer^,Temp,Size); Move(Buffer^,Temp,ASize);
AsBlob:=Temp; AsBlob:=Temp;
end; end;

View File

@ -344,14 +344,14 @@ begin
inherited Assign(Source); inherited Assign(Source);
end; end;
procedure TField.AssignValue(const Value: TVarRec); procedure TField.AssignValue(const AValue: TVarRec);
procedure Error; procedure Error;
begin begin
DatabaseErrorFmt(SFieldValueError, [DisplayName]); DatabaseErrorFmt(SFieldValueError, [DisplayName]);
end; end;
begin begin
with Value do with AValue do
case VType of case VType of
vtInteger: vtInteger:
AsInteger := VInteger; AsInteger := VInteger;
@ -785,24 +785,24 @@ begin
FDataSet.SetFieldData(Self,Buffer, NativeFormat); FDataSet.SetFieldData(Self,Buffer, NativeFormat);
end; end;
Procedure TField.SetDataset (Value : TDataset); Procedure TField.SetDataset (AValue : TDataset);
begin begin
{$ifdef dsdebug} {$ifdef dsdebug}
Writeln ('Setting dataset'); Writeln ('Setting dataset');
{$endif} {$endif}
If Value=FDataset then exit; If AValue=FDataset then exit;
If Assigned(FDataset) Then If Assigned(FDataset) Then
begin begin
FDataset.CheckInactive; FDataset.CheckInactive;
FDataset.FFieldList.Remove(Self); FDataset.FFieldList.Remove(Self);
end; end;
If Assigned(Value) then If Assigned(AValue) then
begin begin
Value.CheckInactive; AValue.CheckInactive;
Value.FFieldList.Add(Self); AValue.FFieldList.Add(Self);
end; end;
FDataset:=Value; FDataset:=AValue;
end; end;
procedure TField.SetDataType(AValue: TFieldType); procedure TField.SetDataType(AValue: TFieldType);
@ -1629,11 +1629,11 @@ begin
else else
Fmt:=FEditFormat; Fmt:=FEditFormat;
if ADisplayText then if ADisplayText then
ff := ffCurrency ff := ffCurrency
else else
ff := ffFixed; ff := ffFixed;
If fmt<>'' then If fmt<>'' then
TheText:=FormatFloat(fmt, E) TheText:=FormatFloat(fmt, E)
else else
@ -2049,7 +2049,7 @@ function TBCDField.GetValue(var AValue: Currency): Boolean;
begin begin
Result := GetData(@AValue); Result := GetData(@AValue);
end; end;
function TBCDField.GetDataSize: Word; function TBCDField.GetDataSize: Word;
begin begin

View File

@ -104,7 +104,7 @@ type
destructor Destroy; override; destructor Destroy; override;
property ConnOptions: TConnOptions read FConnOptions; property ConnOptions: TConnOptions read FConnOptions;
procedure ExecuteDirect(SQL : String); overload; virtual; procedure ExecuteDirect(SQL : String); overload; virtual;
procedure ExecuteDirect(SQL : String; Transaction : TSQLTransaction); overload; virtual; procedure ExecuteDirect(SQL : String; ATransaction : TSQLTransaction); overload; virtual;
procedure GetTableNames(List : TStrings; SystemTables : Boolean = false); virtual; procedure GetTableNames(List : TStrings; SystemTables : Boolean = false); virtual;
procedure GetProcedureNames(List : TStrings); virtual; procedure GetProcedureNames(List : TStrings); virtual;
procedure GetFieldNames(const TableName : string; List : TStrings); virtual; procedure GetFieldNames(const TableName : string; List : TStrings); virtual;
@ -176,7 +176,7 @@ type
// FSchemaInfo : TSchemaInfo; // FSchemaInfo : TSchemaInfo;
procedure FreeFldBuffers; procedure FreeFldBuffers;
procedure InitUpdates(SQL : string); procedure InitUpdates(ASQL : string);
function GetIndexDefs : TIndexDefs; function GetIndexDefs : TIndexDefs;
function GetStatementType : TStatementType; function GetStatementType : TStatementType;
procedure SetIndexDefs(AValue : TIndexDefs); procedure SetIndexDefs(AValue : TIndexDefs);
@ -187,7 +187,7 @@ type
procedure OnChangeSQL(Sender : TObject); procedure OnChangeSQL(Sender : TObject);
procedure Execute; procedure Execute;
Procedure SQLParser(var SQL : string); Procedure SQLParser(var ASQL : string);
procedure ApplyFilter; procedure ApplyFilter;
Function AddFilter(SQLstr : string) : string; Function AddFilter(SQLstr : string) : string;
protected protected
@ -316,16 +316,16 @@ begin
ExecuteDirect(SQL,FTransaction); ExecuteDirect(SQL,FTransaction);
end; end;
Procedure TSQLConnection.ExecuteDirect(SQL: String; Transaction : TSQLTransaction); Procedure TSQLConnection.ExecuteDirect(SQL: String; ATransaction : TSQLTransaction);
var Cursor : TSQLCursor; var Cursor : TSQLCursor;
begin begin
if not assigned(Transaction) then if not assigned(ATransaction) then
DatabaseError(SErrTransactionnSet); DatabaseError(SErrTransactionnSet);
if not Connected then Open; if not Connected then Open;
if not Transaction.Active then Transaction.StartTransaction; if not ATransaction.Active then ATransaction.StartTransaction;
try try
Cursor := AllocateCursorHandle; Cursor := AllocateCursorHandle;
@ -337,8 +337,8 @@ begin
Cursor.FStatementType := stNone; Cursor.FStatementType := stNone;
PrepareStatement(cursor,Transaction,SQL,Nil); PrepareStatement(cursor,ATransaction,SQL,Nil);
execute(cursor,Transaction, Nil); execute(cursor,ATransaction, Nil);
UnPrepareStatement(Cursor); UnPrepareStatement(Cursor);
finally; finally;
DeAllocateCursorHandle(Cursor); DeAllocateCursorHandle(Cursor);
@ -627,7 +627,7 @@ begin
FCursor := Db.AllocateCursorHandle; FCursor := Db.AllocateCursorHandle;
FSQLBuf := TrimRight(FSQL.Text); FSQLBuf := TrimRight(FSQL.Text);
if FSQLBuf = '' then if FSQLBuf = '' then
DatabaseError(SErrNoStatement); DatabaseError(SErrNoStatement);
@ -679,10 +679,10 @@ begin
result := (Database as tSQLConnection).LoadField(FCursor,FieldDef,buffer) result := (Database as tSQLConnection).LoadField(FCursor,FieldDef,buffer)
end; end;
procedure TSQLQuery.DataConvert(Field: TField; Source, Dest: Pointer; ToNative: Boolean); procedure TSQLQuery.DataConvert(Field: TField; Source, Dest: Pointer; ToNative: Boolean);
begin begin
{ {
all data is in native format for these types, so no conversion is needed. all data is in native format for these types, so no conversion is needed.
} }
If not (Field.DataType in [ftDate,ftTime,ftDateTime]) then If not (Field.DataType in [ftDate,ftTime,ftDateTime]) then
@ -721,7 +721,7 @@ begin
end; end;
end; end;
procedure TSQLQuery.SQLParser(var SQL : string); procedure TSQLQuery.SQLParser(var ASQL : string);
type TParsePart = (ppStart,ppSelect,ppWhere,ppFrom,ppOrder,ppComment,ppBogus); type TParsePart = (ppStart,ppSelect,ppWhere,ppFrom,ppOrder,ppComment,ppBogus);
@ -733,12 +733,12 @@ Var
StrLength : Integer; StrLength : Integer;
begin begin
PSQL:=Pchar(SQL); PSQL:=Pchar(ASQL);
ParsePart := ppStart; ParsePart := ppStart;
CurrentP := PSQL-1; CurrentP := PSQL-1;
PhraseP := PSQL; PhraseP := PSQL;
FWhereStartPos := 0; FWhereStartPos := 0;
FWhereStopPos := 0; FWhereStopPos := 0;
@ -754,7 +754,7 @@ begin
Setlength(S,strLength); Setlength(S,strLength);
if strLength > 0 then Move(PhraseP^,S[1],(strLength)); if strLength > 0 then Move(PhraseP^,S[1],(strLength));
s := uppercase(s); s := uppercase(s);
case ParsePart of case ParsePart of
ppStart : begin ppStart : begin
FCursor.FStatementType := (Database as tsqlconnection).StrToStatementType(s); FCursor.FStatementType := (Database as tsqlconnection).StrToStatementType(s);
@ -815,13 +815,13 @@ begin
until CurrentP^=#0; until CurrentP^=#0;
if (FWhereStartPos > 0) and (FWhereStopPos > 0) then if (FWhereStartPos > 0) and (FWhereStopPos > 0) then
begin begin
system.insert('(',SQL,FWhereStartPos+1); system.insert('(',ASQL,FWhereStartPos+1);
inc(FWhereStopPos); inc(FWhereStopPos);
system.insert(')',SQL,FWhereStopPos); system.insert(')',ASQL,FWhereStopPos);
end end
end; end;
procedure TSQLQuery.InitUpdates(SQL : string); procedure TSQLQuery.InitUpdates(ASQL : string);
begin begin

View File

@ -33,7 +33,7 @@ Type
Constructor Create(AOWner : TSimpleIPCClient); override; Constructor Create(AOWner : TSimpleIPCClient); override;
Procedure Connect; override; Procedure Connect; override;
Procedure Disconnect; override; Procedure Disconnect; override;
Procedure SendMessage(MsgType : TMessageType; Stream : TStream); override; Procedure SendMessage(MsgType : TMessageType; AStream : TStream); override;
Function ServerRunning : Boolean; override; Function ServerRunning : Boolean; override;
Property FileName : String Read FFileName; Property FileName : String Read FFileName;
Property Stream : TFileStream Read FStream; Property Stream : TFileStream Read FStream;
@ -67,7 +67,7 @@ begin
FreeAndNil(FStream); FreeAndNil(FStream);
end; end;
procedure TPipeClientComm.SendMessage(MsgType : TMessagetype; Stream: TStream); procedure TPipeClientComm.SendMessage(MsgType : TMessagetype; AStream: TStream);
Var Var
Hdr : TMsgHeader; Hdr : TMsgHeader;
@ -76,9 +76,9 @@ Var
begin begin
Hdr.Version:=MsgVersion; Hdr.Version:=MsgVersion;
Hdr.msgType:=mtString; Hdr.msgType:=mtString;
Hdr.MsgLen:=Stream.Size; Hdr.MsgLen:=AStream.Size;
FStream.WriteBuffer(hdr,SizeOf(hdr)); FStream.WriteBuffer(hdr,SizeOf(hdr));
FStream.CopyFrom(Stream,0); FStream.CopyFrom(AStream,0);
end; end;
function TPipeClientComm.ServerRunning: Boolean; function TPipeClientComm.ServerRunning: Boolean;
@ -90,7 +90,7 @@ end;
{ --------------------------------------------------------------------- { ---------------------------------------------------------------------
TPipeServerComm TPipeServerComm
---------------------------------------------------------------------} ---------------------------------------------------------------------}
Type Type
TPipeServerComm = Class(TIPCServerComm) TPipeServerComm = Class(TIPCServerComm)
Private Private
@ -175,7 +175,7 @@ Function TSimpleIPCServer.CommClass : TIPCServerCommClass;
begin begin
if (DefaultIPCServerClass<>Nil) then if (DefaultIPCServerClass<>Nil) then
Result:=DefaultIPCServerClass Result:=DefaultIPCServerClass
else else
Result:=TPipeServerComm; Result:=TPipeServerComm;
end; end;
@ -183,6 +183,6 @@ function TSimpleIPCClient.CommClass: TIPCClientCommClass;
begin begin
if (DefaultIPCClientClass<>Nil) then if (DefaultIPCClientClass<>Nil) then
Result:=DefaultIPCClientClass Result:=DefaultIPCClientClass
else else
Result:=TPipeClientComm; Result:=TPipeClientComm;
end; end;