Parcourir la 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 il y a 13 ans
Parent
commit
8e0a213a22

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

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

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

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

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

@@ -79,6 +79,7 @@ type
     procedure DeAllocateCursorHandle(var cursor:TSQLCursor); override;
     function AllocateTransactionHandle:TSQLHandle; override;
     // - Statement handling
+    function StrToStatementType(s : string) : TStatementType; override;
     procedure PrepareStatement(cursor:TSQLCursor; ATransaction:TSQLTransaction; buf:string; AParams:TParams); override;
     procedure UnPrepareStatement(cursor:TSQLCursor); override;
     // - Transaction handling
@@ -299,6 +300,14 @@ begin
 {$ENDIF}
 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);
 var
   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.
   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;
@@ -708,6 +713,8 @@ begin
   InitializeSqlite(SQLiteLibraryName);
   str1:= databasename;
   checkerror(sqlite3_open(pchar(str1),@fhandle));
+  if Params.IndexOfName('foreign_keys') <> -1 then
+    execsql('PRAGMA foreign_keys =  '+Params.Values['foreign_keys']);
 end;
 
 procedure TSQLite3Connection.DoInternalDisconnect;

Fichier diff supprimé car celui-ci est trop grand
+ 258 - 303
packages/fcl-db/tests/testdbbasics.pas


Certains fichiers n'ont pas été affichés car il y a eu trop de fichiers modifiés dans ce diff