Browse Source

--- Merging r15298 into '.':
U packages/fcl-db/tests/testdbbasics.pas
--- Merging r15300 into '.':
U packages/fcl-db/tests/testfieldtypes.pas
U packages/fcl-db/src/sqldb/sqlite/sqlite3conn.pp
--- Merging r15301 into '.':
G packages/fcl-db/tests/testfieldtypes.pas
--- Merging r15324 into '.':
U packages/fcl-db/src/sqlite/Makefile.fpc
C packages/fcl-db/src/sqlite/Makefile
U packages/fcl-db/src/memds/Makefile.fpc
C packages/fcl-db/src/memds/Makefile
U packages/fcl-db/src/sdf/Makefile.fpc
C packages/fcl-db/src/sdf/Makefile
U packages/fcl-db/src/dbase/Makefile.fpc
C packages/fcl-db/src/dbase/Makefile
U packages/fcl-db/src/paradox/Makefile.fpc
C packages/fcl-db/src/paradox/Makefile
--- Merging r15325 into '.':
G packages/fcl-db/src/sqldb/sqlite/sqlite3conn.pp
--- Merging r15375 into '.':
A packages/fcl-web/examples/jsonrpc/extdirect
A packages/fcl-web/examples/jsonrpc/extdirect/extdemo.js
A packages/fcl-web/examples/jsonrpc/extdirect/extdirect.in
A packages/fcl-web/examples/jsonrpc/extdirect/extdemo.lpr
A packages/fcl-web/examples/jsonrpc/extdirect/wmext.lfm
A packages/fcl-web/examples/jsonrpc/extdirect/wmext.pp
A packages/fcl-web/examples/jsonrpc/extdirect/wmext.lrs
A packages/fcl-web/examples/jsonrpc/extdirect/extdemo.html
A packages/fcl-web/examples/jsonrpc/extdirect/extdemo.lpi
--- Merging r15409 into '.':
G packages/fcl-db/tests/testdbbasics.pas
U packages/fcl-db/src/base/bufdataset.pas
--- Merging r15412 into '.':
G packages/fcl-db/tests/testdbbasics.pas
G packages/fcl-db/src/base/bufdataset.pas
--- Merging r15413 into '.':
G packages/fcl-db/tests/testdbbasics.pas
--- Merging r15418 into '.':
U packages/fcl-db/src/sqldb/mysql/mysqlconn.inc
--- Merging r15422 into '.':
U packages/fcl-db/tests/toolsunit.pas
G packages/fcl-db/tests/testdbbasics.pas
U packages/fcl-db/src/base/dataset.inc
--- Merging r15423 into '.':
G packages/fcl-db/src/sqldb/mysql/mysqlconn.inc
--- Merging r15425 into '.':
U packages/fcl-db/src/base/db.pas
U packages/fcl-base/src/maskutils.pp
--- Merging r15431 into '.':
U packages/fcl-db/src/sqldb/odbc/odbcconn.pas
--- Merging r15433 into '.':
G packages/fcl-db/src/sqldb/odbc/odbcconn.pas
--- Merging r15446 into '.':
U packages/fcl-web/src/webdata/sqldbwebdata.pp
--- Merging r15447 into '.':
G packages/fcl-web/src/webdata/sqldbwebdata.pp
--- Merging r15448 into '.':
U rtl/objpas/rtlconst.inc
--- Merging r15471 into '.':
U packages/fcl-db/src/sqldb/sqldb.pp
--- Merging r15478 into '.':
U rtl/inc/lnfodwrf.pp
--- Merging r15483 into '.':
U rtl/linux/arm/cprt0.as
--- Merging r15484 into '.':
U rtl/linux/arm/dllprt0.as
--- Merging r15489 into '.':
G packages/fcl-db/src/base/bufdataset.pas
--- Merging r15493 into '.':
U packages/sndfile/src/sndfile.pp
U packages/sndfile/examples/sfplay.pp
--- Merging r15495 into '.':
U packages/fcl-json/tests/testjsondata.pp
U packages/fcl-json/tests/testjsonparser.pp
U packages/fcl-json/src/fpjson.pp
--- Merging r15496 into '.':
G packages/fcl-json/src/fpjson.pp
--- Merging r15498 into '.':
G packages/fcl-db/src/sqldb/odbc/odbcconn.pas
--- Merging r15499 into '.':
G packages/fcl-db/tests/toolsunit.pas
G packages/fcl-db/tests/testfieldtypes.pas
U packages/fcl-db/tests/dbftoolsunit.pas
U packages/fcl-db/tests/sqldbtoolsunit.pas
--- Merging r15500 into '.':
G packages/fcl-db/tests/toolsunit.pas
G packages/fcl-db/tests/testfieldtypes.pas
G packages/fcl-db/tests/sqldbtoolsunit.pas
--- Merging r15503 into '.':
U packages/fcl-db/src/sqlite/sqlite3ds.pas
--- Merging r15505 into '.':
G packages/fcl-db/tests/toolsunit.pas
G packages/fcl-db/tests/testfieldtypes.pas
U packages/fcl-db/tests/sqldbtoolsunit.pas
--- Merging r15506 into '.':
G packages/fcl-db/tests/testfieldtypes.pas
--- Merging r15507 into '.':
G packages/fcl-db/src/sqldb/odbc/odbcconn.pas
Summary of conflicts:
Text conflicts: 5

# revisions: 15298,15300,15301,15324,15325,15375,15409,15412,15413,15418,15422,15423,15425,15431,15433,15446,15447,15448,15471,15478,15483,15484,15489,15493,15495,15496,15498,15499,15500,15503,15505,15506,15507
------------------------------------------------------------------------
r15298 | joost | 2010-05-20 20:31:38 +0200 (Thu, 20 May 2010) | 1 line
Changed paths:
M /trunk/packages/fcl-db/tests/testdbbasics.pas

* Test ftBCD fields .asstring
------------------------------------------------------------------------
------------------------------------------------------------------------
r15300 | joost | 2010-05-20 21:56:48 +0200 (Thu, 20 May 2010) | 1 line
Changed paths:
M /trunk/packages/fcl-db/src/sqldb/sqlite/sqlite3conn.pp
M /trunk/packages/fcl-db/tests/testfieldtypes.pas

* Detect multiple fields in primary key for sqlite + test, bug #16493
------------------------------------------------------------------------
------------------------------------------------------------------------
r15301 | joost | 2010-05-21 10:17:30 +0200 (Fri, 21 May 2010) | 1 line
Changed paths:
M /trunk/packages/fcl-db/tests/testfieldtypes.pas

* Fixed new test from r15300
------------------------------------------------------------------------
------------------------------------------------------------------------
r15324 | joost | 2010-05-25 21:37:28 +0200 (Tue, 25 May 2010) | 1 line
Changed paths:
M /trunk/packages/fcl-db/src/dbase/Makefile
M /trunk/packages/fcl-db/src/dbase/Makefile.fpc
M /trunk/packages/fcl-db/src/memds/Makefile
M /trunk/packages/fcl-db/src/memds/Makefile.fpc
M /trunk/packages/fcl-db/src/paradox/Makefile
M /trunk/packages/fcl-db/src/paradox/Makefile.fpc
M /trunk/packages/fcl-db/src/sdf/Makefile
M /trunk/packages/fcl-db/src/sdf/Makefile.fpc
M /trunk/packages/fcl-db/src/sqlite/Makefile
M /trunk/packages/fcl-db/src/sqlite/Makefile.fpc

* Added dependencies for sub-packages, bug #16555
------------------------------------------------------------------------
------------------------------------------------------------------------
r15325 | joost | 2010-05-25 22:10:44 +0200 (Tue, 25 May 2010) | 1 line
Changed paths:
M /trunk/packages/fcl-db/src/sqldb/sqlite/sqlite3conn.pp

* Result all indexes on UpdateIndexDefs, not only the PK. Patch from Ladislav Karrach, bug #16493
------------------------------------------------------------------------
------------------------------------------------------------------------
r15375 | michael | 2010-06-04 17:24:27 +0200 (Fri, 04 Jun 2010) | 1 line
Changed paths:
A /trunk/packages/fcl-web/examples/jsonrpc/extdirect
A /trunk/packages/fcl-web/examples/jsonrpc/extdirect/extdemo.html
A /trunk/packages/fcl-web/examples/jsonrpc/extdirect/extdemo.js
A /trunk/packages/fcl-web/examples/jsonrpc/extdirect/extdemo.lpi
A /trunk/packages/fcl-web/examples/jsonrpc/extdirect/extdemo.lpr
A /trunk/packages/fcl-web/examples/jsonrpc/extdirect/extdirect.in
A /trunk/packages/fcl-web/examples/jsonrpc/extdirect/wmext.lfm
A /trunk/packages/fcl-web/examples/jsonrpc/extdirect/wmext.lrs
A /trunk/packages/fcl-web/examples/jsonrpc/extdirect/wmext.pp

* Ext.Direct demo
------------------------------------------------------------------------
------------------------------------------------------------------------
r15409 | joost | 2010-06-11 17:14:43 +0200 (Fri, 11 Jun 2010) | 2 lines
Changed paths:
M /trunk/packages/fcl-db/src/base/bufdataset.pas
M /trunk/packages/fcl-db/tests/testdbbasics.pas

* Fixed accessing TCustomBufDataset.IndexFieldNames from a new instance (bug 16695 + test)
* Fixed problems when closing a dataset that was opened using the FileName property, when the FileName property was cleared in between
------------------------------------------------------------------------
------------------------------------------------------------------------
r15412 | joost | 2010-06-12 13:42:38 +0200 (Sat, 12 Jun 2010) | 1 line
Changed paths:
M /trunk/packages/fcl-db/src/base/bufdataset.pas
M /trunk/packages/fcl-db/tests/testdbbasics.pas

* Fixed accessing TCustomBufDataset.IndexName and CompareBookmarks from a new instance (bug 16695+adapted test)
------------------------------------------------------------------------
------------------------------------------------------------------------
r15413 | joost | 2010-06-12 18:37:35 +0200 (Sat, 12 Jun 2010) | 1 line
Changed paths:
M /trunk/packages/fcl-db/tests/testdbbasics.pas

* Splitted up TCustomBufDataset tests from more general tests
------------------------------------------------------------------------
------------------------------------------------------------------------
r15418 | joost | 2010-06-13 12:56:10 +0200 (Sun, 13 Jun 2010) | 1 line
Changed paths:
M /trunk/packages/fcl-db/src/sqldb/mysql/mysqlconn.inc

* Implemented usage of mysql connection params, see bug #16568
------------------------------------------------------------------------
------------------------------------------------------------------------
r15422 | joost | 2010-06-13 14:26:50 +0200 (Sun, 13 Jun 2010) | 1 line
Changed paths:
M /trunk/packages/fcl-db/src/base/dataset.inc
M /trunk/packages/fcl-db/tests/testdbbasics.pas
M /trunk/packages/fcl-db/tests/toolsunit.pas

* Call TDatalink.LayoutChanged when controls are disabled and dataset closed/opened. Bug #16428 + test
------------------------------------------------------------------------
------------------------------------------------------------------------
r15423 | joost | 2010-06-13 15:18:22 +0200 (Sun, 13 Jun 2010) | 1 line
Changed paths:
M /trunk/packages/fcl-db/src/sqldb/mysql/mysqlconn.inc

* Use resourcestring for error message
------------------------------------------------------------------------
------------------------------------------------------------------------
r15425 | joost | 2010-06-13 15:26:55 +0200 (Sun, 13 Jun 2010) | 1 line
Changed paths:
M /trunk/packages/fcl-base/src/maskutils.pp
M /trunk/packages/fcl-db/src/base/db.pas

* Implemented TField.Editmask by Luiz Americo, bug #16555
------------------------------------------------------------------------
------------------------------------------------------------------------
r15431 | joost | 2010-06-13 21:37:59 +0200 (Sun, 13 Jun 2010) | 2 lines
Changed paths:
M /trunk/packages/fcl-db/src/sqldb/odbc/odbcconn.pas

* Support for ftFixedChar parameter
* Use SQL_VARCHAR instead of SQL_LONGVARCHAR, bug #14907, based on patch from Ladislav Karrach
------------------------------------------------------------------------
------------------------------------------------------------------------
r15433 | joost | 2010-06-13 21:47:25 +0200 (Sun, 13 Jun 2010) | 1 line
Changed paths:
M /trunk/packages/fcl-db/src/sqldb/odbc/odbcconn.pas

* Fixed for query-results with double fieldnames
------------------------------------------------------------------------
------------------------------------------------------------------------
r15446 | michael | 2010-06-17 14:37:49 +0200 (Thu, 17 Jun 2010) | 1 line
Changed paths:
M /trunk/packages/fcl-web/src/webdata/sqldbwebdata.pp

* Fix access violation. Notification must always call inherited notification
------------------------------------------------------------------------
------------------------------------------------------------------------
r15447 | michael | 2010-06-17 15:31:56 +0200 (Thu, 17 Jun 2010) | 1 line
Changed paths:
M /trunk/packages/fcl-web/src/webdata/sqldbwebdata.pp

* Publish options
------------------------------------------------------------------------
------------------------------------------------------------------------
r15448 | michael | 2010-06-18 21:40:12 +0200 (Fri, 18 Jun 2010) | 1 line
Changed paths:
M /trunk/rtl/objpas/rtlconst.inc

* Patch from Mattias Gaertner to fix missing classname placeholder
------------------------------------------------------------------------
------------------------------------------------------------------------
r15471 | michael | 2010-06-22 13:48:31 +0200 (Tue, 22 Jun 2010) | 1 line
Changed paths:
M /trunk/packages/fcl-db/src/sqldb/sqldb.pp

* Added easy access function for params
------------------------------------------------------------------------
------------------------------------------------------------------------
r15478 | pierre | 2010-06-26 00:21:38 +0200 (Sat, 26 Jun 2010) | 1 line
Changed paths:
M /trunk/rtl/inc/lnfodwrf.pp

avoid range check error in ParseCompilationUnit
------------------------------------------------------------------------
------------------------------------------------------------------------
r15483 | florian | 2010-06-27 13:04:27 +0200 (Sun, 27 Jun 2010) | 1 line
Changed paths:
M /trunk/rtl/linux/arm/cprt0.as

* tabs by spaces replaced
------------------------------------------------------------------------
------------------------------------------------------------------------
r15484 | florian | 2010-06-27 13:07:35 +0200 (Sun, 27 Jun 2010) | 1 line
Changed paths:
M /trunk/rtl/linux/arm/dllprt0.as

* minimal implementation by Benjamin 'BeRo' Rosseaux
------------------------------------------------------------------------
------------------------------------------------------------------------
r15489 | joost | 2010-06-28 21:17:52 +0200 (Mon, 28 Jun 2010) | 1 line
Changed paths:
M /trunk/packages/fcl-db/src/base/bufdataset.pas

* Set defailt value for UniDirectional
------------------------------------------------------------------------
------------------------------------------------------------------------
r15493 | marco | 2010-06-29 20:27:53 +0200 (Tue, 29 Jun 2010) | 2 lines
Changed paths:
M /trunk/packages/sndfile/examples/sfplay.pp
M /trunk/packages/sndfile/src/sndfile.pp

* fix example that is still in 1.0.x state.

------------------------------------------------------------------------
------------------------------------------------------------------------
r15495 | michael | 2010-06-30 12:35:04 +0200 (Wed, 30 Jun 2010) | 1 line
Changed paths:
M /trunk/packages/fcl-json/src/fpjson.pp
M /trunk/packages/fcl-json/tests/testjsondata.pp
M /trunk/packages/fcl-json/tests/testjsonparser.pp

