aboutsummaryrefslogtreecommitdiffstats
path: root/Lua/src/lib/SQLite
diff options
context:
space:
mode:
authorwhiteshark0 <whiteshark0@b956fd51-792f-4845-bead-9b4dfca2ff2c>2009-12-11 17:34:54 +0000
committerwhiteshark0 <whiteshark0@b956fd51-792f-4845-bead-9b4dfca2ff2c>2009-12-11 17:34:54 +0000
commit1ab628e8ad6c85c8f1b562f10480253ee3e622b7 (patch)
treed21621f68850ecd7762137e1c4387fa15731a811 /Lua/src/lib/SQLite
parent6ec275387c320d3d9a8f5b6fe185687643565b8c (diff)
downloadusdx-1ab628e8ad6c85c8f1b562f10480253ee3e622b7.tar.gz
usdx-1ab628e8ad6c85c8f1b562f10480253ee3e622b7.tar.xz
usdx-1ab628e8ad6c85c8f1b562f10480253ee3e622b7.zip
merged trunk into lua branch
plugin loading is disabled atm because of a bug reading the files (lua may be the reason). Reading the files in usdx and passing the contents to lua may solve this git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/branches/experimental@2019 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to 'Lua/src/lib/SQLite')
-rw-r--r--Lua/src/lib/SQLite/SQLite3.pas2
-rw-r--r--Lua/src/lib/SQLite/SQLiteTable3.pas21
2 files changed, 22 insertions, 1 deletions
diff --git a/Lua/src/lib/SQLite/SQLite3.pas b/Lua/src/lib/SQLite/SQLite3.pas
index 9537606c..7b7207c4 100644
--- a/Lua/src/lib/SQLite/SQLite3.pas
+++ b/Lua/src/lib/SQLite/SQLite3.pas
@@ -10,7 +10,7 @@ unit SQLite3;
{$IFDEF FPC}
{$MODE DELPHI}
- {$H+} (* use AnsiString *)
+ {$H+} (* use long strings *)
{$PACKENUM 4} (* use 4-byte enums *)
{$PACKRECORDS C} (* C/C++-compatible record packing *)
{$ELSE}
diff --git a/Lua/src/lib/SQLite/SQLiteTable3.pas b/Lua/src/lib/SQLite/SQLiteTable3.pas
index 7df76363..3aed54a4 100644
--- a/Lua/src/lib/SQLite/SQLiteTable3.pas
+++ b/Lua/src/lib/SQLite/SQLiteTable3.pas
@@ -139,6 +139,7 @@ type
procedure Commit;
procedure Rollback;
function TableExists(TableName: string): boolean;
+ function ContainsColumn(Table: String; Column: String) : boolean;
function GetLastInsertRowID: int64;
function GetLastChangedRows: int64;
procedure SetTimeout(Value: integer);
@@ -759,6 +760,26 @@ begin
end;
end;
+function TSQLiteDatabase.ContainsColumn(Table: String; Column: String) : boolean;
+var
+ sql: string;
+ ds: TSqliteTable;
+ i : integer;
+begin
+ sql := 'PRAGMA TABLE_INFO('+Table+');';
+ ds := self.GetTable(sql);
+ try
+ Result := false;
+ while (ds.Next() and not Result and not ds.EOF) do
+ begin
+ if ds.FieldAsString(1) = Column then
+ Result := true;
+ end;
+ finally
+ ds.Free;
+ end;
+end;
+
procedure TSQLiteDatabase.SetTimeout(Value: integer);
begin
SQLite3_BusyTimeout(self.fDB, Value);