Jelajahi Sumber

* fix duplicate parameter names

git-svn-id: trunk@2022 -
peter 19 tahun lalu
induk
melakukan
3db35349ec
6 mengubah file dengan 76 tambahan dan 76 penghapusan
  1. 23 23
      fcl/db/dataset.inc
  2. 9 9
      fcl/db/db.pp
  3. 6 6
      fcl/db/dsparams.inc
  4. 13 13
      fcl/db/fields.inc
  5. 18 18
      fcl/db/sqldb/sqldb.pp
  6. 7 7
      fcl/unix/simpleipc.inc

+ 23 - 23
fcl/db/dataset.inc

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

+ 9 - 9
fcl/db/db.pp

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

+ 6 - 6
fcl/db/dsparams.inc

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

+ 13 - 13
fcl/db/fields.inc

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

+ 18 - 18
fcl/db/sqldb/sqldb.pp

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

+ 7 - 7
fcl/unix/simpleipc.inc

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