* Patches for bugs 16815 and 16807 (double type and access violation when accessing non-existent member
------------------------------------------------------------------------
------------------------------------------------------------------------
r15496 | michael | 2010-06-30 12:43:18 +0200 (Wed, 30 Jun 2010) | 1 line
Changed paths:
M /trunk/packages/fcl-json/src/fpjson.pp

* Applied patch from Luiz Americo to improve speed (const for string params)
------------------------------------------------------------------------
------------------------------------------------------------------------
r15498 | joost | 2010-06-30 20:17:27 +0200 (Wed, 30 Jun 2010) | 1 line
Changed paths:
M /trunk/packages/fcl-db/src/sqldb/odbc/odbcconn.pas

* Implemented GetTableNames, systemtables=true, bug #13893, by Ladislav Karrach
------------------------------------------------------------------------
------------------------------------------------------------------------
r15499 | joost | 2010-06-30 20:29:41 +0200 (Wed, 30 Jun 2010) | 1 line
Changed paths:
M /trunk/packages/fcl-db/tests/dbftoolsunit.pas
M /trunk/packages/fcl-db/tests/sqldbtoolsunit.pas
M /trunk/packages/fcl-db/tests/testfieldtypes.pas
M /trunk/packages/fcl-db/tests/toolsunit.pas

* Patch from Luiz Americo to fix a double pathdelim in filename, bug #16737
------------------------------------------------------------------------
------------------------------------------------------------------------
r15500 | joost | 2010-06-30 20:32:25 +0200 (Wed, 30 Jun 2010) | 1 line
Changed paths:
M /trunk/packages/fcl-db/tests/sqldbtoolsunit.pas
M /trunk/packages/fcl-db/tests/testfieldtypes.pas
M /trunk/packages/fcl-db/tests/toolsunit.pas

* Revert accidentally commited files in r15499
------------------------------------------------------------------------
------------------------------------------------------------------------
r15503 | blikblum | 2010-06-30 22:25:25 +0200 (Wed, 30 Jun 2010) | 1 line
Changed paths:
M /trunk/packages/fcl-db/src/sqlite/sqlite3ds.pas

* Set Datasize for the unrecognized field types
------------------------------------------------------------------------
------------------------------------------------------------------------
r15505 | joost | 2010-07-01 17:21:46 +0200 (Thu, 01 Jul 2010) | 1 line
Changed paths:
M /trunk/packages/fcl-db/tests/sqldbtoolsunit.pas
M /trunk/packages/fcl-db/tests/testfieldtypes.pas
M /trunk/packages/fcl-db/tests/toolsunit.pas

* Added ability to specify fieldname-quote chars for tests. Usefull for ODBC where these chars can differ
------------------------------------------------------------------------
------------------------------------------------------------------------
r15506 | joost | 2010-07-01 17:44:21 +0200 (Thu, 01 Jul 2010) | 1 line
Changed paths:
M /trunk/packages/fcl-db/tests/testfieldtypes.pas

* Make sure that fixed width parameters are really ftFixedChar
------------------------------------------------------------------------
------------------------------------------------------------------------
r15507 | joost | 2010-07-01 17:50:17 +0200 (Thu, 01 Jul 2010) | 1 line
Changed paths:
M /trunk/packages/fcl-db/src/sqldb/odbc/odbcconn.pas

* Map blob to SQL_LONGVARBINARY, MS SQL has a maximum of 8000 bytes for SQL_BINARY types, bug #14907
------------------------------------------------------------------------

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

marco 14 years ago
parent
commit
6ed6eda88d
43 changed files with 1616 additions and 282 deletions
  1. 8 0
      .gitattributes
  2. 2 2
      packages/fcl-base/src/maskutils.pp
  3. 11 5
      packages/fcl-db/src/base/bufdataset.pas
  4. 2 0
      packages/fcl-db/src/base/dataset.inc
  5. 6 1
      packages/fcl-db/src/base/db.pas
  6. 142 2
      packages/fcl-db/src/dbase/Makefile
  7. 3 0
      packages/fcl-db/src/dbase/Makefile.fpc
  8. 136 2
      packages/fcl-db/src/memds/Makefile
  9. 3 0
      packages/fcl-db/src/memds/Makefile.fpc
  10. 134 2
      packages/fcl-db/src/paradox/Makefile
  11. 1 1
      packages/fcl-db/src/paradox/Makefile.fpc
  12. 133 2
      packages/fcl-db/src/sdf/Makefile
  13. 3 0
      packages/fcl-db/src/sdf/Makefile.fpc
  14. 52 1
      packages/fcl-db/src/sqldb/mysql/mysqlconn.inc
  15. 25 14
      packages/fcl-db/src/sqldb/odbc/odbcconn.pas
  16. 7 0
      packages/fcl-db/src/sqldb/sqldb.pp
  17. 48 46
      packages/fcl-db/src/sqldb/sqlite/sqlite3conn.pp
  18. 131 2
      packages/fcl-db/src/sqlite/Makefile
  19. 1 1
      packages/fcl-db/src/sqlite/Makefile.fpc
  20. 5 1
      packages/fcl-db/src/sqlite/sqlite3ds.pas
  21. 2 2
      packages/fcl-db/tests/dbftoolsunit.pas
  22. 5 0
      packages/fcl-db/tests/sqldbtoolsunit.pas
  23. 140 85
      packages/fcl-db/tests/testdbbasics.pas
  24. 34 19
      packages/fcl-db/tests/testfieldtypes.pas
  25. 10 1
      packages/fcl-db/tests/toolsunit.pas
  26. 52 50
      packages/fcl-json/src/fpjson.pp
  27. 23 2
      packages/fcl-json/tests/testjsondata.pp
  28. 3 3
      packages/fcl-json/tests/testjsonparser.pp
  29. 12 0
      packages/fcl-web/examples/jsonrpc/extdirect/extdemo.html
  30. 44 0
      packages/fcl-web/examples/jsonrpc/extdirect/extdemo.js
  31. 261 0
      packages/fcl-web/examples/jsonrpc/extdirect/extdemo.lpi
  32. 15 0
      packages/fcl-web/examples/jsonrpc/extdirect/extdemo.lpr
  33. 4 0
      packages/fcl-web/examples/jsonrpc/extdirect/extdirect.in
  34. 24 0
      packages/fcl-web/examples/jsonrpc/extdirect/wmext.lfm
  35. 10 0
      packages/fcl-web/examples/jsonrpc/extdirect/wmext.lrs
  36. 52 0
      packages/fcl-web/examples/jsonrpc/extdirect/wmext.pp
  37. 2 0
      packages/fcl-web/src/webdata/sqldbwebdata.pp
  38. 25 30
      packages/sndfile/examples/sfplay.pp
  39. 2 1
      packages/sndfile/src/sndfile.pp
  40. 5 3
      rtl/inc/lnfodwrf.pp
  41. 3 3
      rtl/linux/arm/cprt0.as
  42. 34 0
      rtl/linux/arm/dllprt0.as
  43. 1 1
      rtl/objpas/rtlconst.inc

+ 8 - 0
.gitattributes

@@ -1658,6 +1658,14 @@ packages/fcl-web/examples/jsonrpc/demo1/notification.in svneol=native#text/plain
 packages/fcl-web/examples/jsonrpc/demo1/wmdemo.lfm svneol=native#text/plain
 packages/fcl-web/examples/jsonrpc/demo1/wmdemo.lrs svneol=native#text/plain
 packages/fcl-web/examples/jsonrpc/demo1/wmdemo.pp svneol=native#text/plain
+packages/fcl-web/examples/jsonrpc/extdirect/extdemo.html svneol=native#text/plain
+packages/fcl-web/examples/jsonrpc/extdirect/extdemo.js svneol=native#text/plain
+packages/fcl-web/examples/jsonrpc/extdirect/extdemo.lpi svneol=native#text/plain
+packages/fcl-web/examples/jsonrpc/extdirect/extdemo.lpr svneol=native#text/plain
+packages/fcl-web/examples/jsonrpc/extdirect/extdirect.in svneol=native#text/plain
+packages/fcl-web/examples/jsonrpc/extdirect/wmext.lfm svneol=native#text/plain
+packages/fcl-web/examples/jsonrpc/extdirect/wmext.lrs svneol=native#text/plain
+packages/fcl-web/examples/jsonrpc/extdirect/wmext.pp svneol=native#text/plain
 packages/fcl-web/examples/webdata/demo/createusers.lpi svneol=native#text/plain
 packages/fcl-web/examples/webdata/demo/createusers.lpr svneol=native#text/plain
 packages/fcl-web/examples/webdata/demo/extgrid-json.html svneol=native#text/plain

+ 2 - 2
packages/fcl-base/src/maskutils.pp

@@ -63,8 +63,8 @@ type
   );
 
   TParseState = set of TStepState;
-
-
+  
+  TEditMask = type string;
 
 { TMaskUtils }
 

+ 11 - 5
packages/fcl-db/src/base/bufdataset.pas

@@ -396,6 +396,7 @@ type
   TCustomBufDataset = class(TDBDataSet)
   private
     FFileName: string;
+    FReadFromFile   : boolean;
     FFileStream     : TFileStream;
     FDatasetReader  : TDataPacketReader;
     FIndexes        : array of TBufIndex;
@@ -535,7 +536,7 @@ type
     property IndexDefs : TIndexDefs read GetIndexDefs;
     property IndexName : String read GetIndexName write SetIndexName;
     property IndexFieldNames : String read GetIndexFieldNames write SetIndexFieldNames;
-    property UniDirectional: boolean read GetBufUniDirectional write SetBufUniDirectional;
+    property UniDirectional: boolean read GetBufUniDirectional write SetBufUniDirectional default False;
   end;
 
   TBufDataset = class(TCustomBufDataset)
@@ -1061,6 +1062,7 @@ begin
     begin
     FFileStream := TFileStream.Create(FileName,fmOpenRead);
     FDatasetReader := TFpcBinaryDatapacketReader.Create(FFileStream);
+    FReadFromFile := True;
     end;
   if assigned(FDatasetReader) then IntLoadFielddefsFromFile;
   CalcRecordSize;
@@ -1132,6 +1134,7 @@ begin
   SetLength(FFieldBufPositions,0);
 
   if assigned(FParser) then FreeAndNil(FParser);
+  FReadFromFile:=false;
 end;
 
 procedure TCustomBufDataset.InternalFirst;
@@ -2195,7 +2198,7 @@ end;
 
 function TCustomBufDataset.GetIndexFieldNames: String;
 begin
-  if FCurrentIndex<>FIndexes[1] then
+  if (FIndexesCount=0) or (FCurrentIndex<>FIndexes[1]) then
     result := ''
   else
     result := FCurrentIndex.FieldsName;
@@ -2203,7 +2206,10 @@ end;
 
 function TCustomBufDataset.GetIndexName: String;
 begin
-  result := FCurrentIndex.Name;
+  if FIndexesCount>0 then
+    result := FCurrentIndex.Name
+  else
+    result := '';
 end;
 
 function TCustomBufDataset.GetBufUniDirectional: boolean;
@@ -2630,7 +2636,7 @@ end;
 function TCustomBufDataset.CompareBookmarks(Bookmark1, Bookmark2: TBookmark
   ): Longint;
 begin
-  if FCurrentIndex.CompareBookmarks(Bookmark1,Bookmark2) then
+  if Assigned(FCurrentIndex) and FCurrentIndex.CompareBookmarks(Bookmark1,Bookmark2) then
     Result := 0
   else
     Result := -1;
@@ -2865,7 +2871,7 @@ end;
 
 function TCustomBufDataset.IsReadFromPacket: Boolean;
 begin
-  Result := (FDatasetReader<>nil) or (FFileName<>'');
+  Result := (FDatasetReader<>nil) or (FFileName<>'') or FReadFromFile;
 end;
 
 procedure TCustomBufDataset.ParseFilter(const AFilter: string);

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

@@ -254,6 +254,7 @@ begin
     deFieldChange   : HandleFieldChange(TField(Info));
     deDataSetChange,
     deDataSetScroll : HandleScrollOrChange;
+    deLayoutChange  : FEnableControlsEvent:=deLayoutChange;    
   end;
 
   if not ControlsDisabled then begin
@@ -1062,6 +1063,7 @@ begin
     else
       begin
       DoBeforeOpen;
+      FEnableControlsEvent:=deLayoutChange;
       FInternalCalcFields:=False;
       try
         FDefaultFields:=FieldCount=0;

+ 6 - 1
packages/fcl-db/src/base/db.pas

@@ -22,7 +22,7 @@ unit db;
 
 interface
 
-uses Classes,Sysutils,Variants,FmtBCD;
+uses Classes,Sysutils,Variants,FmtBCD,MaskUtils;
 
 const
 
@@ -271,6 +271,7 @@ type
     FDefaultExpression : String;
     FDisplayLabel : String;
     FDisplayWidth : Longint;
+    FEditMask: TEditMask;
     FFieldKind : TFieldKind;
     FFieldName : String;
     FFieldNo : Longint;
@@ -401,6 +402,8 @@ type
     property DataType: TFieldType read FDataType;
     property DisplayName: String Read GetDisplayName;
     property DisplayText: String read GetDisplayText;
+    property EditMask: TEditMask read FEditMask write FEditMask;
+    property EditMaskPtr: TEditMask read FEditMask;
     property FieldNo: Longint read FFieldNo;
     property IsIndexField: Boolean read FIsIndexField;
     property IsNull: Boolean read GetIsNull;
@@ -472,6 +475,7 @@ type
     property Transliterate: Boolean read FTransliterate write FTransliterate;
     property Value: String read GetAsString write SetAsString;
   published
+    property EditMask;
     property Size default 20;
   end;
 
@@ -700,6 +704,7 @@ type
     property Value: TDateTime read GetAsDateTime write SetAsDateTime;
   published
     property DisplayFormat: string read FDisplayFormat write SetDisplayFormat;
+    property EditMask;
   end;
 
 { TDateField }

+ 142 - 2
packages/fcl-db/src/dbase/Makefile

@@ -2,7 +2,7 @@
 # Don't edit, this file is generated by FPCMake Version 2.0.0 [2010/08/25]
 #
 default: all
-MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-solaris x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-darwin arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded avr-embedded armeb-linux armeb-embedded mipsel-linux
+MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian i386-nativent m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-solaris x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-darwin arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded avr-embedded armeb-linux armeb-embedded mipsel-linux
 BSDs = freebsd netbsd openbsd darwin
 UNIXs = linux $(BSDs) solaris qnx haiku
 LIMIT83fs = go32v2 os2 emx watcom
@@ -334,6 +334,9 @@ endif
 ifeq ($(FULL_TARGET),i386-symbian)
 override TARGET_UNITS+=dbf
 endif
+ifeq ($(FULL_TARGET),i386-nativent)
+override TARGET_UNITS+=dbf
+endif
 ifeq ($(FULL_TARGET),m68k-linux)
 override TARGET_UNITS+=dbf
 endif
@@ -514,6 +517,9 @@ endif
 ifeq ($(FULL_TARGET),i386-symbian)
 override TARGET_EXAMPLES+=testdbf
 endif
+ifeq ($(FULL_TARGET),i386-nativent)
+override TARGET_EXAMPLES+=testdbf
+endif
 ifeq ($(FULL_TARGET),m68k-linux)
 override TARGET_EXAMPLES+=testdbf
 endif
@@ -694,6 +700,9 @@ endif
 ifeq ($(FULL_TARGET),i386-symbian)
 override CLEAN_UNITS+=dbf_collate dbf_common dbf_cursor dbf_dbffile dbf_fields dbf_idxcur dbf_idxfile dbf_lang dbf_memo dbf_parser dbf_pgfile dbf_prscore dbf_prsdef dbf_prssupp dbf_str
 endif
+ifeq ($(FULL_TARGET),i386-nativent)
+override CLEAN_UNITS+=dbf_collate dbf_common dbf_cursor dbf_dbffile dbf_fields dbf_idxcur dbf_idxfile dbf_lang dbf_memo dbf_parser dbf_pgfile dbf_prscore dbf_prsdef dbf_prssupp dbf_str
+endif
 ifeq ($(FULL_TARGET),m68k-linux)
 override CLEAN_UNITS+=dbf_collate dbf_common dbf_cursor dbf_dbffile dbf_fields dbf_idxcur dbf_idxfile dbf_lang dbf_memo dbf_parser dbf_pgfile dbf_prscore dbf_prsdef dbf_prssupp dbf_str
 endif
@@ -874,6 +883,9 @@ endif
 ifeq ($(FULL_TARGET),i386-symbian)
 override INSTALL_UNITS+=dbf_collate dbf_common dbf_cursor dbf_dbffile dbf_fields dbf_idxcur dbf_idxfile dbf_lang dbf_memo dbf_parser dbf_pgfile dbf_prscore dbf_prsdef dbf_prssupp dbf_str
 endif
+ifeq ($(FULL_TARGET),i386-nativent)
+override INSTALL_UNITS+=dbf_collate dbf_common dbf_cursor dbf_dbffile dbf_fields dbf_idxcur dbf_idxfile dbf_lang dbf_memo dbf_parser dbf_pgfile dbf_prscore dbf_prsdef dbf_prssupp dbf_str
+endif
 ifeq ($(FULL_TARGET),m68k-linux)
 override INSTALL_UNITS+=dbf_collate dbf_common dbf_cursor dbf_dbffile dbf_fields dbf_idxcur dbf_idxfile dbf_lang dbf_memo dbf_parser dbf_pgfile dbf_prscore dbf_prsdef dbf_prssupp dbf_str
 endif
@@ -1055,6 +1067,9 @@ endif
 ifeq ($(FULL_TARGET),i386-symbian)
 override COMPILER_OPTIONS+=-S2 -Sh
 endif
+ifeq ($(FULL_TARGET),i386-nativent)
+override COMPILER_OPTIONS+=-S2 -Sh
+endif
 ifeq ($(FULL_TARGET),m68k-linux)
 override COMPILER_OPTIONS+=-S2 -Sh
 endif
@@ -1517,6 +1532,10 @@ ifeq ($(OS_TARGET),symbian)
 SHAREDLIBEXT=.dll
 SHORTSUFFIX=symbian
 endif
+ifeq ($(OS_TARGET),NativeNT)
+SHAREDLIBEXT=.dll
+SHORTSUFFIX=nativent
+endif
 else
 ifeq ($(OS_TARGET),go32v1)
 PPUEXT=.pp1
@@ -1941,186 +1960,255 @@ else
 TAROPT=vz
 TAREXT=.tar.gz
 endif
-override REQUIRE_PACKAGES=rtl 
+override REQUIRE_PACKAGES=rtl fcl-base
 ifeq ($(FULL_TARGET),i386-linux)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),i386-go32v2)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),i386-win32)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),i386-os2)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),i386-freebsd)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),i386-beos)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),i386-haiku)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),i386-netbsd)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),i386-solaris)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),i386-qnx)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),i386-netware)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),i386-openbsd)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),i386-wdosx)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),i386-darwin)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_UNIVINT=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),i386-emx)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),i386-watcom)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),i386-netwlibc)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),i386-wince)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),i386-embedded)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),i386-symbian)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
+endif
+ifeq ($(FULL_TARGET),i386-nativent)
+REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),m68k-linux)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),m68k-freebsd)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),m68k-netbsd)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),m68k-amiga)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),m68k-atari)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),m68k-openbsd)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),m68k-palmos)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),m68k-embedded)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),powerpc-linux)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),powerpc-netbsd)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),powerpc-amiga)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),powerpc-macos)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),powerpc-darwin)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_UNIVINT=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),powerpc-morphos)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),powerpc-embedded)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),sparc-linux)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),sparc-netbsd)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),sparc-solaris)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),sparc-embedded)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),x86_64-linux)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),x86_64-freebsd)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),x86_64-solaris)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),x86_64-darwin)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_UNIVINT=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),x86_64-win64)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),x86_64-embedded)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),arm-linux)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),arm-palmos)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),arm-darwin)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_UNIVINT=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),arm-wince)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),arm-gba)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),arm-nds)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),arm-embedded)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),arm-symbian)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),powerpc64-linux)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),powerpc64-darwin)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_UNIVINT=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),powerpc64-embedded)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),avr-embedded)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),armeb-linux)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),armeb-embedded)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),mipsel-linux)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifdef REQUIRE_PACKAGES_RTL
 PACKAGEDIR_RTL:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /rtl/Makefile.fpc,$(PACKAGESDIR))))))
@@ -2148,6 +2236,58 @@ ifdef UNITDIR_RTL
 override COMPILER_UNITDIR+=$(UNITDIR_RTL)
 endif
 endif
+ifdef REQUIRE_PACKAGES_FCL-BASE
+PACKAGEDIR_FCL-BASE:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /fcl-base/Makefile.fpc,$(PACKAGESDIR))))))
+ifneq ($(PACKAGEDIR_FCL-BASE),)
+ifneq ($(wildcard $(PACKAGEDIR_FCL-BASE)/units/$(TARGETSUFFIX)),)
+UNITDIR_FCL-BASE=$(PACKAGEDIR_FCL-BASE)/units/$(TARGETSUFFIX)
+else
+UNITDIR_FCL-BASE=$(PACKAGEDIR_FCL-BASE)
+endif
+ifdef CHECKDEPEND
+$(PACKAGEDIR_FCL-BASE)/$(FPCMADE):
+	$(MAKE) -C $(PACKAGEDIR_FCL-BASE) $(FPCMADE)
+override ALLDEPENDENCIES+=$(PACKAGEDIR_FCL-BASE)/$(FPCMADE)
+endif
+else
+PACKAGEDIR_FCL-BASE=
+UNITDIR_FCL-BASE:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /fcl-base/Package.fpc,$(UNITSDIR)))))
+ifneq ($(UNITDIR_FCL-BASE),)
+UNITDIR_FCL-BASE:=$(firstword $(UNITDIR_FCL-BASE))
+else
+UNITDIR_FCL-BASE=
+endif
+endif
+ifdef UNITDIR_FCL-BASE
+override COMPILER_UNITDIR+=$(UNITDIR_FCL-BASE)
+endif
+endif
+ifdef REQUIRE_PACKAGES_UNIVINT
+PACKAGEDIR_UNIVINT:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /univint/Makefile.fpc,$(PACKAGESDIR))))))
+ifneq ($(PACKAGEDIR_UNIVINT),)
+ifneq ($(wildcard $(PACKAGEDIR_UNIVINT)/units/$(TARGETSUFFIX)),)
+UNITDIR_UNIVINT=$(PACKAGEDIR_UNIVINT)/units/$(TARGETSUFFIX)
+else
+UNITDIR_UNIVINT=$(PACKAGEDIR_UNIVINT)
+endif
+ifdef CHECKDEPEND
+$(PACKAGEDIR_UNIVINT)/$(FPCMADE):
+	$(MAKE) -C $(PACKAGEDIR_UNIVINT) $(FPCMADE)
+override ALLDEPENDENCIES+=$(PACKAGEDIR_UNIVINT)/$(FPCMADE)
+endif
+else
+PACKAGEDIR_UNIVINT=
+UNITDIR_UNIVINT:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /univint/Package.fpc,$(UNITSDIR)))))
+ifneq ($(UNITDIR_UNIVINT),)
+UNITDIR_UNIVINT:=$(firstword $(UNITDIR_UNIVINT))
+else
+UNITDIR_UNIVINT=
+endif
+endif
+ifdef UNITDIR_UNIVINT
+override COMPILER_UNITDIR+=$(UNITDIR_UNIVINT)
+endif
+endif
 ifndef NOCPUDEF
 override FPCOPTDEF=$(ARCH)
 endif

