Пример #1
0
 private void CloseDatabase()
 {
     if (_dbcon != null)
     {
         _dbcon.Dispose();
         _dbcon = null;
     }
 }
Пример #2
0
 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)");
             _dbcon.ExecuteNonQuery("create index idx_gccodes on images (gcode)");
         }
         result = true;
     }
     catch(Exception e)
     {
         Core.ApplicationData.Instance.Logger.AddLog(this, e);
     }
     return result;
 }