public void Open() { if (this.State != ConnectionState.Open) { this.Base = new SQLiteBase(this._dataPath); this.State = ConnectionState.Open; } }
internal DataReader(IntPtr database, string query) { IntPtr ptr; this._columnValues = new ArrayList(); this._columnNames = new List <string>(); IntPtr ptr2 = Marshal.StringToHGlobalAnsi(query); SQLiteBase.sqlite3_prepare_v2(database, ptr2, query.Length, out this._statement, out ptr); Marshal.FreeHGlobal(ptr2); }
public bool Read() { if (SQLiteBase.sqlite3_step(this._statement) == 100) { int num3; int num2 = SQLiteBase.sqlite3_column_count(this._statement); SQLiteBase.SQLiteDataTypes types = (SQLiteBase.SQLiteDataTypes) 0; this._columnValues.Capacity = num2; this._columnValues.Clear(); if (this._isFirstRow) { this._columnNames.Capacity = num2; this._columnNames.Clear(); for (num3 = 0; num3 < num2; num3++) { this._columnNames.Add(Marshal.PtrToStringAnsi(SQLiteBase.sqlite3_column_name(this._statement, num3))); } this._isFirstRow = false; } for (num3 = 0; num3 < num2; num3++) { switch (SQLiteBase.sqlite3_column_type(this._statement, num3)) { case 1: this._columnValues.Add(SQLiteBase.sqlite3_column_int(this._statement, num3)); break; case 2: this._columnValues.Add(SQLiteBase.sqlite3_column_double(this._statement, num3)); break; case 3: this._columnValues.Add(Marshal.PtrToStringAnsi(SQLiteBase.sqlite3_column_text(this._statement, num3))); break; case 4: this._columnValues.Add(SQLiteBase.GetBlob(this._statement, num3)); break; default: this._columnValues[num3] = ""; break; } } return(true); } return(false); }
public void Close() { SQLiteBase.sqlite3_finalize(this._statement); }