+ 3 - 0
packages/fcl-db/src/dbase/Makefile.fpc

@@ -9,6 +9,9 @@ main=fcl-db
 units=dbf
 examples=testdbf
 
+[require]
+packages=fcl-base
+
 [compiler]
 options=-S2 -Sh
 

+ 136 - 2
packages/fcl-db/src/memds/Makefile

@@ -2,7 +2,7 @@
 # Don't edit, this file is generated by FPCMake Version 2.0.0 [2010/08/25]
 #
 default: all
-MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-solaris x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-darwin arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded avr-embedded armeb-linux armeb-embedded mipsel-linux
+MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian i386-nativent m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-solaris x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-darwin arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded avr-embedded armeb-linux armeb-embedded mipsel-linux
 BSDs = freebsd netbsd openbsd darwin
 UNIXs = linux $(BSDs) solaris qnx haiku
 LIMIT83fs = go32v2 os2 emx watcom
@@ -326,6 +326,9 @@ endif
 ifeq ($(FULL_TARGET),i386-symbian)
 override TARGET_UNITS+=memds
 endif
+ifeq ($(FULL_TARGET),i386-nativent)
+override TARGET_UNITS+=memds
+endif
 ifeq ($(FULL_TARGET),m68k-linux)
 override TARGET_UNITS+=memds
 endif
@@ -506,6 +509,9 @@ endif
 ifeq ($(FULL_TARGET),i386-symbian)
 override TARGET_RSTS+=memds
 endif
+ifeq ($(FULL_TARGET),i386-nativent)
+override TARGET_RSTS+=memds
+endif
 ifeq ($(FULL_TARGET),m68k-linux)
 override TARGET_RSTS+=memds
 endif
@@ -686,6 +692,9 @@ endif
 ifeq ($(FULL_TARGET),i386-symbian)
 override TARGET_EXAMPLES+=testpop testopen testld testcp
 endif
+ifeq ($(FULL_TARGET),i386-nativent)
+override TARGET_EXAMPLES+=testpop testopen testld testcp
+endif
 ifeq ($(FULL_TARGET),m68k-linux)
 override TARGET_EXAMPLES+=testpop testopen testld testcp
 endif
@@ -1149,6 +1158,10 @@ ifeq ($(OS_TARGET),symbian)
 SHAREDLIBEXT=.dll
 SHORTSUFFIX=symbian
 endif
+ifeq ($(OS_TARGET),NativeNT)
+SHAREDLIBEXT=.dll
+SHORTSUFFIX=nativent
+endif
 else
 ifeq ($(OS_TARGET),go32v1)
 PPUEXT=.pp1
@@ -1573,186 +1586,255 @@ else
 TAROPT=vz
 TAREXT=.tar.gz
 endif
-override REQUIRE_PACKAGES=rtl 
+override REQUIRE_PACKAGES=rtl fcl-base
 ifeq ($(FULL_TARGET),i386-linux)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),i386-go32v2)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),i386-win32)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),i386-os2)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),i386-freebsd)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),i386-beos)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),i386-haiku)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),i386-netbsd)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),i386-solaris)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),i386-qnx)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),i386-netware)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),i386-openbsd)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),i386-wdosx)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),i386-darwin)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_UNIVINT=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),i386-emx)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),i386-watcom)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),i386-netwlibc)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),i386-wince)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),i386-embedded)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),i386-symbian)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
+endif
+ifeq ($(FULL_TARGET),i386-nativent)
+REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),m68k-linux)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),m68k-freebsd)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),m68k-netbsd)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),m68k-amiga)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),m68k-atari)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),m68k-openbsd)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),m68k-palmos)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),m68k-embedded)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),powerpc-linux)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),powerpc-netbsd)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),powerpc-amiga)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),powerpc-macos)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),powerpc-darwin)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_UNIVINT=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),powerpc-morphos)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),powerpc-embedded)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),sparc-linux)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),sparc-netbsd)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),sparc-solaris)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),sparc-embedded)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),x86_64-linux)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),x86_64-freebsd)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),x86_64-solaris)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),x86_64-darwin)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_UNIVINT=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),x86_64-win64)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),x86_64-embedded)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),arm-linux)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),arm-palmos)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),arm-darwin)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_UNIVINT=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),arm-wince)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),arm-gba)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),arm-nds)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),arm-embedded)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),arm-symbian)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),powerpc64-linux)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),powerpc64-darwin)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_UNIVINT=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),powerpc64-embedded)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),avr-embedded)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),armeb-linux)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),armeb-embedded)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),mipsel-linux)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifdef REQUIRE_PACKAGES_RTL
 PACKAGEDIR_RTL:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /rtl/Makefile.fpc,$(PACKAGESDIR))))))
@@ -1780,6 +1862,58 @@ ifdef UNITDIR_RTL
 override COMPILER_UNITDIR+=$(UNITDIR_RTL)
 endif
 endif
+ifdef REQUIRE_PACKAGES_FCL-BASE
+PACKAGEDIR_FCL-BASE:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /fcl-base/Makefile.fpc,$(PACKAGESDIR))))))
+ifneq ($(PACKAGEDIR_FCL-BASE),)
+ifneq ($(wildcard $(PACKAGEDIR_FCL-BASE)/units/$(TARGETSUFFIX)),)
+UNITDIR_FCL-BASE=$(PACKAGEDIR_FCL-BASE)/units/$(TARGETSUFFIX)
+else
+UNITDIR_FCL-BASE=$(PACKAGEDIR_FCL-BASE)
+endif
+ifdef CHECKDEPEND
+$(PACKAGEDIR_FCL-BASE)/$(FPCMADE):
+	$(MAKE) -C $(PACKAGEDIR_FCL-BASE) $(FPCMADE)
+override ALLDEPENDENCIES+=$(PACKAGEDIR_FCL-BASE)/$(FPCMADE)
+endif
+else
+PACKAGEDIR_FCL-BASE=
+UNITDIR_FCL-BASE:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /fcl-base/Package.fpc,$(UNITSDIR)))))
+ifneq ($(UNITDIR_FCL-BASE),)
+UNITDIR_FCL-BASE:=$(firstword $(UNITDIR_FCL-BASE))
+else
+UNITDIR_FCL-BASE=
+endif
+endif
+ifdef UNITDIR_FCL-BASE
+override COMPILER_UNITDIR+=$(UNITDIR_FCL-BASE)
+endif
+endif
+ifdef REQUIRE_PACKAGES_UNIVINT
+PACKAGEDIR_UNIVINT:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /univint/Makefile.fpc,$(PACKAGESDIR))))))
+ifneq ($(PACKAGEDIR_UNIVINT),)
+ifneq ($(wildcard $(PACKAGEDIR_UNIVINT)/units/$(TARGETSUFFIX)),)
+UNITDIR_UNIVINT=$(PACKAGEDIR_UNIVINT)/units/$(TARGETSUFFIX)
+else
+UNITDIR_UNIVINT=$(PACKAGEDIR_UNIVINT)
+endif
+ifdef CHECKDEPEND
+$(PACKAGEDIR_UNIVINT)/$(FPCMADE):
+	$(MAKE) -C $(PACKAGEDIR_UNIVINT) $(FPCMADE)
+override ALLDEPENDENCIES+=$(PACKAGEDIR_UNIVINT)/$(FPCMADE)
+endif
+else
+PACKAGEDIR_UNIVINT=
+UNITDIR_UNIVINT:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /univint/Package.fpc,$(UNITSDIR)))))
+ifneq ($(UNITDIR_UNIVINT),)
+UNITDIR_UNIVINT:=$(firstword $(UNITDIR_UNIVINT))
+else
+UNITDIR_UNIVINT=
+endif
+endif
+ifdef UNITDIR_UNIVINT
+override COMPILER_UNITDIR+=$(UNITDIR_UNIVINT)
+endif
+endif
 ifndef NOCPUDEF
 override FPCOPTDEF=$(ARCH)
 endif

+ 3 - 0
packages/fcl-db/src/memds/Makefile.fpc

@@ -10,6 +10,9 @@ units=memds
 examples=testpop testopen testld testcp
 rsts=memds
 
+[require]
+packages=fcl-base
+
 [install]
 fpcpackage=y
 

+ 134 - 2
packages/fcl-db/src/paradox/Makefile

@@ -2,7 +2,7 @@
 # Don't edit, this file is generated by FPCMake Version 2.0.0 [2010/08/25]
 #
 default: all
-MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-solaris x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-darwin arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded avr-embedded armeb-linux armeb-embedded mipsel-linux
+MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian i386-nativent m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-solaris x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-darwin arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded avr-embedded armeb-linux armeb-embedded mipsel-linux
 BSDs = freebsd netbsd openbsd darwin
 UNIXs = linux $(BSDs) solaris qnx haiku
 LIMIT83fs = go32v2 os2 emx watcom
@@ -326,6 +326,9 @@ endif
 ifeq ($(FULL_TARGET),i386-symbian)
 override TARGET_UNITS+=paradox
 endif
+ifeq ($(FULL_TARGET),i386-nativent)
+override TARGET_UNITS+=paradox
+endif
 ifeq ($(FULL_TARGET),m68k-linux)
 override TARGET_UNITS+=paradox
 endif
@@ -506,6 +509,9 @@ endif
 ifeq ($(FULL_TARGET),i386-symbian)
 override TARGET_RSTS+=paradox
 endif
+ifeq ($(FULL_TARGET),i386-nativent)
+override TARGET_RSTS+=paradox
+endif
 ifeq ($(FULL_TARGET),m68k-linux)
 override TARGET_RSTS+=paradox
 endif
@@ -969,6 +975,10 @@ ifeq ($(OS_TARGET),symbian)
 SHAREDLIBEXT=.dll
 SHORTSUFFIX=symbian
 endif
+ifeq ($(OS_TARGET),NativeNT)
+SHAREDLIBEXT=.dll
+SHORTSUFFIX=nativent
+endif
 else
 ifeq ($(OS_TARGET),go32v1)
 PPUEXT=.pp1
@@ -1393,246 +1403,316 @@ else
 TAROPT=vz
 TAREXT=.tar.gz
 endif
-override REQUIRE_PACKAGES=rtl pxlib
+override REQUIRE_PACKAGES=rtl pxlib fcl-base
 ifeq ($(FULL_TARGET),i386-linux)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_PXLIB=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),i386-go32v2)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_PXLIB=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),i386-win32)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_PXLIB=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),i386-os2)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_PXLIB=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),i386-freebsd)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_PXLIB=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),i386-beos)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_PXLIB=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),i386-haiku)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_PXLIB=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),i386-netbsd)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_PXLIB=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),i386-solaris)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_PXLIB=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),i386-qnx)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_PXLIB=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),i386-netware)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_PXLIB=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),i386-openbsd)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_PXLIB=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),i386-wdosx)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_PXLIB=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),i386-darwin)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_PXLIB=1
+REQUIRE_PACKAGES_UNIVINT=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),i386-emx)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_PXLIB=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),i386-watcom)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_PXLIB=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),i386-netwlibc)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_PXLIB=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),i386-wince)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_PXLIB=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),i386-embedded)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_PXLIB=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),i386-symbian)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_PXLIB=1
+REQUIRE_PACKAGES_FCL-BASE=1
+endif
+ifeq ($(FULL_TARGET),i386-nativent)
+REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_PXLIB=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),m68k-linux)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_PXLIB=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),m68k-freebsd)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_PXLIB=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),m68k-netbsd)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_PXLIB=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),m68k-amiga)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_PXLIB=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),m68k-atari)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_PXLIB=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),m68k-openbsd)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_PXLIB=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),m68k-palmos)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_PXLIB=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),m68k-embedded)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_PXLIB=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),powerpc-linux)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_PXLIB=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),powerpc-netbsd)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_PXLIB=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),powerpc-amiga)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_PXLIB=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),powerpc-macos)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_PXLIB=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),powerpc-darwin)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_PXLIB=1
+REQUIRE_PACKAGES_UNIVINT=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),powerpc-morphos)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_PXLIB=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),powerpc-embedded)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_PXLIB=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),sparc-linux)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_PXLIB=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),sparc-netbsd)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_PXLIB=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),sparc-solaris)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_PXLIB=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),sparc-embedded)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_PXLIB=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),x86_64-linux)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_PXLIB=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),x86_64-freebsd)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_PXLIB=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),x86_64-solaris)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_PXLIB=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),x86_64-darwin)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_PXLIB=1
+REQUIRE_PACKAGES_UNIVINT=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),x86_64-win64)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_PXLIB=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),x86_64-embedded)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_PXLIB=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),arm-linux)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_PXLIB=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),arm-palmos)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_PXLIB=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),arm-darwin)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_PXLIB=1
+REQUIRE_PACKAGES_UNIVINT=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),arm-wince)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_PXLIB=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),arm-gba)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_PXLIB=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),arm-nds)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_PXLIB=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),arm-embedded)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_PXLIB=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),arm-symbian)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_PXLIB=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),powerpc64-linux)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_PXLIB=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),powerpc64-darwin)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_PXLIB=1
+REQUIRE_PACKAGES_UNIVINT=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),powerpc64-embedded)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_PXLIB=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),avr-embedded)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_PXLIB=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),armeb-linux)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_PXLIB=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),armeb-embedded)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_PXLIB=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),mipsel-linux)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_PXLIB=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifdef REQUIRE_PACKAGES_RTL
 PACKAGEDIR_RTL:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /rtl/Makefile.fpc,$(PACKAGESDIR))))))
@@ -1686,6 +1766,58 @@ ifdef UNITDIR_PXLIB
 override COMPILER_UNITDIR+=$(UNITDIR_PXLIB)
 endif
 endif
+ifdef REQUIRE_PACKAGES_FCL-BASE
+PACKAGEDIR_FCL-BASE:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /fcl-base/Makefile.fpc,$(PACKAGESDIR))))))
+ifneq ($(PACKAGEDIR_FCL-BASE),)
+ifneq ($(wildcard $(PACKAGEDIR_FCL-BASE)/units/$(TARGETSUFFIX)),)
+UNITDIR_FCL-BASE=$(PACKAGEDIR_FCL-BASE)/units/$(TARGETSUFFIX)
+else
+UNITDIR_FCL-BASE=$(PACKAGEDIR_FCL-BASE)
+endif
+ifdef CHECKDEPEND
+$(PACKAGEDIR_FCL-BASE)/$(FPCMADE):
+	$(MAKE) -C $(PACKAGEDIR_FCL-BASE) $(FPCMADE)
+override ALLDEPENDENCIES+=$(PACKAGEDIR_FCL-BASE)/$(FPCMADE)
+endif
+else
+PACKAGEDIR_FCL-BASE=
+UNITDIR_FCL-BASE:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /fcl-base/Package.fpc,$(UNITSDIR)))))
+ifneq ($(UNITDIR_FCL-BASE),)
+UNITDIR_FCL-BASE:=$(firstword $(UNITDIR_FCL-BASE))
+else
+UNITDIR_FCL-BASE=
+endif
+endif
+ifdef UNITDIR_FCL-BASE
+override COMPILER_UNITDIR+=$(UNITDIR_FCL-BASE)
+endif
+endif
+ifdef REQUIRE_PACKAGES_UNIVINT
+PACKAGEDIR_UNIVINT:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /univint/Makefile.fpc,$(PACKAGESDIR))))))
+ifneq ($(PACKAGEDIR_UNIVINT),)
+ifneq ($(wildcard $(PACKAGEDIR_UNIVINT)/units/$(TARGETSUFFIX)),)
+UNITDIR_UNIVINT=$(PACKAGEDIR_UNIVINT)/units/$(TARGETSUFFIX)
+else
+UNITDIR_UNIVINT=$(PACKAGEDIR_UNIVINT)
+endif
+ifdef CHECKDEPEND
+$(PACKAGEDIR_UNIVINT)/$(FPCMADE):
+	$(MAKE) -C $(PACKAGEDIR_UNIVINT) $(FPCMADE)
+override ALLDEPENDENCIES+=$(PACKAGEDIR_UNIVINT)/$(FPCMADE)
+endif
+else
+PACKAGEDIR_UNIVINT=
+UNITDIR_UNIVINT:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /univint/Package.fpc,$(UNITSDIR)))))
+ifneq ($(UNITDIR_UNIVINT),)
+UNITDIR_UNIVINT:=$(firstword $(UNITDIR_UNIVINT))
+else
+UNITDIR_UNIVINT=
+endif
+endif
+ifdef UNITDIR_UNIVINT
+override COMPILER_UNITDIR+=$(UNITDIR_UNIVINT)
+endif
+endif
 ifndef NOCPUDEF
 override FPCOPTDEF=$(ARCH)
 endif

+ 1 - 1
packages/fcl-db/src/paradox/Makefile.fpc

@@ -10,7 +10,7 @@ units=paradox
 rsts=paradox
 
 [require]
-packages=pxlib
+packages=pxlib fcl-base
 
 [install]
 fpcpackage=y

+ 133 - 2
packages/fcl-db/src/sdf/Makefile

@@ -2,7 +2,7 @@
 # Don't edit, this file is generated by FPCMake Version 2.0.0 [2010/08/25]
 #
 default: all
-MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-solaris x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-darwin arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded avr-embedded armeb-linux armeb-embedded mipsel-linux
+MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian i386-nativent m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-solaris x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-darwin arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded avr-embedded armeb-linux armeb-embedded mipsel-linux
 BSDs = freebsd netbsd openbsd darwin
 UNIXs = linux $(BSDs) solaris qnx haiku
 LIMIT83fs = go32v2 os2 emx watcom
@@ -326,6 +326,9 @@ endif
 ifeq ($(FULL_TARGET),i386-symbian)
 override TARGET_UNITS+=sdfdata
 endif
+ifeq ($(FULL_TARGET),i386-nativent)
+override TARGET_UNITS+=sdfdata
+endif
 ifeq ($(FULL_TARGET),m68k-linux)
 override TARGET_UNITS+=sdfdata
 endif
@@ -506,6 +509,9 @@ endif
 ifeq ($(FULL_TARGET),i386-symbian)
 override TARGET_EXAMPLES+=testsdf testfix
 endif
+ifeq ($(FULL_TARGET),i386-nativent)
+override TARGET_EXAMPLES+=testsdf testfix
+endif
 ifeq ($(FULL_TARGET),m68k-linux)
 override TARGET_EXAMPLES+=testsdf testfix
 endif
