Browse Source

sqliteds: * Create SQLList on demand

git-svn-id: trunk@15134 -
blikblum 15 years ago
parent
commit
7bad77aff8
1 changed files with 10 additions and 3 deletions
  1. 10 3
      packages/fcl-db/src/sqlite/customsqliteds.pas

+ 10 - 3
packages/fcl-db/src/sqlite/customsqliteds.pas

@@ -116,6 +116,7 @@ type
     FStoreDefs: Boolean;
     procedure CopyCacheToItem(AItem: PDataRecord);
     function GetIndexFields(Value: Integer): TField;
+    function GetSQLList: TStrings;
     procedure SetMasterIndexValue;
     procedure SetOptions(const AValue: TSqliteOptions);
     procedure UpdateCalcFieldList;
@@ -246,7 +247,7 @@ type
     property RowsAffected: Integer read GetRowsAffected;
     property ReturnCode: Integer read FReturnCode;
     property SqliteHandle: Pointer read FSqliteHandle;
-    property SQLList:TStrings read FSQLList;
+    property SQLList: TStrings read GetSQLList;
    published
     property AutoIncrementKey: Boolean read FAutoIncrementKey write FAutoIncrementKey default False;
     property IndexFieldNames: string read FIndexFieldNames write FIndexFieldNames;
@@ -467,7 +468,6 @@ begin
   FUpdatedItems := TFPList.Create;
   FAddedItems := TFPList.Create;
   FDeletedItems := TFPList.Create;
-  FSQLList := TStringList.Create;
   inherited Create(AOwner);
 end;
 
@@ -531,8 +531,8 @@ begin
   FAddedItems.Destroy;
   FDeletedItems.Destroy;
   FMasterLink.Destroy;
-  FSQLList.Destroy;
   //lists created on demand
+  FSQLList.Free;
   FIndexFieldList.Free;
   FCalcFieldList.Free;
   // dispose special items
@@ -601,6 +601,13 @@ begin
   Result := TField(FIndexFieldList[Value]);
 end;
 
+function TCustomSqliteDataset.GetSQLList: TStrings;
+begin
+  if FSQLList = nil then
+    FSQLList := TStringList.Create;
+  Result := FSQLList;
+end;
+
 procedure TCustomSqliteDataset.SetMasterIndexValue;
 var
   i: Integer;