diff options
author | b_krueger <b_krueger@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2009-07-18 13:36:34 +0000 |
---|---|---|
committer | b_krueger <b_krueger@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2009-07-18 13:36:34 +0000 |
commit | 1ce18fc38205cc21752579b3cb5dd4c083730ba2 (patch) | |
tree | 42b4089ab3d67aadb17cf8d5b4fa6ab86a4b5957 /src/lib/SQLite | |
parent | f755ee5aa3b6949d633cd3e157f3611be10595ff (diff) | |
download | usdx-1ce18fc38205cc21752579b3cb5dd4c083730ba2.tar.gz usdx-1ce18fc38205cc21752579b3cb5dd4c083730ba2.tar.xz usdx-1ce18fc38205cc21752579b3cb5dd4c083730ba2.zip |
some modifications on the DataBaseLoading
- now ALL databases in table "us_songs" gets the column "Rating"
- nicer Structure and some useful comments
-> should work now with all DB-loading-combinations!
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1851 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to 'src/lib/SQLite')
-rw-r--r-- | src/lib/SQLite/SQLiteTable3.pas | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/lib/SQLite/SQLiteTable3.pas b/src/lib/SQLite/SQLiteTable3.pas index 7df76363..3aed54a4 100644 --- a/src/lib/SQLite/SQLiteTable3.pas +++ b/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); |