@@ -969,6 +975,10 @@ ifeq ($(OS_TARGET),symbian)
 SHAREDLIBEXT=.dll
 SHORTSUFFIX=symbian
 endif
+ifeq ($(OS_TARGET),NativeNT)
+SHAREDLIBEXT=.dll
+SHORTSUFFIX=nativent
+endif
 else
 ifeq ($(OS_TARGET),go32v1)
 PPUEXT=.pp1
@@ -1393,186 +1403,255 @@ else
 TAROPT=vz
 TAREXT=.tar.gz
 endif
-override REQUIRE_PACKAGES=rtl 
+override REQUIRE_PACKAGES=rtl fcl-base
 ifeq ($(FULL_TARGET),i386-linux)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),i386-go32v2)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),i386-win32)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),i386-os2)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),i386-freebsd)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),i386-beos)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),i386-haiku)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),i386-netbsd)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),i386-solaris)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),i386-qnx)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),i386-netware)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),i386-openbsd)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),i386-wdosx)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),i386-darwin)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_UNIVINT=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),i386-emx)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),i386-watcom)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),i386-netwlibc)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),i386-wince)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),i386-embedded)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),i386-symbian)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
+endif
+ifeq ($(FULL_TARGET),i386-nativent)
+REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),m68k-linux)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),m68k-freebsd)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),m68k-netbsd)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),m68k-amiga)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),m68k-atari)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),m68k-openbsd)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),m68k-palmos)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),m68k-embedded)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),powerpc-linux)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),powerpc-netbsd)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),powerpc-amiga)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),powerpc-macos)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),powerpc-darwin)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_UNIVINT=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),powerpc-morphos)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),powerpc-embedded)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),sparc-linux)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),sparc-netbsd)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),sparc-solaris)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),sparc-embedded)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),x86_64-linux)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),x86_64-freebsd)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),x86_64-solaris)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),x86_64-darwin)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_UNIVINT=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),x86_64-win64)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),x86_64-embedded)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),arm-linux)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),arm-palmos)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),arm-darwin)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_UNIVINT=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),arm-wince)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),arm-gba)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),arm-nds)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),arm-embedded)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),arm-symbian)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),powerpc64-linux)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),powerpc64-darwin)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_UNIVINT=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),powerpc64-embedded)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),avr-embedded)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),armeb-linux)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),armeb-embedded)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),mipsel-linux)
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifdef REQUIRE_PACKAGES_RTL
 PACKAGEDIR_RTL:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /rtl/Makefile.fpc,$(PACKAGESDIR))))))
@@ -1600,6 +1679,58 @@ ifdef UNITDIR_RTL
 override COMPILER_UNITDIR+=$(UNITDIR_RTL)
 endif
 endif
+ifdef REQUIRE_PACKAGES_FCL-BASE
+PACKAGEDIR_FCL-BASE:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /fcl-base/Makefile.fpc,$(PACKAGESDIR))))))
+ifneq ($(PACKAGEDIR_FCL-BASE),)
+ifneq ($(wildcard $(PACKAGEDIR_FCL-BASE)/units/$(TARGETSUFFIX)),)
+UNITDIR_FCL-BASE=$(PACKAGEDIR_FCL-BASE)/units/$(TARGETSUFFIX)
+else
+UNITDIR_FCL-BASE=$(PACKAGEDIR_FCL-BASE)
+endif
+ifdef CHECKDEPEND
+$(PACKAGEDIR_FCL-BASE)/$(FPCMADE):
+	$(MAKE) -C $(PACKAGEDIR_FCL-BASE) $(FPCMADE)
+override ALLDEPENDENCIES+=$(PACKAGEDIR_FCL-BASE)/$(FPCMADE)
+endif
+else
+PACKAGEDIR_FCL-BASE=
+UNITDIR_FCL-BASE:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /fcl-base/Package.fpc,$(UNITSDIR)))))
+ifneq ($(UNITDIR_FCL-BASE),)
+UNITDIR_FCL-BASE:=$(firstword $(UNITDIR_FCL-BASE))
+else
+UNITDIR_FCL-BASE=
+endif
+endif
+ifdef UNITDIR_FCL-BASE
+override COMPILER_UNITDIR+=$(UNITDIR_FCL-BASE)
+endif
+endif
+ifdef REQUIRE_PACKAGES_UNIVINT
+PACKAGEDIR_UNIVINT:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /univint/Makefile.fpc,$(PACKAGESDIR))))))
+ifneq ($(PACKAGEDIR_UNIVINT),)
+ifneq ($(wildcard $(PACKAGEDIR_UNIVINT)/units/$(TARGETSUFFIX)),)
+UNITDIR_UNIVINT=$(PACKAGEDIR_UNIVINT)/units/$(TARGETSUFFIX)
+else
+UNITDIR_UNIVINT=$(PACKAGEDIR_UNIVINT)
+endif
+ifdef CHECKDEPEND
+$(PACKAGEDIR_UNIVINT)/$(FPCMADE):
+	$(MAKE) -C $(PACKAGEDIR_UNIVINT) $(FPCMADE)
+override ALLDEPENDENCIES+=$(PACKAGEDIR_UNIVINT)/$(FPCMADE)
+endif
+else
+PACKAGEDIR_UNIVINT=
+UNITDIR_UNIVINT:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /univint/Package.fpc,$(UNITSDIR)))))
+ifneq ($(UNITDIR_UNIVINT),)
+UNITDIR_UNIVINT:=$(firstword $(UNITDIR_UNIVINT))
+else
+UNITDIR_UNIVINT=
+endif
+endif
+ifdef UNITDIR_UNIVINT
+override COMPILER_UNITDIR+=$(UNITDIR_UNIVINT)
+endif
+endif
 ifndef NOCPUDEF
 override FPCOPTDEF=$(ARCH)
 endif

+ 3 - 0
packages/fcl-db/src/sdf/Makefile.fpc

@@ -9,6 +9,9 @@ main=fcl-db
 units=sdfdata
 examples=testsdf testfix
 
+[require]
+packages=fcl-base
+
 [install]
 fpcpackage=y
 

+ 52 - 1
packages/fcl-db/src/sqldb/mysql/mysqlconn.inc

@@ -163,7 +163,21 @@ implementation
 
 uses dbconst,ctypes,strutils;
 
-{ TConnectionName }
+const
+  Mysql_Option_Names : array[mysql_option] of string = ('MYSQL_OPT_CONNECT_TIMEOUT','MYSQL_OPT_COMPRESS',
+     'MYSQL_OPT_NAMED_PIPE','MYSQL_INIT_COMMAND',
+     'MYSQL_READ_DEFAULT_FILE','MYSQL_READ_DEFAULT_GROUP',
+     'MYSQL_SET_CHARSET_DIR','MYSQL_SET_CHARSET_NAME',
+     'MYSQL_OPT_LOCAL_INFILE','MYSQL_OPT_PROTOCOL',
+     'MYSQL_SHARED_MEMORY_BASE_NAME','MYSQL_OPT_READ_TIMEOUT',
+     'MYSQL_OPT_WRITE_TIMEOUT','MYSQL_OPT_USE_RESULT',
+     'MYSQL_OPT_USE_REMOTE_CONNECTION','MYSQL_OPT_USE_EMBEDDED_CONNECTION',
+     'MYSQL_OPT_GUESS_CONNECTION','MYSQL_SET_CLIENT_IP',
+     'MYSQL_SECURE_AUTH'
+{$IFDEF MYSQL50}
+     ,'MYSQL_REPORT_DATA_TRUNCATION', 'MYSQL_OPT_RECONNECT'
+{$ENDIF}
+     );
 
 Resourcestring
   SErrServerConnectFailed = 'Server connect failed.';
@@ -178,6 +192,7 @@ Resourcestring
   SErrNotversion50 = 'TMySQL50Connection can not work with the installed MySQL client version (%s).';
   SErrNotversion41 = 'TMySQL41Connection can not work with the installed MySQL client version (%s).';
   SErrNotversion40 = 'TMySQL40Connection can not work with the installed MySQL client version (%s).';
+  SErrSettingParameter = 'Error setting parameter "%s"';
 
 Procedure MySQlError(R : PMySQL;Msg: String;Comp : TComponent);
 
@@ -194,6 +209,21 @@ begin
    DatabaseError(Msg,Comp);
 end;
 
+function MysqlOption(const OptionName: string; out AMysql_Option: mysql_option) : boolean;
+var AMysql_Option_i: mysql_option;
+begin
+  result := false;
+  for AMysql_Option_i:=low(AMysql_Option) to high(AMysql_Option) do
+    if sametext(Mysql_Option_Names[AMysql_Option_i],OptionName) then
+      begin
+      result := true;
+      AMysql_Option:=AMysql_Option_i;
+      break;
+      end;
+end;
+
+{ TConnectionName }
+
 function TConnectionName.StrToStatementType(s : string) : TStatementType;
 
 begin
@@ -225,10 +255,31 @@ procedure TConnectionName.ConnectMySQL(var HMySQL : PMySQL;H,U,P : pchar);
 
 Var
   APort : Cardinal;
+  i,e: integer;
+  AMysql_Option: mysql_option;
+  OptStr: string;
+  OptInt: cuint;
+  Opt: pointer;
 
 begin
   HMySQL := mysql_init(HMySQL);
   APort:=Abs(StrToIntDef(Params.Values['Port'],0));
+
+  for i := 0 to Params.Count-1 do
+    begin
+    if MysqlOption(params.Names[i],AMysql_Option) then
+      begin
+      OptStr:=params.ValueFromIndex[i];
+      val(OptStr,OptInt,e);
+      if e=0 then
+        Opt := @OptInt
+      else
+        Opt := pchar(OptStr);
+      if mysql_options(HMySQL,AMysql_Option,Opt) <> 0 then
+          MySQlError(HMySQL,Format(SErrSettingParameter,[params.Names[i]]),Self);
+      end;
+    end;
+
   HMySQL:=mysql_real_connect(HMySQL,PChar(H),PChar(U),Pchar(P),Nil,APort,Nil,0);
   If (HMySQL=Nil) then
     MySQlError(Nil,SErrServerConnectFailed,Self);

+ 25 - 14
packages/fcl-db/src/sqldb/odbc/odbcconn.pas

@@ -351,7 +351,7 @@ begin
           SqlType:=SQL_BIGINT;
           ColumnSize:=19;
         end;
-      ftString, ftBlob, ftMemo:
+      ftString, ftFixedChar, ftBlob, ftMemo:
         begin
           StrVal:=AParams[ParamIndex].AsString;
           StrLenOrInd:=Length(StrVal);
@@ -364,16 +364,23 @@ begin
           Size:=Length(StrVal);
           ColumnSize:=Size;
           BufferLength:=Size;
-          if AParams[ParamIndex].DataType = ftString then
-            begin
-            CType:=SQL_C_CHAR;
-            SqlType:=SQL_LONGVARCHAR;
-            end
-          else // ftBlob, ftMemo
-            begin
-            CType:=SQL_C_BINARY;
-            SqlType:=SQL_BINARY;
-            end;
+          case AParams[ParamIndex].DataType of
+            ftBlob:
+              begin
+              CType:=SQL_C_BINARY;
+              SqlType:=SQL_LONGVARBINARY;
+              end;
+            ftMemo:
+              begin
+              CType:=SQL_C_CHAR;
+              SqlType:=SQL_LONGVARCHAR;
+              end
+            else // ftString, ftFixedChar
+              begin
+              CType:=SQL_C_CHAR;
+              SqlType:=SQL_VARCHAR;
+              end;
+          end;
         end;
       ftFloat:
         begin
@@ -639,6 +646,9 @@ begin
 end;
 
 procedure TODBCConnection.Execute(cursor: TSQLCursor; ATransaction: TSQLTransaction; AParams: TParams);
+const
+  TABLE_TYPE_USER='TABLE,VIEW,GLOBAL TEMPORARY,LOCAL TEMPORARY'; //no spaces before/after comma
+  TABLE_TYPE_SYSTEM='SYSTEM TABLE';
 var
   ODBCCursor:TODBCCursor;
   Res:SQLRETURN;
@@ -651,7 +661,8 @@ begin
   // execute the statement
   case ODBCCursor.FSchemaType of
     stNoSchema  : Res:=SQLExecute(ODBCCursor.FSTMTHandle); //SQL_NO_DATA returns searched update or delete statement that does not affect any rows
-    stTables    : Res:=SQLTables (ODBCCursor.FSTMTHandle, nil, 0, nil, 0, nil, 0, nil, 0 );
+    stTables    : Res:=SQLTables (ODBCCursor.FSTMTHandle, nil, 0, nil, 0, nil, 0, TABLE_TYPE_USER, length(TABLE_TYPE_USER) );
+    stSysTables : Res:=SQLTables (ODBCCursor.FSTMTHandle, nil, 0, nil, 0, nil, 0, TABLE_TYPE_SYSTEM, length(TABLE_TYPE_SYSTEM) );
     stColumns   : Res:=SQLColumns(ODBCCursor.FSTMTHandle, nil, 0, nil, 0, @ODBCCursor.FQuery[1], length(ODBCCursor.FQuery), nil, 0 );
     stProcedures: Res:=SQLProcedures(ODBCCursor.FSTMTHandle, nil, 0, nil, 0, nil, 0 );
     else          Res:=SQL_NO_DATA;
@@ -1119,7 +1130,7 @@ begin
     end;
 
     // add FieldDef
-    TFieldDef.Create(FieldDefs, ColName, FieldType, FieldSize, False, i);
+    TFieldDef.Create(FieldDefs, FieldDefs.MakeNameUnique(ColName), FieldType, FieldSize, False, i);
   end;
 end;
 
@@ -1295,7 +1306,7 @@ begin
     Result := SchemaObjectName
   else
     Result := ' ';
-  if not (SchemaType in [stNoSchema, stTables, stColumns, stProcedures]) then
+  if not (SchemaType in [stNoSchema, stTables, stSysTables, stColumns, stProcedures]) then
     DatabaseError(SMetadataUnavailable);
 end;
 

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

@@ -274,6 +274,7 @@ type
     property Prepared : boolean read IsPrepared;
     procedure Notification(AComponent: TComponent; Operation: TOperation); override;
     function RowsAffected: TRowsCount; virtual;
+    function ParamByName(Const AParamName : String) : TParam;
   protected
 
     // redeclared data set properties
@@ -823,6 +824,12 @@ begin
     end;
 end;
 
+function TCustomSQLQuery.ParamByName(Const AParamName : String) : TParam;
+
+begin
+  Result:=Params.ParamByName(AParamName);
+end;
+
 procedure TCustomSQLQuery.OnChangeModifySQL(Sender : TObject);
 
 begin

+ 48 - 46
packages/fcl-db/src/sqldb/sqlite/sqlite3conn.pp

@@ -82,7 +82,6 @@ type
     // New methods
     procedure execsql(const asql: string);
     procedure UpdateIndexDefs(IndexDefs : TIndexDefs;TableName : string); override; // Differs from SQLDB.
-    function getprimarykeyfield(const atablename: string; const acursor: tsqlcursor): string;
     function RowsAffected(cursor: TSQLCursor): TRowsCount; override;
     function GetSchemaInfoSQL(SchemaType : TSchemaType; SchemaObjectName, SchemaPattern : string) : string; override;
     function StrToStatementType(s : string) : TStatementType; override;
@@ -664,29 +663,6 @@ begin
   checkerror(sqlite3_exec(fhandle,pchar(asql),@execscallback,@result,nil));
 end;
 
-function TSQLite3Connection.getprimarykeyfield(const atablename: string;
-                                const acursor: tsqlcursor): string;
-var
-  int1,int2: integer;
-  ar1: TArrayStringArray;
-  str1: string;
-  
-begin
-  result:= '';
-  if atablename <> '' then 
-    begin
-    ar1:= stringsquery('PRAGMA table_info('+atablename+');');
-    for int1:= 0 to high(ar1) do 
-      begin
-      if (high(ar1[int1]) >= 5) and (ar1[int1][5] <> '0') then 
-        begin
-        result:= ar1[int1][1];
-        break;
-        end;
-      end;
-    end;
-end;
-
 function TSQLite3Connection.RowsAffected(cursor: TSQLCursor): TRowsCount;
 begin
   if assigned(cursor) then
@@ -723,32 +699,58 @@ end;
 
 procedure TSQLite3Connection.UpdateIndexDefs(IndexDefs: TIndexDefs; TableName: string);
 var
-  str1: string;
-  
+  artableinfo, arindexlist, arindexinfo: TArrayStringArray;
+  il,ii: integer;
+  IndexName: string;
+  IndexOptions: TIndexOptions;
+  PKFields, IXFields: TStrings;
+  l: boolean;
+
+  function CheckPKFields:boolean;
+  var i: integer;
+  begin
+    Result:=false;
+    if IXFields.Count<>PKFields.Count then Exit;
+    for i:=0 to IXFields.Count-1 do
+      if PKFields.IndexOf(IXFields[i])<0 then Exit;
+    Result:=true;
+    PKFields.Clear;
+  end;
+
 begin
-  str1:= getprimarykeyfield(tablename,nil);
-  if str1 <> '' then 
+  PKFields:=TStringList.Create;
+  IXFields:=TStringList.Create;
+  IXFields.Delimiter:=';';
+
+  //primary key fields
+  artableinfo := stringsquery('PRAGMA table_info('+TableName+');');
+  for ii:=low(artableinfo) to high(artableinfo) do
+    if (high(artableinfo[ii]) >= 5) and (artableinfo[ii][5] = '1') then
+      PKFields.Add(artableinfo[ii][1]);
+
+  //list of all table indexes
+  arindexlist:=stringsquery('PRAGMA index_list('+TableName+');');
+  for il:=low(arindexlist) to high(arindexlist) do
     begin
-    indexdefs.add('$PRIMARY_KEY$',str1,[ixPrimary,ixUnique]);
+    IndexName:=arindexlist[il][1];
+    if arindexlist[il][2]='1' then
+      IndexOptions:=[ixUnique]
+    else
+      IndexOptions:=[];
+    //list of columns in given index
+    arindexinfo:=stringsquery('PRAGMA index_info('+IndexName+');');
+    IXFields.Clear;
+    for ii:=low(arindexinfo) to high(arindexinfo) do
+      IXFields.Add(arindexinfo[ii][2]);
+
+    if CheckPKFields then IndexOptions:=IndexOptions+[ixPrimary];
+
+    IndexDefs.Add(IndexName, IXFields.DelimitedText, IndexOptions);
     end;
+
+  PKFields.Free;
+  IXFields.Free;
 end;
-{
-procedure TSQLite3Connection.UpdateIndexDefs(var IndexDefs: TIndexDefs;
-                              const TableName: string);
-var
- int1,int2: integer;
- ar1: TArrayStringArray;
- str1: string;
-begin
- ar1:= stringsquery('PRAGMA table_info('+tablename+');');
- for int1:= 0 to high(ar1) do begin
-  if (high(ar1[int1]) >= 5) and (ar1[int1][5] <> '0') then begin
-   indexdefs.add('$PRIMARY_KEY$',ar1[int1][1],[ixPrimary,ixUnique]);
-   break;
-  end;
- end;
-end;
-}
 
 function TSQLite3Connection.getinsertid: int64;
 begin

