Browse Source

--- Merging r19362 into '.':
U packages/fcl-db/src/sqldb/odbc/odbcconn.pas
--- Merging r19872 into '.':
U packages/fcl-db/src/sqldb/sqlite/sqlite3conn.pp
--- Merging r19891 into '.':
U packages/fcl-db/src/base/dataset.inc
--- Merging r19909 into '.':
U packages/fcl-db/tests/testdbbasics.pas
--- Merging r19910 into '.':
U packages/fcl-db/src/base/bufdataset.pas
--- Merging r19916 into '.':
G packages/fcl-db/tests/testdbbasics.pas

# revisions: 19362,19872,19891,19909,19910,19916
------------------------------------------------------------------------
r19362 | marco | 2011-10-04 13:27:56 +0200 (Tue, 04 Oct 2011) | 2 lines
Changed paths:
M /trunk/packages/fcl-db/src/sqldb/odbc/odbcconn.pas

* treat transform as select and exec as execute. Mantis #17050, patch by Lacak2

------------------------------------------------------------------------
------------------------------------------------------------------------
r19872 | marco | 2011-12-18 22:56:20 +0100 (Sun, 18 Dec 2011) | 2 lines
Changed paths:
M /trunk/packages/fcl-db/src/sqldb/sqlite/sqlite3conn.pp

* Patch from Ludo, Foreign key support for SQLite option. Mantis #20865

------------------------------------------------------------------------
------------------------------------------------------------------------
r19891 | marco | 2011-12-26 23:25:24 +0100 (Mon, 26 Dec 2011) | 3 lines
Changed paths:
M /trunk/packages/fcl-db/src/base/dataset.inc

* fix oncalcfields call without dscalcfieldstate. Patch by Jose Mejuto,
Mantis #20968

------------------------------------------------------------------------
------------------------------------------------------------------------
r19909 | joost | 2011-12-29 16:47:06 +0100 (Thu, 29 Dec 2011) | 1 line
Changed paths:
M /trunk/packages/fcl-db/tests/testdbbasics.pas

* Fixed compilation by Delphi
------------------------------------------------------------------------
------------------------------------------------------------------------
r19910 | joost | 2011-12-29 17:24:14 +0100 (Thu, 29 Dec 2011) | 1 line
Changed paths:
M /trunk/packages/fcl-db/src/base/bufdataset.pas

* Show a proper error-message when trying to do a locate on a uni-directional dataset
------------------------------------------------------------------------
------------------------------------------------------------------------
r19916 | joost | 2011-12-29 22:08:52 +0100 (Thu, 29 Dec 2011) | 4 lines
Changed paths:
M /trunk/packages/fcl-db/tests/testdbbasics.pas

* Moved those tests in TTestDBBasics that needs a cursor to the new
TTestCursorDBBasics so that they are not tested anymore on unidirectional
datasets.

------------------------------------------------------------------------

git-svn-id: branches/fixes_2_6@20016 -

marco 13 years ago
parent
commit
8e0a213a22

+ 2 - 1
packages/fcl-db/src/base/bufdataset.pas

@@ -2980,7 +2980,8 @@ var CurrLinkItem    : PBufRecLinkItem;
     FiltAcceptable  : boolean;
     FiltAcceptable  : boolean;
 
 
 begin
 begin
-  Result := False;
+  // Call inherited to make sure the dataset is bi-directional
+  Result := inherited;
   CheckActive;
   CheckActive;
   if IsEmpty then exit;
   if IsEmpty then exit;
 
 

+ 8 - 0
packages/fcl-db/src/base/dataset.inc

@@ -414,9 +414,17 @@ end;
 
 
 Procedure TDataset.DoOnCalcFields;
 Procedure TDataset.DoOnCalcFields;
 
 
+var
+  oldState: TDataSetState;
+
 begin
 begin
  If assigned(FOnCalcfields) then
  If assigned(FOnCalcfields) then
+ begin
+   oldState := FState;
+   FState := dsCalcFields;
    FOnCalcFields(Self);
    FOnCalcFields(Self);
+   FState := oldState;
+  end;
 end;
 end;
 
 
 Procedure TDataset.DoOnNewRecord;
 Procedure TDataset.DoOnNewRecord;

+ 9 - 0
packages/fcl-db/src/sqldb/odbc/odbcconn.pas

@@ -79,6 +79,7 @@ type
     procedure DeAllocateCursorHandle(var cursor:TSQLCursor); override;
     procedure DeAllocateCursorHandle(var cursor:TSQLCursor); override;
     function AllocateTransactionHandle:TSQLHandle; override;
     function AllocateTransactionHandle:TSQLHandle; override;
     // - Statement handling
     // - Statement handling
+    function StrToStatementType(s : string) : TStatementType; override;
     procedure PrepareStatement(cursor:TSQLCursor; ATransaction:TSQLTransaction; buf:string; AParams:TParams); override;
     procedure PrepareStatement(cursor:TSQLCursor; ATransaction:TSQLTransaction; buf:string; AParams:TParams); override;
     procedure UnPrepareStatement(cursor:TSQLCursor); override;
     procedure UnPrepareStatement(cursor:TSQLCursor); override;
     // - Transaction handling
     // - Transaction handling
@@ -299,6 +300,14 @@ begin
 {$ENDIF}
 {$ENDIF}
 end;
 end;
 
 
+function TODBCConnection.StrToStatementType(s : string) : TStatementType;
+begin
+  S:=Lowercase(s);
+  if s = 'transform' then Result:=stSelect //MS Access
+  else if s = 'exec' then Result:=stExecProcedure
+  else Result := inherited StrToStatementType(s);
+end;
+
 procedure TODBCConnection.SetParameters(ODBCCursor: TODBCCursor; AParams: TParams);
 procedure TODBCConnection.SetParameters(ODBCCursor: TODBCCursor; AParams: TParams);
 var
 var
   ParamIndex: integer;
   ParamIndex: integer;

+ 7 - 0
packages/fcl-db/src/sqldb/sqlite/sqlite3conn.pp

@@ -16,6 +16,11 @@
 { 
 { 
   Based on an implementation by Martin Schreiber, part of MSEIDE.
   Based on an implementation by Martin Schreiber, part of MSEIDE.
   Reworked all code so it conforms to FCL coding standards.
   Reworked all code so it conforms to FCL coding standards.
+
+  TSQLite3Connection properties
+      Params - "foreign_keys=ON" - enable foreign key support for this connection:
+                                   http://www.sqlite.org/foreignkeys.html#fk_enable
+
 } 
 } 
  
  
 unit sqlite3conn;
 unit sqlite3conn;
@@ -708,6 +713,8 @@ begin
   InitializeSqlite(SQLiteLibraryName);
   InitializeSqlite(SQLiteLibraryName);
   str1:= databasename;
   str1:= databasename;
   checkerror(sqlite3_open(pchar(str1),@fhandle));
   checkerror(sqlite3_open(pchar(str1),@fhandle));
+  if Params.IndexOfName('foreign_keys') <> -1 then
+    execsql('PRAGMA foreign_keys =  '+Params.Values['foreign_keys']);
 end;
 end;
 
 
 procedure TSQLite3Connection.DoInternalDisconnect;
 procedure TSQLite3Connection.DoInternalDisconnect;

File diff suppressed because it is too large
+ 258 - 303
packages/fcl-db/tests/testdbbasics.pas


Some files were not shown because too many files changed in this diff