Browse Source

--- Merging r16500 into '.':
U packages/fcl-db/src/sqldb/sqlite/sqlite3conn.pp
--- Merging r16775 into '.':
G packages/fcl-db/src/sqldb/sqlite/sqlite3conn.pp
--- Merging r16776 into '.':
G packages/fcl-db/src/sqldb/sqlite/sqlite3conn.pp

# revisions: 16500,16775,16776
------------------------------------------------------------------------
r16500 | michael | 2010-12-03 09:59:20 +0100 (Fri, 03 Dec 2010) | 1 line
Changed paths:
M /trunk/packages/fcl-db/src/sqldb/sqlite/sqlite3conn.pp

* Made used SQLLite library name configurable
------------------------------------------------------------------------
------------------------------------------------------------------------
r16775 | michael | 2011-01-18 09:36:09 +0100 (Tue, 18 Jan 2011) | 1 line
Changed paths:
M /trunk/packages/fcl-db/src/sqldb/sqlite/sqlite3conn.pp

* Applied patch from bug #16493
------------------------------------------------------------------------
------------------------------------------------------------------------
r16776 | michael | 2011-01-18 10:31:49 +0100 (Tue, 18 Jan 2011) | 1 line
Changed paths:
M /trunk/packages/fcl-db/src/sqldb/sqlite/sqlite3conn.pp

* Minor code cleanup suggested by LacaK <[email protected]>
------------------------------------------------------------------------

git-svn-id: branches/fixes_2_4@16866 -

marco 14 years ago
parent
commit
06c039d319
1 changed files with 11 additions and 4 deletions
  1. 11 4
      packages/fcl-db/src/sqldb/sqlite/sqlite3conn.pp

+ 11 - 4
packages/fcl-db/src/sqldb/sqlite/sqlite3conn.pp

@@ -92,11 +92,14 @@ type
   published
     property Options: TSqliteOptions read FOptions write SetOptions;
   end;
- 
+  
+Var
+  SQLiteLibraryName : String = sqlite3lib; 
+   
 implementation
 
 uses
-  dbconst, sysutils, typinfo, dateutils;
+  dbconst, sysutils, dateutils;
  
 type
 
@@ -187,7 +190,7 @@ begin
                 checkerror(sqlite3_bind_blob(fstatement,I,pcharstr(str1), length(str1),@freebindstring));
                 end; 
       else 
-        databaseerror('Parameter type '+getenumname(typeinfo(tfieldtype),ord(P.datatype))+' not supported.');
+        DatabaseErrorFmt(SUnsupportedParameter, [Fieldtypenames[P.DataType], Self]);
       end; { Case }
     end;   
 end;
@@ -574,7 +577,7 @@ var
 begin
   if Length(databasename)=0 then
     DatabaseError(SErrNoDatabaseName,self);
-  initialisesqlite;
+  InitializeSqlite(SQLiteLibraryName);
   str1:= databasename;
   checkerror(sqlite3_open(pchar(str1),@fhandle));
 end;
@@ -719,6 +722,7 @@ var
 
 begin
   PKFields:=TStringList.Create;
+  PKFields.Delimiter:=';';
   IXFields:=TStringList.Create;
   IXFields.Delimiter:=';';
 
@@ -748,6 +752,9 @@ begin
     IndexDefs.Add(IndexName, IXFields.DelimitedText, IndexOptions);
     end;
 
+  if PKFields.Count > 0 then //in special case for INTEGER PRIMARY KEY column, unique index is not created
+    IndexDefs.Add('$PRIMARY_KEY$', PKFields.DelimitedText, [ixPrimary,ixUnique]);
+
   PKFields.Free;
   IXFields.Free;
 end;