+ 131 - 2
packages/fcl-db/src/sqlite/Makefile

@@ -2,7 +2,7 @@
 # Don't edit, this file is generated by FPCMake Version 2.0.0 [2010/08/25]
 #
 default: all
-MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-solaris x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-darwin arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded avr-embedded armeb-linux armeb-embedded mipsel-linux
+MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian i386-nativent m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-solaris x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-darwin arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded avr-embedded armeb-linux armeb-embedded mipsel-linux
 BSDs = freebsd netbsd openbsd darwin
 UNIXs = linux $(BSDs) solaris qnx haiku
 LIMIT83fs = go32v2 os2 emx watcom
@@ -326,6 +326,9 @@ endif
 ifeq ($(FULL_TARGET),i386-symbian)
 override TARGET_UNITS+=customsqliteds sqliteds sqlite3ds
 endif
+ifeq ($(FULL_TARGET),i386-nativent)
+override TARGET_UNITS+=customsqliteds sqliteds sqlite3ds
+endif
 ifeq ($(FULL_TARGET),m68k-linux)
 override TARGET_UNITS+=customsqliteds sqliteds sqlite3ds
 endif
@@ -789,6 +792,10 @@ ifeq ($(OS_TARGET),symbian)
 SHAREDLIBEXT=.dll
 SHORTSUFFIX=symbian
 endif
+ifeq ($(OS_TARGET),NativeNT)
+SHAREDLIBEXT=.dll
+SHORTSUFFIX=nativent
+endif
 else
 ifeq ($(OS_TARGET),go32v1)
 PPUEXT=.pp1
@@ -1213,246 +1220,316 @@ else
 TAROPT=vz
 TAREXT=.tar.gz
 endif
-override REQUIRE_PACKAGES=rtl sqlite
+override REQUIRE_PACKAGES=rtl sqlite fcl-base
 ifeq ($(FULL_TARGET),i386-linux)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_SQLITE=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),i386-go32v2)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_SQLITE=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),i386-win32)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_SQLITE=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),i386-os2)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_SQLITE=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),i386-freebsd)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_SQLITE=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),i386-beos)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_SQLITE=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),i386-haiku)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_SQLITE=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),i386-netbsd)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_SQLITE=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),i386-solaris)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_SQLITE=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),i386-qnx)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_SQLITE=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),i386-netware)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_SQLITE=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),i386-openbsd)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_SQLITE=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),i386-wdosx)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_SQLITE=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),i386-darwin)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_SQLITE=1
+REQUIRE_PACKAGES_UNIVINT=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),i386-emx)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_SQLITE=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),i386-watcom)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_SQLITE=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),i386-netwlibc)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_SQLITE=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),i386-wince)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_SQLITE=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),i386-embedded)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_SQLITE=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),i386-symbian)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_SQLITE=1
+REQUIRE_PACKAGES_FCL-BASE=1
+endif
+ifeq ($(FULL_TARGET),i386-nativent)
+REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_SQLITE=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),m68k-linux)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_SQLITE=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),m68k-freebsd)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_SQLITE=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),m68k-netbsd)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_SQLITE=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),m68k-amiga)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_SQLITE=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),m68k-atari)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_SQLITE=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),m68k-openbsd)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_SQLITE=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),m68k-palmos)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_SQLITE=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),m68k-embedded)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_SQLITE=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),powerpc-linux)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_SQLITE=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),powerpc-netbsd)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_SQLITE=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),powerpc-amiga)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_SQLITE=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),powerpc-macos)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_SQLITE=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),powerpc-darwin)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_SQLITE=1
+REQUIRE_PACKAGES_UNIVINT=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),powerpc-morphos)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_SQLITE=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),powerpc-embedded)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_SQLITE=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),sparc-linux)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_SQLITE=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),sparc-netbsd)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_SQLITE=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),sparc-solaris)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_SQLITE=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),sparc-embedded)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_SQLITE=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),x86_64-linux)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_SQLITE=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),x86_64-freebsd)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_SQLITE=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),x86_64-solaris)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_SQLITE=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),x86_64-darwin)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_SQLITE=1
+REQUIRE_PACKAGES_UNIVINT=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),x86_64-win64)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_SQLITE=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),x86_64-embedded)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_SQLITE=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),arm-linux)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_SQLITE=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),arm-palmos)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_SQLITE=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),arm-darwin)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_SQLITE=1
+REQUIRE_PACKAGES_UNIVINT=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),arm-wince)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_SQLITE=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),arm-gba)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_SQLITE=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),arm-nds)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_SQLITE=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),arm-embedded)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_SQLITE=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),arm-symbian)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_SQLITE=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),powerpc64-linux)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_SQLITE=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),powerpc64-darwin)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_SQLITE=1
+REQUIRE_PACKAGES_UNIVINT=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),powerpc64-embedded)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_SQLITE=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),avr-embedded)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_SQLITE=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),armeb-linux)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_SQLITE=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),armeb-embedded)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_SQLITE=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifeq ($(FULL_TARGET),mipsel-linux)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_SQLITE=1
+REQUIRE_PACKAGES_FCL-BASE=1
 endif
 ifdef REQUIRE_PACKAGES_RTL
 PACKAGEDIR_RTL:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /rtl/Makefile.fpc,$(PACKAGESDIR))))))
@@ -1506,6 +1583,58 @@ ifdef UNITDIR_SQLITE
 override COMPILER_UNITDIR+=$(UNITDIR_SQLITE)
 endif
 endif
+ifdef REQUIRE_PACKAGES_FCL-BASE
+PACKAGEDIR_FCL-BASE:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /fcl-base/Makefile.fpc,$(PACKAGESDIR))))))
+ifneq ($(PACKAGEDIR_FCL-BASE),)
+ifneq ($(wildcard $(PACKAGEDIR_FCL-BASE)/units/$(TARGETSUFFIX)),)
+UNITDIR_FCL-BASE=$(PACKAGEDIR_FCL-BASE)/units/$(TARGETSUFFIX)
+else
+UNITDIR_FCL-BASE=$(PACKAGEDIR_FCL-BASE)
+endif
+ifdef CHECKDEPEND
+$(PACKAGEDIR_FCL-BASE)/$(FPCMADE):
+	$(MAKE) -C $(PACKAGEDIR_FCL-BASE) $(FPCMADE)
+override ALLDEPENDENCIES+=$(PACKAGEDIR_FCL-BASE)/$(FPCMADE)
+endif
+else
+PACKAGEDIR_FCL-BASE=
+UNITDIR_FCL-BASE:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /fcl-base/Package.fpc,$(UNITSDIR)))))
+ifneq ($(UNITDIR_FCL-BASE),)
+UNITDIR_FCL-BASE:=$(firstword $(UNITDIR_FCL-BASE))
+else
+UNITDIR_FCL-BASE=
+endif
+endif
+ifdef UNITDIR_FCL-BASE
+override COMPILER_UNITDIR+=$(UNITDIR_FCL-BASE)
+endif
+endif
+ifdef REQUIRE_PACKAGES_UNIVINT
+PACKAGEDIR_UNIVINT:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /univint/Makefile.fpc,$(PACKAGESDIR))))))
+ifneq ($(PACKAGEDIR_UNIVINT),)
+ifneq ($(wildcard $(PACKAGEDIR_UNIVINT)/units/$(TARGETSUFFIX)),)
+UNITDIR_UNIVINT=$(PACKAGEDIR_UNIVINT)/units/$(TARGETSUFFIX)
+else
+UNITDIR_UNIVINT=$(PACKAGEDIR_UNIVINT)
+endif
+ifdef CHECKDEPEND
+$(PACKAGEDIR_UNIVINT)/$(FPCMADE):
+	$(MAKE) -C $(PACKAGEDIR_UNIVINT) $(FPCMADE)
+override ALLDEPENDENCIES+=$(PACKAGEDIR_UNIVINT)/$(FPCMADE)
+endif
+else
+PACKAGEDIR_UNIVINT=
+UNITDIR_UNIVINT:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /univint/Package.fpc,$(UNITSDIR)))))
+ifneq ($(UNITDIR_UNIVINT),)
+UNITDIR_UNIVINT:=$(firstword $(UNITDIR_UNIVINT))
+else
+UNITDIR_UNIVINT=
+endif
+endif
+ifdef UNITDIR_UNIVINT
+override COMPILER_UNITDIR+=$(UNITDIR_UNIVINT)
+endif
+endif
 ifndef NOCPUDEF
 override FPCOPTDEF=$(ARCH)
 endif

+ 1 - 1
packages/fcl-db/src/sqlite/Makefile.fpc

@@ -9,7 +9,7 @@ main=fcl-db
 units=customsqliteds sqliteds sqlite3ds
 
 [require]
-packages=sqlite
+packages=sqlite fcl-base
 
 [install]
 fpcpackage=y

+ 5 - 1
packages/fcl-db/src/sqlite/sqlite3ds.pas

@@ -227,11 +227,15 @@ begin
         SQLITE_FLOAT:
           AType := ftFloat;
       else
-        AType := ftString;
+	    begin
+          AType := ftString;
+		  DataSize := DefaultStringSize;
+		end;  		
       end;
     end else
     begin
       AType := ftString;
+	  DataSize := DefaultStringSize;
     end;
     FieldDefs.Add(String(sqlite3_column_name(vm, i)), AType, DataSize);
     //Set the pchar2sql function

+ 2 - 2
packages/fcl-db/tests/dbftoolsunit.pas

@@ -112,12 +112,12 @@ procedure TDBFDBConnector.DropNDatasets;
 var n : integer;
 begin
   for n := 0 to MaxDataSet do
-    DeleteFile(ExtractFilePath(dbname)+PathDelim+'fpdev_'+inttostr(n)+'.db');
+    DeleteFile(ExtractFilePath(dbname)+'fpdev_'+inttostr(n)+'.db');
 end;
 
 procedure TDBFDBConnector.DropFieldDataset;
 begin
-  DeleteFile(ExtractFilePath(dbname)+PathDelim+'fpdev_field.db');
+  DeleteFile(ExtractFilePath(dbname)+'fpdev_field.db');
 end;
 
 function TDBFDBConnector.InternalGetNDataset(n: integer): TDataset;

+ 5 - 0
packages/fcl-db/tests/sqldbtoolsunit.pas

@@ -147,6 +147,11 @@ begin
     UserName := dbuser;
     Password := dbpassword;
     HostName := dbhostname;
+    if length(dbQuoteChars)>1 then
+      begin
+      FieldNameQuoteChars[0] := dbQuoteChars[1];
+      FieldNameQuoteChars[1] := dbQuoteChars[2];
+      end;
     open;
     end;
 end;

+ 140 - 85
packages/fcl-db/tests/testdbbasics.pas

@@ -22,17 +22,12 @@ type
 
     procedure FTestDelete1(TestCancelUpdate : boolean);
     procedure FTestDelete2(TestCancelUpdate : boolean);
-    procedure FTestXMLDatasetDefinition(ADataset : TDataset);
-    procedure TestAddIndexFieldType(AFieldType : TFieldType; ActiveDS : boolean);
   protected
     procedure SetUp; override;
     procedure TearDown; override;
   published
-    procedure TestFileNameProperty;
-    procedure TestClientDatasetAsMemDataset;
     procedure TestCancelUpdDelete1;
     procedure TestCancelUpdDelete2;
-    procedure TestSafeAsXML;
     procedure TestAppendInsertRecord;
     procedure TestBookmarks;
     procedure TestBookmarkValid;
@@ -50,31 +45,6 @@ type
     procedure TestSetFieldValues;
     procedure TestGetFieldValues;
 
-    procedure TestAddIndex;
-    procedure TestAddDescIndex;
-    procedure TestAddCaseInsIndex;
-    procedure TestInactSwitchIndex;
-
-    procedure TestAddIndexInteger;
-    procedure TestAddIndexSmallInt;
-    procedure TestAddIndexBoolean;
-    procedure TestAddIndexFloat;
-    procedure TestAddIndexLargeInt;
-    procedure TestAddIndexDateTime;
-    procedure TestAddIndexCurrency;
-    procedure TestAddIndexBCD;
-
-    procedure TestAddIndexActiveDS;
-    procedure TestAddIndexEditDS;
-
-    procedure TestIndexFieldNames;
-    procedure TestIndexFieldNamesAct;
-    
-    procedure TestIndexCurRecord;
-
-    procedure TestAddDblIndex;
-    procedure TestIndexEditRecord;
-
     procedure TestNullAtOpen;
 
     procedure TestSupportIntegerFields;
@@ -88,15 +58,10 @@ type
     procedure TestSupportBCDFields;
     procedure TestSupportFixedStringFields;
 
-    procedure TestIsEmpty;
     procedure TestAppendOnEmptyDataset;
     procedure TestInsertOnEmptyDataset;
 
-    procedure TestBufDatasetCancelUpd; //bug 6938
     procedure TestEofAfterFirst;           //bug 7211
-    procedure TestBufDatasetCancelUpd1;
-    procedure TestMultipleDeleteUpdateBuffer;
-    procedure TestDoubleDelete;
     procedure TestDoubleClose;
     procedure TestCalculatedField;
     procedure TestAssignFieldftString;
@@ -106,6 +71,7 @@ type
     procedure TestMove;                    // bug 5048
     procedure TestActiveBufferWhenClosed;
     procedure TestEOFBOFClosedDataset;
+    procedure TestLayoutChangedEvents;
     procedure TestDataEventsResync;
     procedure TestBug7007;
     procedure TestBug6893;
@@ -119,6 +85,53 @@ type
     procedure TestCanModifySpecialFields;
   end;
 
+  { TTestBufDatasetDBBasics }
+
+  TTestBufDatasetDBBasics = class(TTestCase)
+  private
+    procedure FTestXMLDatasetDefinition(ADataset : TDataset);
+    procedure TestAddIndexFieldType(AFieldType : TFieldType; ActiveDS : boolean);
+  protected
+    procedure SetUp; override;
+    procedure TearDown; override;
+  published
+    procedure TestClosedIndexFieldNames; // bug 16695
+    procedure TestFileNameProperty;
+    procedure TestClientDatasetAsMemDataset;
+    procedure TestSafeAsXML;
+    procedure TestIsEmpty;
+    procedure TestBufDatasetCancelUpd; //bug 6938
+    procedure TestBufDatasetCancelUpd1;
+    procedure TestMultipleDeleteUpdateBuffer;
+    procedure TestDoubleDelete;
+  // index tests
+    procedure TestAddIndexInteger;
+    procedure TestAddIndexSmallInt;
+    procedure TestAddIndexBoolean;
+    procedure TestAddIndexFloat;
+    procedure TestAddIndexLargeInt;
+    procedure TestAddIndexDateTime;
+    procedure TestAddIndexCurrency;
+    procedure TestAddIndexBCD;
+
+    procedure TestAddIndex;
+    procedure TestAddDescIndex;
+    procedure TestAddCaseInsIndex;
+    procedure TestInactSwitchIndex;
+
+    procedure TestAddIndexActiveDS;
+    procedure TestAddIndexEditDS;
+
+    procedure TestIndexFieldNames;
+    procedure TestIndexFieldNamesAct;
+
+    procedure TestIndexCurRecord;
+
+    procedure TestAddDblIndex;
+    procedure TestIndexEditRecord;
+  end;
+
+
   TTestUniDirectionalDBBasics = class(TTestDBBasics)
   end;
 
@@ -136,10 +149,8 @@ uses bufdataset, variants, strutils, sqldb;
 
 type THackDataLink=class(TdataLink);
 
-procedure TTestDBBasics.TestIsEmpty;
+procedure TTestBufDatasetDBBasics.TestIsEmpty;
 begin
-  if not (DBConnector.GetNDataset(5) is TCustomBufDataset) then
-    Ignore('This test only applies to TCustomBufDataset and descendents.');
   with tCustombufdataset(DBConnector.GetNDataset(True,1)) do
     begin
     open;
@@ -257,9 +268,9 @@ begin
 
           Next;
           if (i > ABufferCount) and not EOF then
-            AssertEquals('deCheckBrowseMode:0;deDataSetScroll:-1;DataSetScrolled:1;',DataEvents)
+            AssertEquals('deCheckBrowseMode:0;deDataSetScroll:-1;DataSetScrolled:1;DataSetChanged;',DataEvents)
           else
-            AssertEquals('deCheckBrowseMode:0;deDataSetScroll:0;DataSetScrolled:0;',DataEvents);
+            AssertEquals('deCheckBrowseMode:0;deDataSetScroll:0;DataSetScrolled:0;DataSetChanged;',DataEvents);
           DataEvents := '';
           end;
         AssertEquals(count,i-1);
@@ -325,6 +336,37 @@ begin
     end;
 end;
 
+procedure TTestDBBasics.TestLayoutChangedEvents;
+var aDatasource : TDataSource;
+    aDatalink   : TDataLink;
+    ds          : tdataset;
+
+begin
+  aDatasource := TDataSource.Create(nil);
+  aDatalink := TTestDataLink.Create;
+  try
+    aDatalink.DataSource := aDatasource;
+    ds := DBConnector.GetNDataset(6);
+    aDatasource.DataSet:=ds;
+    with ds do
+      begin
+      open;
+
+      DataEvents := '';
+      DisableControls;
+      Active:=False;
+      Active:=True;
+      EnableControls;
+      AssertEquals('deLayoutChange:0;DataSetChanged;',DataEvents);
+
+      close;
+      end;
+  finally
+    aDatasource.Free;
+    aDatalink.Free;
+  end;
+end;
+
 procedure TTestDBBasics.TestDataEventsResync;
 var i,count     : integer;
     aDatasource : TDataSource;
@@ -344,10 +386,10 @@ begin
       open;
       DataEvents := '';
       Resync([rmExact]);
-      AssertEquals('deDataSetChange:0;',DataEvents);
+      AssertEquals('deDataSetChange:0;DataSetChanged;',DataEvents);
       DataEvents := '';
       next;
-      AssertEquals('deCheckBrowseMode:0;DataEvent;deDataSetScroll:0;DataSetScrolled:1;',DataEvents);
+      AssertEquals('deCheckBrowseMode:0;DataEvent;deDataSetScroll:0;DataSetScrolled:1;DataSetChanged;',DataEvents);
       close;
       end;
   finally
@@ -536,6 +578,16 @@ begin
   DBConnector.StopTest;
 end;
 
+procedure TTestBufDatasetDBBasics.TestClosedIndexFieldNames;
+var s : string;
+    bufds: TCustomBufDataset;
+begin
+  bufds := DBConnector.GetNDataset(5) as TCustomBufDataset;
+  s := bufds.IndexFieldNames;
+  s := bufds.IndexName;
+  bufds.CompareBookmarks(nil,nil);
+end;
+
 procedure TTestDBBasics.TestCanModifySpecialFields;
 var ds    : TDataset;
     lds   : TDataset;
@@ -572,13 +624,11 @@ begin
     end;
 end;
 
-procedure TTestDBBasics.TestSafeAsXML;
+procedure TTestBufDatasetDBBasics.TestSafeAsXML;
 var ds    : TDataset;
     LoadDs: TCustomBufDataset;
 begin
   ds := DBConnector.GetNDataset(true,5);
