Explorar o código

fcl-db: cosmetic:
* Rename deceptively named GetLogEvent
* Typos

git-svn-id: trunk@27407 -

reiniero %!s(int64=11) %!d(string=hai) anos
pai
achega
b2813cc627

+ 2 - 2
packages/fcl-db/src/base/dataset.inc

@@ -1279,7 +1279,7 @@ begin
   If FCurrentRecord<>Index then
     begin
 {$ifdef DSdebug}
-    Writeln ('Setting current record to',index);
+    Writeln ('Setting current record to: ',index);
 {$endif}
     if not FIsUniDirectional then Case GetBookMarkFlag(FBuffers[Index]) of
       bfCurrent : InternalSetToRecord(FBuffers[Index]);
@@ -1435,7 +1435,7 @@ function TDataSet.ActiveBuffer: TRecordBuffer;
 
 begin
 {$ifdef dsdebug}
-  Writeln ('Active buffer requested. Returning:',ActiveRecord);
+  Writeln ('Active buffer requested. Returning record number:',ActiveRecord);
 {$endif}
   Result:=FBuffers[FActiveRecord];
 end;

+ 1 - 1
packages/fcl-db/src/base/fields.inc

@@ -579,7 +579,7 @@ function TField.GetData(Buffer: Pointer; NativeFormat : Boolean): Boolean;
 begin
   IF FDataset=Nil then
     DatabaseErrorFmt(SNoDataset,[FieldName]);
-  If FVAlidating then
+  If FValidating then
     begin
     result:=assigned(FValueBuffer);
     If Result and assigned(Buffer) then

+ 9 - 3
packages/fcl-db/src/base/sqlscript.pp

@@ -459,9 +459,15 @@ begin
     pnt:=FindNextSeparator([FTerminator, '/*', '"', '''']);
     if (pnt=FTerminator) then
       begin
-      FCol:=FCol + length(pnt);
-      terminator_found:=True;
-      break;
+      if pnt='' then begin
+        // Empty line, only e.g. a ; present:
+        FEmitLine:=False;
+        end
+        else begin
+        FCol:=FCol + length(pnt);
+        terminator_found:=True;
+        break;
+        end;
       end
     else if pnt = '/*' then
       begin

+ 1 - 1
packages/fcl-db/src/sqldb/sqldb.pp

@@ -1,5 +1,5 @@
 {
-    Copyright (c) 2004-2013 by Joost van der Sluis, FPC contributors
+    Copyright (c) 2004-2014 by Joost van der Sluis, FPC contributors
 
     SQL database & dataset
 

+ 25 - 25
packages/fcl-db/tests/sqldbtoolsunit.pas

@@ -46,12 +46,12 @@ type
     function GetTestUniDirectional: boolean; override;
     procedure CreateNDatasets; override;
     procedure CreateFieldDataset; override;
-    procedure DropNDatasets; override;
-    procedure DropFieldDataset; override;
     // If logging is enabled, this procedure will receive the event
     // from the SQLDB logging system
     // For custom logging call with sender nil and eventtype detCustom
-    procedure GetLogEvent(Sender: TSQLConnection; EventType: TDBEventType; Const Msg : String);
+    procedure DoLogEvent(Sender: TSQLConnection; EventType: TDBEventType; Const Msg : String);
+    procedure DropNDatasets; override;
+    procedure DropFieldDataset; override;
     Function InternalGetNDataset(n : integer) : TDataset; override;
     Function InternalGetFieldDataset : TDataSet; override;
     procedure TryDropIfExist(ATableName : String);
@@ -196,7 +196,7 @@ begin
     if dblogfilename<>'' then
     begin
       LogEvents:=[detCustom,detCommit,detExecute,detRollBack];
-      OnLog:=@GetLogEvent;
+      OnLog:=@DoLogEvent;
     end;
 
     if (dbhostname='') and (SQLConnType=interbase) then
@@ -441,7 +441,7 @@ begin
   except
     on E: Exception do begin
       if dblogfilename<>'' then
-        GetLogEvent(nil,detCustom,'Exception running CreateNDatasets: '+E.Message);
+        DoLogEvent(nil,detCustom,'Exception running CreateNDatasets: '+E.Message);
       if Ftransaction.Active then
         Ftransaction.Rollback
     end;
@@ -542,12 +542,29 @@ begin
   except
     on E: Exception do begin
       if dblogfilename<>'' then
-        GetLogEvent(nil,detCustom,'Exception running CreateFieldDataset: '+E.Message);
+        DoLogEvent(nil,detCustom,'Exception running CreateFieldDataset: '+E.Message);
       if Ftransaction.Active then Ftransaction.Rollback;
     end;
   end;
 end;
 
+procedure TSQLDBConnector.DoLogEvent(Sender: TSQLConnection;
+  EventType: TDBEventType; const Msg: String);
+var
+  Category: string;
+begin
+  case EventType of
+    detCustom:   Category:='Custom';
+    detPrepare:  Category:='Prepare';
+    detExecute:  Category:='Execute';
+    detFetch:    Category:='Fetch';
+    detCommit:   Category:='Commit';
+    detRollBack: Category:='Rollback';
+    else Category:='Unknown event. Please fix program code.';
+  end;
+  LogMessage(Category,Msg);
+end;
+
 procedure TSQLDBConnector.DropNDatasets;
 begin
   if assigned(FTransaction) then
@@ -560,7 +577,7 @@ begin
     Except
       on E: Exception do begin
         if dblogfilename<>'' then
-          GetLogEvent(nil,detCustom,'Exception running DropNDatasets: '+E.Message);
+          DoLogEvent(nil,detCustom,'Exception running DropNDatasets: '+E.Message);
         if Ftransaction.Active then Ftransaction.Rollback
       end;
     end;
@@ -579,30 +596,13 @@ begin
     Except
       on E: Exception do begin
         if dblogfilename<>'' then
-          GetLogEvent(nil,detCustom,'Exception running DropFieldDataset: '+E.Message);
+          DoLogEvent(nil,detCustom,'Exception running DropFieldDataset: '+E.Message);
         if Ftransaction.Active then Ftransaction.Rollback
       end;
     end;
     end;
 end;
 
-procedure TSQLDBConnector.GetLogEvent(Sender: TSQLConnection;
-  EventType: TDBEventType; const Msg: String);
-var
-  Category: string;
-begin
-  case EventType of
-    detCustom:   Category:='Custom';
-    detPrepare:  Category:='Prepare';
-    detExecute:  Category:='Execute';
-    detFetch:    Category:='Fetch';
-    detCommit:   Category:='Commit';
-    detRollBack: Category:='Rollback';
-    else Category:='Unknown event. Please fix program code.';
-  end;
-  LogMessage(Category,Msg);
-end;
-
 function TSQLDBConnector.InternalGetNDataset(n: integer): TDataset;
 begin
   Result := CreateQuery;