private bool InitDatabase() { CloseDatabase(); bool result = false; try { _dbcon = new DBConComSqlite(DatabaseFilename); object o = _dbcon.ExecuteScalar("SELECT name FROM sqlite_master WHERE type='table' AND name='images'"); if (o == null || o.GetType() == typeof(DBNull)) { _dbcon.ExecuteNonQuery("create table 'images' (org_url text, gccode text, local_file text)"); _dbcon.ExecuteNonQuery("create index idx_images on images (org_url)"); } result = true; } catch { } return result; }
private void CloseDatabase() { if (_dbcon != null) { _dbcon.Dispose(); _dbcon = null; } }