-  if not (ds is TCustomBufDataset) then
-    Ignore('This test only applies to TCustomBufDataset and descendents.');
 
   ds.open;
   TCustomBufDataset(ds).SaveToFile('test.xml');
@@ -589,16 +639,13 @@ begin
   FTestXMLDatasetDefinition(LoadDS);
 end;
 
-procedure TTestDBBasics.TestFileNameProperty;
+procedure TTestBufDatasetDBBasics.TestFileNameProperty;
 var ds1,ds2: TDataset;
     LoadDs: TCustomBufDataset;
 begin
   ds2 := nil;
   ds1 := DBConnector.GetNDataset(true,5);
   try
-    if not (ds1 is TCustomBufDataset) then
-      Ignore('This test only applies to TCustomBufDataset and descendents.');
-
     ds1.open;
     TCustomBufDataset(ds1).FileName:='test.xml';
     ds1.close;
@@ -614,7 +661,7 @@ begin
   end;
 end;
 
-procedure TTestDBBasics.TestClientDatasetAsMemDataset;
+procedure TTestBufDatasetDBBasics.TestClientDatasetAsMemDataset;
 var ds : TCustomBufDataset;
     i  : integer;
 begin
@@ -1037,7 +1084,7 @@ begin
     end;
 end;
 
-procedure TTestDBBasics.FTestXMLDatasetDefinition(ADataset: TDataset);
+procedure TTestBufDatasetDBBasics.FTestXMLDatasetDefinition(ADataset: TDataset);
 var i : integer;
 begin
   AssertEquals(2,ADataset.FieldDefs.Count);
@@ -1141,7 +1188,7 @@ begin
     end;
 end;
 
-procedure TTestDBBasics.TestAddIndexFieldType(AFieldType: TFieldType; ActiveDS : boolean);
+procedure TTestBufDatasetDBBasics.TestAddIndexFieldType(AFieldType: TFieldType; ActiveDS : boolean);
 var ds : TCustomBufDataset;
     FList : TStringList;
     LastValue : Variant;
@@ -1200,47 +1247,47 @@ begin
     end;
 end;
 
-procedure TTestDBBasics.TestAddIndexSmallInt;
+procedure TTestBufDatasetDBBasics.TestAddIndexSmallInt;
 begin
   TestAddIndexFieldType(ftSmallint,False);
 end;
 
-procedure TTestDBBasics.TestAddIndexBoolean;
+procedure TTestBufDatasetDBBasics.TestAddIndexBoolean;
 begin
   TestAddIndexFieldType(ftBoolean,False);
 end;
 
-procedure TTestDBBasics.TestAddIndexFloat;
+procedure TTestBufDatasetDBBasics.TestAddIndexFloat;
 begin
   TestAddIndexFieldType(ftFloat,False);
 end;
 
-procedure TTestDBBasics.TestAddIndexInteger;
+procedure TTestBufDatasetDBBasics.TestAddIndexInteger;
 begin
   TestAddIndexFieldType(ftInteger,False);
 end;
 
-procedure TTestDBBasics.TestAddIndexLargeInt;
+procedure TTestBufDatasetDBBasics.TestAddIndexLargeInt;
 begin
   TestAddIndexFieldType(ftLargeint,False);
 end;
 
-procedure TTestDBBasics.TestAddIndexDateTime;
+procedure TTestBufDatasetDBBasics.TestAddIndexDateTime;
 begin
   TestAddIndexFieldType(ftDateTime,False);
 end;
 
-procedure TTestDBBasics.TestAddIndexCurrency;
+procedure TTestBufDatasetDBBasics.TestAddIndexCurrency;
 begin
   TestAddIndexFieldType(ftCurrency,False);
 end;
 
-procedure TTestDBBasics.TestAddIndexBCD;
+procedure TTestBufDatasetDBBasics.TestAddIndexBCD;
 begin
   TestAddIndexFieldType(ftBCD,False);
 end;
 
-procedure TTestDBBasics.TestAddIndex;
+procedure TTestBufDatasetDBBasics.TestAddIndex;
 var ds : TCustomBufDataset;
     AFieldType : TFieldType;
     FList : TStringList;
@@ -1284,7 +1331,7 @@ begin
     end;
 end;
 
-procedure TTestDBBasics.TestAddDescIndex;
+procedure TTestBufDatasetDBBasics.TestAddDescIndex;
 var ds : TCustomBufDataset;
     AFieldType : TFieldType;
     FList : TStringList;
@@ -1328,7 +1375,7 @@ begin
     end;
 end;
 
-procedure TTestDBBasics.TestAddCaseInsIndex;
+procedure TTestBufDatasetDBBasics.TestAddCaseInsIndex;
 var ds : TCustomBufDataset;
     AFieldType : TFieldType;
     FList : TStringList;
@@ -1371,7 +1418,7 @@ begin
     end;
 end;
 
-procedure TTestDBBasics.TestInactSwitchIndex;
+procedure TTestBufDatasetDBBasics.TestInactSwitchIndex;
 // Test if the default-index is properly build when the active index is not
 // the default-index while opening then dataset
 var ds : TCustomBufDataset;
@@ -1400,14 +1447,14 @@ begin
     end;
 end;
 
-procedure TTestDBBasics.TestAddIndexActiveDS;
+procedure TTestBufDatasetDBBasics.TestAddIndexActiveDS;
 var ds   : TCustomBufDataset;
     I    : integer;
 begin
   TestAddIndexFieldType(ftString,true);
 end;
 
-procedure TTestDBBasics.TestAddIndexEditDS;
+procedure TTestBufDatasetDBBasics.TestAddIndexEditDS;
 var ds        : TCustomBufDataset;
     I         : integer;
     LastValue : String;
@@ -1440,7 +1487,7 @@ begin
     end;
 end;
 
-procedure TTestDBBasics.TestIndexFieldNamesAct;
+procedure TTestBufDatasetDBBasics.TestIndexFieldNamesAct;
 var ds : TCustomBufDataset;
     AFieldType : TFieldType;
     FList : TStringList;
@@ -1511,7 +1558,7 @@ begin
     end;
 end;
 
-procedure TTestDBBasics.TestIndexCurRecord;
+procedure TTestBufDatasetDBBasics.TestIndexCurRecord;
 // Test if the currentrecord stays the same after an index change
 var ds : TCustomBufDataset;
     AFieldType : TFieldType;
@@ -1559,7 +1606,7 @@ begin
     end;
 end;
 
-procedure TTestDBBasics.TestAddDblIndex;
+procedure TTestBufDatasetDBBasics.TestAddDblIndex;
 var ds : TCustomBufDataset;
     LastInteger : Integer;
     LastString : string;
@@ -1604,7 +1651,7 @@ begin
     end;
 end;
 
-procedure TTestDBBasics.TestIndexEditRecord;
+procedure TTestBufDatasetDBBasics.TestIndexEditRecord;
 var ds : TCustomBufDataset;
     AFieldType : TFieldType;
     i : integer;
@@ -1638,7 +1685,7 @@ begin
     end;
 end;
 
-procedure TTestDBBasics.TestIndexFieldNames;
+procedure TTestBufDatasetDBBasics.TestIndexFieldNames;
 var ds : TCustomBufDataset;
     AFieldType : TFieldType;
     PrevValue : String;
@@ -1898,6 +1945,7 @@ begin
 
   for i := 0 to testValuesCount-1 do
     begin
+    AssertEquals(CurrToStr(testCurrencyValues[i]),Fld.AsString);
     AssertEquals(testCurrencyValues[i],Fld.AsCurrency);
     AssertEquals(testCurrencyValues[i],Fld.AsFloat);
     ds.Next;
@@ -1969,11 +2017,9 @@ begin
   AParam.Free;
 end;
 
-procedure TTestDBBasics.TestBufDatasetCancelUpd;
+procedure TTestBufDatasetDBBasics.TestBufDatasetCancelUpd;
 var i : byte;
 begin
-  if not (DBConnector.GetNDataset(5) is TCustomBufDataset) then
-    Ignore('This test only applies to TCustomBufDataset and descendents.');
   with DBConnector.GetNDataset(5) as TCustomBufDataset do
     begin
     open;
@@ -2026,7 +2072,7 @@ begin
 
     DataEvents := '';
     query1.append;
-    AssertEquals('deCheckBrowseMode:0;deUpdateState:0;deDataSetChange:0;',DataEvents);
+    AssertEquals('deCheckBrowseMode:0;deUpdateState:0;deDataSetChange:0;DataSetChanged;',DataEvents);
     AssertEquals(5, datalink1.ActiveRecord);
     AssertEquals(6, datalink1.RecordCount);
     AssertEquals(6, query1.RecordCount);
@@ -2034,7 +2080,7 @@ begin
 
     DataEvents := '';
     query1.cancel;
-    AssertEquals('deCheckBrowseMode:0;deUpdateState:0;deDataSetChange:0;',DataEvents);
+    AssertEquals('deCheckBrowseMode:0;deUpdateState:0;deDataSetChange:0;DataSetChanged;',DataEvents);
     AssertEquals(5, datalink1.ActiveRecord);
     AssertEquals(6, datalink1.RecordCount);
     AssertEquals(6, query1.RecordCount);
@@ -2084,11 +2130,9 @@ begin
   end;
 end;
 
-procedure TTestDBBasics.TestBufDatasetCancelUpd1;
+procedure TTestBufDatasetDBBasics.TestBufDatasetCancelUpd1;
 var i : byte;
 begin
-  if not (DBConnector.GetNDataset(5) is TCustomBufDataset) then
-    Ignore('This test only applies to TCustomBufDataset and descendents.');
   with DBConnector.GetNDataset(5) as TCustomBufDataset do
     begin
     open;
@@ -2113,12 +2157,10 @@ begin
     end;
 end;
 
-procedure TTestDBBasics.TestMultipleDeleteUpdateBuffer;
+procedure TTestBufDatasetDBBasics.TestMultipleDeleteUpdateBuffer;
 var ds    : TDataset;
 begin
   ds := DBConnector.GetNDataset(true,5);
-  if not (ds is TCustomBufDataset) then
-    Ignore('This test only applies to TCustomBufDataset and descendents.');
 
   ds.open;
   with TCustomBufDataset(ds) do
@@ -2139,12 +2181,10 @@ begin
   ds.close;
 end;
 
-procedure TTestDBBasics.TestDoubleDelete;
+procedure TTestBufDatasetDBBasics.TestDoubleDelete;
 var ds    : TCustomBufDataset;
 begin
   ds := TCustomBufDataset(DBConnector.GetNDataset(true,5));
-  if not (ds is TCustomBufDataset) then
-    Ignore('This test only applies to TCustomBufDataset and descendents.');
 
   with ds do
     begin
@@ -2203,9 +2243,24 @@ begin
   inherited OneTimeTearDown;
 end;
 
+{ TTestBufDatasetDBBasics }
+
+procedure TTestBufDatasetDBBasics.SetUp;
+begin
+  DBConnector.StartTest;
+end;
+
+procedure TTestBufDatasetDBBasics.TearDown;
+begin
+  DBConnector.StopTest;
+end;
+
 initialization
   RegisterTestDecorator(TDBBasicsTestSetup, TTestDBBasics);
 
   if uppercase(dbconnectorname)='SQL' then
+    begin
+    RegisterTestDecorator(TDBBasicsTestSetup, TTestBufDatasetDBBasics);
     RegisterTestDecorator(TDBBasicsUniDirectionalTestSetup, TTestUniDirectionalDBBasics);
+    end;
 end.

+ 34 - 19
packages/fcl-db/tests/testfieldtypes.pas

@@ -45,6 +45,7 @@ type
     procedure TestCrossStringDateParam;
     procedure TestGetFieldNames;
     procedure TestUpdateIndexDefs;
+    procedure TestMultipleFieldPKIndexDefs;
     procedure TestSetBlobAsMemoParam;
     procedure TestSetBlobAsBlobParam;
     procedure TestSetBlobAsStringParam;
@@ -769,6 +770,10 @@ begin
 
     ShortDateFormat := 'yyyy-mm-dd';
 
+    // There is no Param.AsFixedChar, so the datatype has to be set manually
+    if ADatatype=ftFixedChar then
+      Params.ParamByName('field1').DataType := ftFixedChar;
+
     for i := 0 to testValuesCount -1 do
       begin
       Params.ParamByName('id').AsInteger := i;
@@ -800,13 +805,7 @@ begin
         ftInteger: AssertEquals(testIntValues[i],FieldByName('FIELD1').AsInteger);
         ftFloat  : AssertEquals(testFloatValues[i],FieldByName('FIELD1').AsFloat);
         ftBCD    : AssertEquals(testBCDValues[i],FieldByName('FIELD1').AsCurrency);
-        ftFixedChar :
-                   begin
-                   if FieldByName('FIELD1').isnull then
-                     AssertEquals(testStringValues[i],FieldByName('FIELD1').AsString)
-                   else
-                     AssertEquals(PadRight(testStringValues[i],10),FieldByName('FIELD1').AsString);
-                   end;
+        ftFixedChar : AssertEquals(PadRight(testStringValues[i],10),FieldByName('FIELD1').AsString);
         ftString : AssertEquals(testStringValues[i],FieldByName('FIELD1').AsString);
         ftdate   : AssertEquals(testDateValues[i],FormatDateTime('yyyy/mm/dd',FieldByName('FIELD1').AsDateTime));
       else
@@ -1319,18 +1318,11 @@ procedure TTestFieldTypes.TestNumericNames;
 begin
   with TSQLDBConnector(DBConnector) do
     begin
-    if not (SQLDbType in MySQLdbTypes) then
-      Connection.ExecuteDirect('create table FPDEV2 (         ' +
-                                '  "2ID" INT NOT NULL            , ' +
-                                '  "3TEST" VARCHAR(10),     ' +
-                                '  PRIMARY KEY ("2ID")           ' +
-                                ')                            ')
-    else
-      Connection.ExecuteDirect('create table FPDEV2 (         ' +
-                                '  2ID INT NOT NULL            , ' +
-                                '  3TEST VARCHAR(10),     ' +
-                                '  PRIMARY KEY (2ID)           ' +
-                                ')                            ');
+    Connection.ExecuteDirect('create table FPDEV2 (         ' +
+                              '  '+connection.FieldNameQuoteChars[0]+'2ID'+connection.FieldNameQuoteChars[1]+' INT NOT NULL, ' +
+                              '  '+connection.FieldNameQuoteChars[0]+'3TEST'+connection.FieldNameQuoteChars[1]+' VARCHAR(10), ' +
+                              '  PRIMARY KEY ('+connection.FieldNameQuoteChars[0]+'2ID'+connection.FieldNameQuoteChars[0]+') ' +
+                              ')                            ');
 // Firebird/Interbase need a commit after a DDL statement. Not necessary for the other connections
     TSQLDBConnector(DBConnector).Transaction.CommitRetaining;
     with query do
@@ -1603,6 +1595,29 @@ begin
   Asserttrue(ds.ServerIndexDefs[0].Options=[ixPrimary,ixUnique]);
 end;
 
+procedure TTestFieldTypes.TestMultipleFieldPKIndexDefs;
+var ds : TSQLQuery;
+begin
+  TSQLDBConnector(DBConnector).Connection.ExecuteDirect('create table FPDEV2 (' +
+                              '  ID1 INT NOT NULL,           ' +
+                              '  ID2 INT NOT NULL,           ' +
+                              '  NAME VARCHAR(50),           ' +
+                              '  PRIMARY KEY (ID1, ID2)      ' +
+                              ')                            ');
+
+  // Firebird/Interbase need a commit after a DDL statement. Not necessary for the other connections
+  if SQLDbType=interbase then TSQLDBConnector(DBConnector).Transaction.CommitRetaining;
+
+  ds := TSQLDBConnector(DBConnector).Query;
+  ds.sql.Text:='select * from FPDEV2';
+  ds.Prepare;
+  ds.ServerIndexDefs.Update;
+  AssertEquals(1,ds.ServerIndexDefs.count);
+  AssertTrue(SameText('ID1;ID2',ds.ServerIndexDefs[0].Fields));
+  Asserttrue(ds.ServerIndexDefs[0].Options=[ixPrimary,ixUnique]);
+end;
+
+
 procedure TTestFieldTypes.TestSetBlobAsMemoParam;
 begin
   TestSetBlobAsParam(0);

+ 10 - 1
packages/fcl-db/tests/toolsunit.pas

@@ -75,6 +75,7 @@ type
   TTestDataLink = class(TDataLink)
      protected
        procedure DataSetScrolled(Distance: Integer); override;
+       procedure DataSetChanged; override;
 {$IFDEF fpc}
        procedure DataEvent(Event: TDataEvent; Info: Ptrint); override;
 {$ELSE}
@@ -161,7 +162,8 @@ var dbtype,
     dbname,
     dbuser,
     dbhostname,
-    dbpassword     : string;
+    dbpassword,
+    dbQuoteChars   : string;
     DataEvents     : string;
     DBConnector    : TDBConnector;
     testValues     : Array [TFieldType,0..testvaluescount -1] of string;
@@ -241,6 +243,7 @@ begin
   dbhostname := IniFile.ReadString(dbtype,'Hostname','');
   dbpassword := IniFile.ReadString(dbtype,'Password','');
   dbconnectorparams := IniFile.ReadString(dbtype,'ConnectorParams','');
+  dbquotechars := IniFile.ReadString(dbtype,'QuoteChars','"');
 
   IniFile.Free;
 end;
@@ -293,6 +296,12 @@ begin
   inherited DataSetScrolled(Distance);
 end;
 
+procedure TTestDataLink.DataSetChanged;
+begin
+  DataEvents := DataEvents + 'DataSetChanged;';
+  inherited DataSetChanged;
+end;
+
 procedure TTestDataLink.DataEvent(Event: TDataEvent; Info: Ptrint);
 {$ELSE}
 procedure TTestDataLink.DataEvent(Event: TDataEvent; Info: Longint);

+ 52 - 50
packages/fcl-json/src/fpjson.pp

@@ -27,7 +27,7 @@ uses
 type
 
   TJSONtype = (jtUnknown, jtNumber, jtString, jtBoolean, jtNull, jtArray, jtObject);
-  TJSONFloat = Extended;
+  TJSONFloat = Double;
   TJSONStringType = AnsiString;
   TJSONCharType = AnsiChar;
   PJSONCharType = ^TJSONCharType;
@@ -178,7 +178,7 @@ type
     function GetAsString: TJSONStringType; override;
     procedure SetAsString(const AValue: TJSONStringType); override;
   public
-    Constructor Create(AValue : TJSONStringType); reintroduce;
+    Constructor Create(const AValue : TJSONStringType); reintroduce;
     class function JSONType: TJSONType; override;
     Procedure Clear;  override;
     Function Clone : TJSONData; override;
@@ -291,7 +291,7 @@ type
     function Add(Item : TJSONData): Integer;
     function Add(I : Integer): Integer;
     function Add(I : Int64): Int64;
-    function Add(S : String): Integer;
+    function Add(const S : String): Integer;
     function Add: Integer;
     function Add(F : TJSONFloat): Integer;
     function Add(B : Boolean): Integer;
@@ -319,26 +319,26 @@ type
   TJSONObject = class(TJSONData)
   private
     FHash : TFPHashObjectList; // Careful : Names limited to 255 chars.
-    function GetArrays(AName : String): TJSONArray;
-    function GetBooleans(AName : String): Boolean;
-    function GetElements(AName: string): TJSONData;
-    function GetFloats(AName : String): TJSONFloat;
-    function GetIntegers(AName : String): Integer;
-    function GetInt64s(AName : String): Int64;
-    function GetIsNull(AName : String): Boolean; reintroduce;
+    function GetArrays(const AName : String): TJSONArray;
+    function GetBooleans(const AName : String): Boolean;
+    function GetElements(const AName: string): TJSONData;
+    function GetFloats(const AName : String): TJSONFloat;
+    function GetIntegers(const AName : String): Integer;
+    function GetInt64s(const AName : String): Int64;
+    function GetIsNull(const AName : String): Boolean; reintroduce;
     function GetNameOf(Index : Integer): TJSONStringType;
-    function GetObjects(AName : String): TJSONObject;
-    function GetStrings(AName : String): TJSONStringType;
-    function GetTypes(AName : String): TJSONType;
-    procedure SetArrays(AName : String; const AValue: TJSONArray);
-    procedure SetBooleans(AName : String; const AValue: Boolean);
-    procedure SetElements(AName: string; const AValue: TJSONData);
-    procedure SetFloats(AName : String; const AValue: TJSONFloat);
-    procedure SetIntegers(AName : String; const AValue: Integer);
-    procedure SetInt64s(AName : String; const AValue: Int64);
-    procedure SetIsNull(AName : String; const AValue: Boolean);
-    procedure SetObjects(AName : String; const AValue: TJSONObject);
-    procedure SetStrings(AName : String; const AValue: TJSONStringType);
+    function GetObjects(const AName : String): TJSONObject;
+    function GetStrings(const AName : String): TJSONStringType;
+    function GetTypes(const AName : String): TJSONType;
+    procedure SetArrays(const AName : String; const AValue: TJSONArray);
+    procedure SetBooleans(const AName : String; const AValue: Boolean);
+    procedure SetElements(const AName: string; const AValue: TJSONData);
+    procedure SetFloats(const AName : String; const AValue: TJSONFloat);
+    procedure SetIntegers(const AName : String; const AValue: Integer);
+    procedure SetInt64s(const AName : String; const AValue: Int64);
+    procedure SetIsNull(const AName : String; const AValue: Boolean);
+    procedure SetObjects(const AName : String; const AValue: TJSONObject);
+    procedure SetStrings(const AName : String; const AValue: TJSONStringType);
   protected
     Procedure Converterror(From : Boolean);
     function GetAsBoolean: Boolean; override;
@@ -372,7 +372,7 @@ type
     function Add(const AName: TJSONStringType; AValue: TJSONData): Integer; overload;
     function Add(const AName: TJSONStringType; AValue: Boolean): Integer; overload;
     function Add(const AName: TJSONStringType; AValue: TJSONFloat): Integer; overload;
-    function Add(const AName: TJSONStringType; AValue: TJSONStringType): Integer; overload;
+    function Add(const AName, AValue: TJSONStringType): Integer; overload;
     function Add(const AName: TJSONStringType; Avalue: Integer): Integer; overload;
     function Add(const AName: TJSONStringType; Avalue: Int64): Integer; overload;
     function Add(const AName: TJSONStringType): Integer; overload;
@@ -398,8 +398,8 @@ type
 
   EJSON = Class(Exception);
   
-Function StringToJSONString(S : TJSONStringType) : TJSONStringType;
-Function JSONStringToString(S : TJSONStringType) : TJSONStringType;
+Function StringToJSONString(const S : TJSONStringType) : TJSONStringType;
+Function JSONStringToString(const S : TJSONStringType) : TJSONStringType;
 
 
 
@@ -422,9 +422,9 @@ Resourcestring
   SErrPointerNotNil = 'Cannot add non-nil pointer to JSON%s';
   SErrOddNumber = 'TJSONObject must be constructed with name,value pairs';
   SErrNameMustBeString = 'TJSONObject constructor element name at pos %d is not a string';
+  SErrNonexistentElement = 'Unknown object member: "%s"';
   
-  
-Function StringToJSONString(S : TJSONStringType) : TJSONStringType;
+Function StringToJSONString(const S : TJSONStringType) : TJSONStringType;
 
 Var
   I,J,L : Integer;
@@ -459,7 +459,7 @@ begin
   Result:=Result+Copy(S,J,I-1);
 end;
 
-Function JSONStringToString(S : TJSONStringType) : TJSONStringType;
+Function JSONStringToString(const S : TJSONStringType) : TJSONStringType;
 
 Var
   I,J,L : Integer;
@@ -640,7 +640,7 @@ begin
   FValue:=AValue;
 end;
 
-constructor TJSONstring.Create(AValue: TJSONStringType);
+constructor TJSONstring.Create(const AValue: TJSONStringType);
 begin
   FValue:=AValue;
 end;
@@ -1414,7 +1414,7 @@ begin
   Result:=Add(TJSONInt64Number.Create(I));
 end;
 
-function TJSONArray.Add(S: String): Integer;
+function TJSONArray.Add(const S: String): Integer;
 begin
   Result:=Add(TJSONString.Create(S));
 end;
@@ -1460,37 +1460,39 @@ end;
 
 { TJSONObject }
 
-function TJSONObject.GetArrays(AName : String): TJSONArray;
+function TJSONObject.GetArrays(Const AName : String): TJSONArray;
 begin
   Result:=GetElements(AName) as TJSONArray;
 end;
 
-function TJSONObject.GetBooleans(AName : String): Boolean;
+function TJSONObject.GetBooleans(Const AName : String): Boolean;
 begin
   Result:=GetElements(AName).AsBoolean;
 end;
 
-function TJSONObject.GetElements(AName: string): TJSONData;
+function TJSONObject.GetElements(Const AName: string): TJSONData;
 begin
   Result:=TJSONData(FHash.Find(AName));
+  If (Result=Nil) then
+    Raise EJSON.CreateFmt(SErrNonexistentElement,[AName]);
 end;
 
-function TJSONObject.GetFloats(AName : String): TJSONFloat;
+function TJSONObject.GetFloats(Const AName : String): TJSONFloat;
 begin
   Result:=GetElements(AName).AsFloat;
 end;
 
-function TJSONObject.GetIntegers(AName : String): Integer;
+function TJSONObject.GetIntegers(Const AName : String): Integer;
 begin
   Result:=GetElements(AName).AsInteger;
 end;
 
-function TJSONObject.GetInt64s(AName : String): Int64;
+function TJSONObject.GetInt64s(Const AName : String): Int64;
 begin
   Result:=GetElements(AName).AsInt64;
 end;
 
-function TJSONObject.GetIsNull(AName : String): Boolean;
+function TJSONObject.GetIsNull(Const AName : String): Boolean;
 begin
   Result:=GetElements(AName).IsNull;
 end;
@@ -1500,33 +1502,33 @@ begin
   Result:=FHash.NameOfIndex(Index);
 end;
 
-function TJSONObject.GetObjects(AName : String): TJSONObject;
+function TJSONObject.GetObjects(const AName : String): TJSONObject;
 begin
   Result:=GetElements(AName) as TJSONObject;
 end;
 
-function TJSONObject.GetStrings(AName : String): TJSONStringType;
+function TJSONObject.GetStrings(const AName : String): TJSONStringType;
 begin
   Result:=GetElements(AName).AsString;
 end;
 
-function TJSONObject.GetTypes(AName : String): TJSONType;
+function TJSONObject.GetTypes(const AName : String): TJSONType;
 begin
   Result:=Getelements(Aname).JSONType;
 end;
 
-procedure TJSONObject.SetArrays(AName : String; const AValue: TJSONArray);
+procedure TJSONObject.SetArrays(const AName : String; const AValue: TJSONArray);
 
 begin
   SetElements(AName,AVAlue);
 end;
 
-procedure TJSONObject.SetBooleans(AName : String; const AValue: Boolean);
+procedure TJSONObject.SetBooleans(const AName : String; const AValue: Boolean);
 begin
   SetElements(AName,TJSONBoolean.Create(AVAlue));
 end;
 
-procedure TJSONObject.SetElements(AName: string; const AValue: TJSONData);
+procedure TJSONObject.SetElements(const AName: string; const AValue: TJSONData);
 Var
   Index : Integer;
 
@@ -1538,34 +1540,34 @@ begin
     FHash.Items[Index]:=AValue; // Will free the previous value.
 end;
 
-procedure TJSONObject.SetFloats(AName : String; const AValue: TJSONFloat);
+procedure TJSONObject.SetFloats(const AName : String; const AValue: TJSONFloat);
 begin
   SetElements(AName,TJSONFloatNumber.Create(AVAlue));
 end;
 
-procedure TJSONObject.SetIntegers(AName : String; const AValue: Integer);
+procedure TJSONObject.SetIntegers(const AName : String; const AValue: Integer);
 begin
   SetElements(AName,TJSONIntegerNumber.Create(AVAlue));
 end;
 
-procedure TJSONObject.SetInt64s(AName : String; const AValue: Int64);
+procedure TJSONObject.SetInt64s(const AName : String; const AValue: Int64);
 begin
   SetElements(AName,TJSONInt64Number.Create(AVAlue));
 end;
 
-procedure TJSONObject.SetIsNull(AName : String; const AValue: Boolean);
+procedure TJSONObject.SetIsNull(const AName : String; const AValue: Boolean);
 begin
   If Not AValue then
     Raise EJSON.Create(SErrCannotSetNotIsNull);
   SetElements(AName,TJSONNull.Create);
 end;
 
-procedure TJSONObject.SetObjects(AName : String; const AValue: TJSONObject);
+procedure TJSONObject.SetObjects(const AName : String; const AValue: TJSONObject);
 begin
   SetElements(AName,AValue);
 end;
 
-procedure TJSONObject.SetStrings(AName : String; const AValue: TJSONStringType);
+procedure TJSONObject.SetStrings(const AName : String; const AValue: TJSONStringType);
 begin
   SetElements(AName,TJSONString.Create(AVAlue));
 end;
@@ -1794,7 +1796,7 @@ begin
   Result:=Add(AName,TJSONFloatNumber.Create(AValue));
 end;
 
-function TJSONObject.Add(const AName: TJSONStringType; AValue: TJSONStringType): Integer;
+function TJSONObject.Add(const AName, AValue: TJSONStringType): Integer;
 begin
   Result:=Add(AName,TJSONString.Create(AValue));
 end;

+ 23 - 2
packages/fcl-json/tests/testjsondata.pp

@@ -157,6 +157,7 @@ type
   TTestObject = class(TTestJSON)
   private
     procedure TestAddBoolean(B : Boolean);
+    Procedure TestAccessError;
   published
     Procedure TestCreate;
     Procedure TestCreateString;
@@ -184,6 +185,7 @@ type
     procedure TestRemove;
     procedure TestClone;
     procedure TestExtract;
+    Procedure TestNonExistingAccessError;
   end;
 
 
@@ -998,7 +1000,7 @@ end;
 procedure TTestArray.TestCreateFloat;
 
 Const
-  S = 1.2;
+  S : double = 1.2;
 
 Var
   J : TJSONArray;
@@ -1564,6 +1566,20 @@ begin
 
 end;
 
+procedure TTestObject.TestAccessError;
+
+Var
+   J : TJSONObject;
+
+begin
+  J:=TJSonObject.Create;
+  try
+    J.Strings['NonExist'];
+  finally
+    FreeAndNil(J);
+  end;
+end;
+
 procedure TTestObject.TestAddBooleanTrue;
 
 begin
@@ -1812,6 +1828,11 @@ begin
 
 end;
 
+procedure TTestObject.TestNonExistingAccessError;
+begin
+  AssertException(EJSON,@TestAccessError);
+end;
+
 
 procedure TTestObject.TestCreateString;
 
@@ -1907,7 +1928,7 @@ procedure TTestObject.TestCreateFloat;
 
 Const
   A = 'A';
-  S = 1.2;
+  S : double = 1.2;
 
 Var
   J : TJSONObject;

+ 3 - 3
packages/fcl-json/tests/testjsonparser.pp

@@ -209,9 +209,9 @@ begin
   DoTestArray('[1234567890123456]',1);
   DoTestArray('[1234567890123456, 2234567890123456]',2);
   DoTestArray('[1234567890123456, 2234567890123456, 3234567890123456]',3);
-  Str(1.2,S1);
-  Str(2.3,S2);
-  Str(3.4,S3);
+  Str(Double(1.2),S1);
+  Str(Double(2.3),S2);
+  Str(Double(3.4),S3);
   DoTestArray('['+S1+']',1);
   DoTestArray('['+S1+', '+S2+']',2);
   DoTestArray('['+S1+', '+S2+', '+S3+']',3);

+ 12 - 0
packages/fcl-web/examples/jsonrpc/extdirect/extdemo.html

@@ -0,0 +1,12 @@
+<html>
+<head>
+<title>ExtJS JSON Data demo</title>
+<link rel="stylesheet" type="text/css" href="/ext/resources/css/ext-all.css"/>
+<script src="/ext/adapter/ext/ext-base.js"></script>
+<script src="/ext/ext-all-debug.js"></script>
+<script src="extdemo.cgi/demo/API"></script>
+<script src="extdemo.js"></script>
+</head>
+<body>
+</body>
+</html>

+ 44 - 0
packages/fcl-web/examples/jsonrpc/extdirect/extdemo.js

@@ -0,0 +1,44 @@
+/* 
+  Define namespace FPC 
+*/
+
+Ext.ns('FPC');
+
+/* 
+  Include our server-side Ext.Direct API; The default name 'FPWeb' was used
+*/
+
+Ext.Direct.addProvider(FPWeb);
+
+/* 
+  Callback used to process result. It will show the actual page
+*/
+
+FPC.ShowResult = function (Provider,Response) {
+  var panel = new Ext.Panel({
+    renderTo: Ext.getBody(),
+    frame: true,
+    title: "Adding 1.2 and 3.4 = " + Response.result,
+    height: 50,
+    width: 200,
+    html: "The result is : " + Response.result
+   });
+  panel.show();
+}
+
+/* 
+  onReady callback function 
+*/
+
+FPC.ShowPage = function () {
+  /* 
+    Call our API, using FPC.ShowResult as the callback to process the result 
+  */
+  DemoClass.Add(1.2, 3.4, FPC.ShowResult);
+}
+
+/* 
+  Start Extjs 
+*/
+
+Ext.onReady(FPC.ShowPage);

+ 261 - 0
packages/fcl-web/examples/jsonrpc/extdirect/extdemo.lpi

@@ -0,0 +1,261 @@
+<?xml version="1.0"?>
+<CONFIG>
+  <ProjectOptions>
+    <Version Value="7"/>
+    <General>
+      <Flags>
+        <MainUnitHasCreateFormStatements Value="False"/>
+        <Runnable Value="False"/>
+      </Flags>
+      <MainUnit Value="0"/>
+      <TargetFileExt Value=""/>
+      <Title Value="Ext.Direct demo application"/>
+      <ResourceType Value="res"/>
+      <UseXPManifest Value="True"/>
+      <Icon Value="0"/>
+      <ActiveWindowIndexAtStart Value="0"/>
+    </General>
+    <VersionInfo>
+      <Language Value=""/>
+      <CharSet Value=""/>
+      <StringTable Comments="" CompanyName="" FileDescription="" FileVersion="" InternalName="" LegalCopyright="" LegalTrademarks="" OriginalFilename="" ProductName="" ProductVersion=""/>
+    </VersionInfo>
+    <PublishOptions>
+      <Version Value="2"/>
+      <IgnoreBinaries Value="False"/>
+      <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
+      <ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/>
+    </PublishOptions>
+    <RunParams>
+      <local>
+        <FormatVersion Value="1"/>
+        <LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
+      </local>
+    </RunParams>
+    <RequiredPackages Count="4">
+      <Item1>
+        <PackageName Value="lazwebextra"/>
+        <MinVersion Valid="True"/>
+      </Item1>
+      <Item2>
+        <PackageName Value="WebLaz"/>
+      </Item2>
+      <Item3>
+        <PackageName Value="LCL"/>
+      </Item3>
+      <Item4>
+        <PackageName Value="FCL"/>
+      </Item4>
+    </RequiredPackages>
+    <Units Count="12">
+      <Unit0>
+        <Filename Value="extdemo.lpr"/>
+        <IsPartOfProject Value="True"/>
+        <UnitName Value="extdemo"/>
+        <EditorIndex Value="1"/>
+        <WindowIndex Value="0"/>
+        <TopLine Value="1"/>
+        <CursorPos X="7" Y="6"/>
+        <UsageCount Value="24"/>
+        <Loaded Value="True"/>
+      </Unit0>
+      <Unit1>
+        <Filename Value="wmdemo.pp"/>
+        <ComponentName Value="FPWebModule1"/>
+        <ResourceBaseClass Value="DataModule"/>
+        <UnitName Value="wmdemo"/>
+        <EditorIndex Value="0"/>
+        <WindowIndex Value="0"/>
+        <TopLine Value="1"/>
+        <CursorPos X="21" Y="28"/>
+        <UsageCount Value="24"/>
+        <Loaded Value="True"/>
+      </Unit1>
+      <Unit2>
+        <Filename Value="wmext.pp"/>
+        <IsPartOfProject Value="True"/>
+        <ComponentName Value="DemoClass"/>
+        <ResourceBaseClass Value="DataModule"/>
+        <UnitName Value="wmext"/>
+        <EditorIndex Value="6"/>
+        <WindowIndex Value="0"/>
+        <TopLine Value="3"/>
+        <CursorPos X="22" Y="48"/>
+        <UsageCount Value="24"/>
+        <Loaded Value="True"/>
+      </Unit2>
+      <Unit3>
+        <Filename Value="../../../src/jsonrpc/fpextdirect.pp"/>
+        <UnitName Value="fpextdirect"/>
+        <IsVisibleTab Value="True"/>
+        <EditorIndex Value="7"/>
+        <WindowIndex Value="0"/>
+        <TopLine Value="185"/>
+        <CursorPos X="49" Y="196"/>
+        <UsageCount Value="12"/>
+        <Loaded Value="True"/>
+      </Unit3>
+      <Unit4>
+        <Filename Value="../../../src/jsonrpc/fpjsonrpc.pp"/>
+        <UnitName Value="fpjsonrpc"/>
+        <WindowIndex Value="0"/>
+        <TopLine Value="432"/>
+        <CursorPos X="6" Y="441"/>
+        <UsageCount Value="10"/>
+      </Unit4>
+      <Unit5>
+        <Filename Value="../../../../../lazarus/components/fpweb/reglazwebextra.pp"/>
+        <UnitName Value="reglazwebextra"/>
+        <EditorIndex Value="10"/>
+        <WindowIndex Value="0"/>
+        <TopLine Value="67"/>
+        <CursorPos X="56" Y="81"/>
+        <UsageCount Value="12"/>
+        <Loaded Value="True"/>
+      </Unit5>
+      <Unit6>
+        <Filename Value="wmext.lrs"/>
+        <EditorIndex Value="9"/>
+        <WindowIndex Value="0"/>
+        <TopLine Value="1"/>
+        <CursorPos X="1" Y="9"/>
+        <UsageCount Value="12"/>
+        <Loaded Value="True"/>
+      </Unit6>
+      <Unit7>
+        <Filename Value="../../../src/base/fpcgi.pp"/>
+        <UnitName Value="fpcgi"/>
+        <EditorIndex Value="2"/>
+        <WindowIndex Value="0"/>
+        <TopLine Value="1"/>
+        <CursorPos X="26" Y="20"/>
+        <UsageCount Value="12"/>
+        <Loaded Value="True"/>
+      </Unit7>
+      <Unit8>
+        <Filename Value="../../../src/base/custcgi.pp"/>
+        <UnitName Value="custcgi"/>
+        <EditorIndex Value="3"/>
+        <WindowIndex Value="0"/>
+        <TopLine Value="24"/>
+        <CursorPos X="33" Y="24"/>
+        <UsageCount Value="12"/>
+        <Loaded Value="True"/>
+      </Unit8>
+      <Unit9>
+        <Filename Value="../../../src/base/httpdefs.pp"/>
+        <UnitName Value="HTTPDefs"/>
+        <EditorIndex Value="4"/>
+        <WindowIndex Value="0"/>
+        <TopLine Value="1"/>
+        <CursorPos X="26" Y="38"/>
+        <UsageCount Value="12"/>
+        <Loaded Value="True"/>
+      </Unit9>
+      <Unit10>
+        <Filename Value="../../../src/base/custweb.pp"/>
+        <UnitName Value="custweb"/>
+        <EditorIndex Value="5"/>
+        <WindowIndex Value="0"/>
+        <TopLine Value="221"/>
+        <CursorPos X="17" Y="265"/>
+        <UsageCount Value="12"/>
+        <Loaded Value="True"/>
+      </Unit10>
+      <Unit11>
+        <Filename Value="../../../src/jsonrpc/webjsonrpc.pp"/>
+        <UnitName Value="webjsonrpc"/>
+        <EditorIndex Value="8"/>
+        <WindowIndex Value="0"/>
+        <TopLine Value="29"/>
+        <CursorPos X="27" Y="29"/>
+        <UsageCount Value="11"/>
+        <Loaded Value="True"/>
+      </Unit11>
+    </Units>
+    <JumpHistory Count="13" HistoryIndex="12">
+      <Position1>
+        <Filename Value="../../../../../lazarus/components/fpweb/reglazwebextra.pp"/>
+        <Caret Line="1" Column="1" TopLine="1"/>
+      </Position1>
+      <Position2>
+        <Filename Value="extdemo.lpr"/>
+        <Caret Line="1" Column="1" TopLine="1"/>
+      </Position2>
+      <Position3>
+        <Filename Value="extdemo.lpr"/>
+        <Caret Line="11" Column="1" TopLine="1"/>
+      </Position3>
+      <Position4>
+        <Filename Value="wmext.pp"/>
+        <Caret Line="6" Column="18" TopLine="2"/>
+      </Position4>
+      <Position5>
+        <Filename Value="../../../src/jsonrpc/fpextdirect.pp"/>
+        <Caret Line="376" Column="36" TopLine="370"/>
+      </Position5>
+      <Position6>
+        <Filename Value="../../../src/base/httpdefs.pp"/>
+        <Caret Line="1" Column="1" TopLine="1"/>
+      </Position6>
+      <Position7>
+        <Filename Value="../../../src/base/httpdefs.pp"/>
+        <Caret Line="936" Column="3" TopLine="929"/>
+      </Position7>
+      <Position8>
+        <Filename Value="../../../src/base/custweb.pp"/>
+        <Caret Line="1" Column="1" TopLine="1"/>
+      </Position8>
+      <Position9>
+        <Filename Value="../../../src/jsonrpc/fpextdirect.pp"/>
+        <Caret Line="397" Column="17" TopLine="368"/>
+      </Position9>
+      <Position10>
+        <Filename Value="../../../src/jsonrpc/fpextdirect.pp"/>
+        <Caret Line="29" Column="1" TopLine="26"/>
+      </Position10>
+      <Position11>
+        <Filename Value="../../../src/jsonrpc/fpextdirect.pp"/>
+        <Caret Line="398" Column="16" TopLine="373"/>
+      </Position11>
+      <Position12>
+        <Filename Value="../../../src/jsonrpc/fpextdirect.pp"/>
+        <Caret Line="413" Column="21" TopLine="379"/>
+      </Position12>
+      <Position13>
+        <Filename Value="../../../src/jsonrpc/webjsonrpc.pp"/>
+        <Caret Line="66" Column="14" TopLine="41"/>
+      </Position13>
+    </JumpHistory>
+  </ProjectOptions>
+  <CompilerOptions>
+    <Version Value="8"/>
+    <Target>
+      <Filename Value="extdemo.cgi"/>
+    </Target>
+    <SearchPaths>
+      <IncludeFiles Value="$(ProjOutDir)/"/>
+    </SearchPaths>
+    <Parsing>
+      <SyntaxOptions>
+        <UseAnsiStrings Value="True"/>
+      </SyntaxOptions>
+    </Parsing>
+    <Other>
+      <CompilerPath Value="$(CompPath)"/>
+    </Other>
+  </CompilerOptions>
+  <Debugging>
+    <Exceptions Count="3">
+      <Item1>
+        <Name Value="EAbort"/>
+      </Item1>
+      <Item2>
+        <Name Value="ECodetoolError"/>
+      </Item2>
+      <Item3>
+        <Name Value="EFOpenError"/>
+      </Item3>
+    </Exceptions>
+  </Debugging>
+</CONFIG>

+ 15 - 0
packages/fcl-web/examples/jsonrpc/extdirect/extdemo.lpr

@@ -0,0 +1,15 @@
+program extdemo;
+
+{$mode objfpc}{$H+}
+
+uses
+  fpCGI, wmext;
+
+{$R *.res}
+
+begin
+  Application.Title:='Ext.Direct demo application';
+  Application.Initialize;
+  Application.Run;
+end.
+

+ 4 - 0
packages/fcl-web/examples/jsonrpc/extdirect/extdirect.in

@@ -0,0 +1,4 @@
+[
+  { "action": "DemoClass", "method": "add", "data": [1 , 2 ] , "tid": 1 },
+  { "action": "DemoClass", "method": "add", "data": [1.2 , 3.4] , "tid": 2 }
+]

+ 24 - 0
packages/fcl-web/examples/jsonrpc/extdirect/wmext.lfm

@@ -0,0 +1,24 @@
+object DemoClass: TDemoClass
+  OldCreateOrder = False
+  APIPath = 'API'
+  RouterPath = 'Router'
+  Height = 313
+  HorizontalOffset = 548
+  VerticalOffset = 230
+  Width = 359
+  object Add: TJSONRPCHandler
+    OnExecute = AddExecute
+    Options = []
+    ParamDefs = <    
+      item
+        Name = 'A'
+        DataType = jtNumber
+      end    
+      item
+        Name = 'B'
+        DataType = jtNumber
+      end>
+    left = 56
+    top = 32
+  end
+end

+ 10 - 0
packages/fcl-web/examples/jsonrpc/extdirect/wmext.lrs

@@ -0,0 +1,10 @@
+{ This is an automatically generated lazarus resource file }
+
+LazarusResources.Add('TDemoClass','FORMDATA',[
+  'TPF0'#10'TDemoClass'#9'DemoClass'#14'OldCreateOrder'#8#7'APIPath'#6#3'API'#10
+  +'RouterPath'#6#6'Router'#6'Height'#3'9'#1#16'HorizontalOffset'#3'$'#2#14'Ver'
+  +'ticalOffset'#3#230#0#5'Width'#3'g'#1#0#15'TJSONRPCHandler'#3'Add'#9'OnExecu'
+  +'te'#7#10'AddExecute'#7'Options'#11#0#9'ParamDefs'#14#1#4'Name'#6#1'A'#8'Dat'
+  +'aType'#7#8'jtNumber'#0#1#4'Name'#6#1'B'#8'DataType'#7#8'jtNumber'#0#0#4'lef'
+  +'t'#2'8'#3'top'#2' '#0#0#0
+]);

+ 52 - 0
packages/fcl-web/examples/jsonrpc/extdirect/wmext.pp

@@ -0,0 +1,52 @@
+unit wmext; 
+
+{$mode objfpc}{$H+}
+
+interface
+
+uses
+  Classes, SysUtils, FileUtil, LResources, HTTPDefs, websession, fpHTTP, fpWeb, 
+    fpjsonrpc, webjsonrpc, fpextdirect, fpjson;
+
+type
+
+  { TDemoClass }
+
+  TDemoClass = class(TExtDirectModule)
+    Add: TJSONRPCHandler;
+    procedure AddExecute(Sender: TObject; const Params: TJSONData; out
+      Res: TJSONData);
+  private
+    { private declarations }
+  public
+    { public declarations }
+  end; 
+
+var
+  DemoClass: TDemoClass;
+
+implementation
+
+{ TDemoClass }
+
+procedure TDemoClass.AddExecute(Sender: TObject;
+  const Params: TJSONData; out Res: TJSONData);
+
+Var
+  A,B : TJSONData;
+
+begin
+  If (Params is TJSONArray) then
+    begin
+    A:=TJSONArray(Params).Items[0];
+    B:=TJSONArray(Params).Items[1];
+    Res:=TJSONFLoatNumber.Create(B.AsFloat+A.AsFloat);
+    end;
+end;
+
+initialization
+  {$I wmext.lrs}
+
+  RegisterHTTPModule('demo', TDemoClass);
+end.
+

+ 2 - 0
packages/fcl-web/src/webdata/sqldbwebdata.pp

@@ -63,6 +63,7 @@ Type
     Property IDFieldName;
     Property OnGetNewID;
     property OnGetParameterType;
+    Property Options;
   end;
 
 implementation
@@ -179,6 +180,7 @@ procedure TCustomSQLDBWebDataProvider.Notification(AComponent: TComponent;
   Operation: TOperation);
 
 begin
+  inherited;
   If (Operation=opRemove) then
     begin
     If (AComponent=FQuery) then

+ 25 - 30
packages/sndfile/examples/sfplay.pp

@@ -3,7 +3,7 @@ program sfplay;
 {$mode objfpc}
 {$h+}
 
-uses sndfile,linux;
+uses sndfile, baseunix;
 
 Const
   BUFFERLEN = 1024;
@@ -29,7 +29,6 @@ ResourceString
   SErrSetSyncMode = 'Could not set sync mode';
 
 Procedure PlayError(Msg : String);
-
 begin
   Writeln(stderr,Msg);
   Halt(1);
@@ -38,68 +37,64 @@ end;
 Function OpenDSPDevice(Channels,Samplerate : LongInt) : LongInt; forward;
 
 procedure PlayFile(FileName : String);
-
-Var
-  Buffer : Array[0..BUFFERLEN-1] of word;
-  SoundFile : PSndFile;
-  Info  : SF_INFO;
-  k, m, AudioDevice, readcount : Longint;
-  ScaleData : Boolean;
-
+var
+  Buffer: Array[0..BUFFERLEN-1] of word;
+  SoundFile: PSndFile;
+  Info: TSF_INFO;
+  k, m, AudioDevice, readcount: Longint;
+  ScaleData: Boolean;
 begin
   Writeln(SPlaying,FileName);
-  SoundFile:=sf_open_read(pChar(FileName),@Info);
+  SoundFile:=sf_open(pChar(FileName), SFM_READ, @Info);
   If (SoundFile=Nil) then
     begin
-    sf_perror(Nil);
-    exit;
+      sf_perror(Nil);
+      exit;
     end;
   If not (Info.Channels in [1,2]) then
     PlayError(SerrChannels);
   AudioDevice:=OpenDSPDevice(Info.channels, Info.samplerate);
-  ScaleData:=(Info.pcmbitwidth < 16);
+  ScaleData:=(Info.samplerate < 16);
   readcount:=sf_read_short(SoundFile,@Buffer,BUFFERLEN);
   While ReadCount<>0 do
     begin
-    If ScaleData then
-      For m:=0 to BufferLen-1 do
-        Buffer[m]:=buffer[m] * 256;
-    fdwrite (AudioDevice, buffer, readcount * sizeof (word)) ;
-    readcount:=sf_read_short(SoundFile,@Buffer,BUFFERLEN);
+      If ScaleData then
+        For m:=0 to BufferLen-1 do
+          Buffer[m]:=buffer[m] * 256;
+      FpWrite(AudioDevice, buffer, readcount * sizeof (word)) ;
+      readcount:=sf_read_short(SoundFile,@Buffer,BUFFERLEN);
     end;
   sf_close (Soundfile) ;
-  fdclose (AudioDevice) ;
+  FpClose(AudioDevice) ;
 end;
 
 Function OpenDSPDevice (channels,SampleRate : LongInt) : Longint;
-
 var
  fd, stereo, temp, error : longint ;
-
 begin
-  fd:=fdOpen('/dev/dsp',OPEN_WRONLY,0);
+  fd:=fpOpen('/dev/dsp',O_WRONLY,0);
   if fd<0 then
     PlayError(SErrOpeningDevice);
   Stereo:=0;
-  if Not ioctl(fd, SNDCTL_DSP_STEREO  , @stereo) then
+  if Not (FpIOCtl(fd, SNDCTL_DSP_STEREO  , @stereo) <> -1) then
     PlayError(SErrSettingStereo);
-  if Not ioctl (fd, SNDCTL_DSP_RESET, Nil) then
+  if Not (FpIOCtl(fd, SNDCTL_DSP_RESET, Nil) <> -1) then
     PlayError(SErrResettingDevice);
   temp := 16 ;
-  If not ioctl (fd, SOUND_PCM_WRITE_BITS, @temp) then
+  If not (FpIOCtl(fd, SOUND_PCM_WRITE_BITS, @temp) <> -1) then
     PlayError(SErrSetWriteBits);
-  If not  ioctl (fd, SOUND_PCM_WRITE_CHANNELS, @channels) then
+  If not (FpIOCtl(fd, SOUND_PCM_WRITE_CHANNELS, @channels) <> -1) then
     PlayError(SErrSetChannels);
-  If Not ioctl (fd, SOUND_PCM_WRITE_RATE, @SampleRate) then
+  If Not (FpIOCtl(fd, SOUND_PCM_WRITE_RATE, @SampleRate) <> -1) then
     PlayError(SErrSetSampleRate);
-  If not ioctl (fd, SNDCTL_DSP_SYNC, Nil) then
+  If not (FpIOCtl(fd, SNDCTL_DSP_SYNC, Nil) <> -1) then
     PlayError(SErrSetSyncMode);
   OpenDSPDevice:=Fd;
 end;
 
+
 Var
   I : Integer;
-
 begin
   For I:=1 to ParamCount do
     PlayFile(Paramstr(i));

+ 2 - 1
packages/sndfile/src/sndfile.pp

@@ -255,6 +255,7 @@ type
   TSF_INFO = record
                frames     : Tsf_count_t; // Used to be called samples.  Changed to avoid confusion.
                samplerate : ctypes.cint;
+               channels   : ctypes.cint;
                format     : ctypes.cint;
                sections   : ctypes.cint;
                seekable   : ctypes.cint;
@@ -409,7 +410,7 @@ type
 ** to sf_perror () or sf_error_str ().
 ** All calls to sf_open() should be matched with a call to sf_close().
 }
-function sf_open (path : ctypes.pcchar; mode : ctypes.cint; sfinfo : PSF_INFO) : PSNDFILE; cdecl;
+function sf_open (path : pChar; mode : ctypes.cint; sfinfo : PSF_INFO) : PSNDFILE; cdecl;
   external sndfilelib  name 'sf_open';
 
 {

+ 5 - 3
rtl/inc/lnfodwrf.pp

@@ -54,8 +54,8 @@ type
 
 const
   EBUF_SIZE = 100;
-  
-{$WARNING This code is not thread-safe, and needs improvement}  
+
+{$WARNING This code is not thread-safe, and needs improvement}
 var
   { the input file to read DWARF debug info from, i.e. paramstr(0) }
   e : TExeFile;
@@ -615,7 +615,9 @@ begin
         DEBUG_WRITELN('DW_LNS_ADVANCE_PC (', hexstr(state.address, sizeof(state.address)*2), ')');
       end;
       DW_LNS_ADVANCE_LINE : begin
-        inc(state.line, ReadLEB128());
+        // inc(state.line, ReadLEB128()); negative values are allowed
+        // but those may generate a range check error
+        state.line := state.line + ReadLEB128();
         DEBUG_WRITELN('DW_LNS_ADVANCE_LINE (', state.line, ')');
       end;
       DW_LNS_SET_FILE : begin

+ 3 - 3
rtl/linux/arm/cprt0.as

@@ -103,14 +103,14 @@ _haltproc:
         swi 0x900001
         b _haltproc
 
-	.globl  _haltproc_eabi
+        .globl  _haltproc_eabi
         .type   _haltproc_eabi,#function
 _haltproc_eabi:
         ldr r0,=operatingsystem_result
         ldrb r0,[r0]
         mov r7,#248
-	swi 0x0
-	b _haltproc_eabi
+        swi 0x0
+        b _haltproc_eabi
 
         /* Define a symbol for the first piece of initialized data.  */
         .data

+ 34 - 0
rtl/linux/arm/dllprt0.as

@@ -0,0 +1,34 @@
+.file   "androidprt0.as"
+.text
+
+        .globl  _haltproc
+        .type   _haltproc,#function
+_haltproc:
+        /* r0 contains exitcode */
+        swi 0x900001
+        b _haltproc
+
+        .globl  _haltproc_eabi
+        .type   _haltproc_eabi,#function
+_haltproc_eabi:
+        /* r0 contains exitcode */
+        mov r7,#248
+        swi 0x0
+        b _haltproc_eabi
+
+.data
+
+        .type operatingsystem_parameters,#object
+        .size operatingsystem_parameters,12
+operatingsystem_parameters:
+        .skip 3*4
+        .global operatingsystem_parameter_envp
+        .global operatingsystem_parameter_argc
+        .global operatingsystem_parameter_argv
+        .set operatingsystem_parameter_envp,operatingsystem_parameters+0
+        .set operatingsystem_parameter_argc,operatingsystem_parameters+4
+        .set operatingsystem_parameter_argv,operatingsystem_parameters+8
+
+.bss
+
+        .comm __stkptr,4

+ 1 - 1
rtl/objpas/rtlconst.inc

@@ -111,7 +111,7 @@ ResourceString
   SEmptyStreamIllegalWriter     = 'Illegal Nil stream for TWriter constructor';
   SErrindexTooLarge             = 'Bit index exceeds array limit: %d';
   SErrInvalidBitIndex           = 'Invalid bit index : %d';
-  SErrNoStreaming               = 'Failed to initialize component: No streaming method available.';
+  SErrNoStreaming               = 'Failed to initialize component class "%s": No streaming method available.';
   SErrNoVariantSupport          = 'No variant support for properties. Please use the variants unit in your project and recompile';
   SErrOutOfMemory               = 'Out of memory';
   SErrPropertyNotFound          = 'Unknown property: "%s"';