예제 #1
0
 public void StoreShapeFileItems(List <ShapefileItem> items)
 {
     lock (this)
     {
         if (_dbcon != null)
         {
             using (var db = new NPoco.Database(_dbcon.Connection, NPoco.DatabaseType.SQLite))
             {
                 db.BeginTransaction();
                 try
                 {
                     db.Execute("delete from ShapeFileItemV2");
                     foreach (var s in items)
                     {
                         db.Insert("ShapeFileItemV2", null, s);
                     }
                     db.CompleteTransaction();
                 }
                 catch
                 {
                     db.AbortTransaction();
                 }
             }
         }
     }
 }
예제 #2
0
 public void DeleteScriptItem(string name)
 {
     lock (this)
     {
         if (_dbcon != null)
         {
             using (var db = new NPoco.Database(_dbcon.Connection, NPoco.DatabaseType.SQLite))
             {
                 db.Execute("delete from Scripts where Name=@0", name);
             }
         }
     }
 }
예제 #3
0
 public void DeleteGeocacheCollectionItem(int colid, string code)
 {
     lock (this)
     {
         if (_dbcon != null)
         {
             using (var db = new NPoco.Database(_dbcon.Connection, NPoco.DatabaseType.SQLite))
             {
                 db.Execute("delete from GeocacheCollectionItem where CollectionID = @0 and GeocacheCode = @1", colid, code);
             }
         }
     }
 }
예제 #4
0
 public void DeleteGeocacheCollection(int id)
 {
     lock (this)
     {
         if (_dbcon != null)
         {
             using (var db = new NPoco.Database(_dbcon.Connection, NPoco.DatabaseType.SQLite))
             {
                 db.Execute("delete from GeocacheCollection where CollectionID = @0", id);
             }
         }
     }
 }
예제 #5
0
        public static void ClearTables(NPoco.Database db)
        {
            db.Execute("DELETE FROM persons");
            db.Execute("UPDATE SQLITE_SEQUENCE SET SEQ=0 WHERE NAME='persons'");

            db.Execute("DELETE FROM marriages");
            db.Execute("UPDATE SQLITE_SEQUENCE SET SEQ=0 WHERE NAME='marriages'");

            db.Execute("DELETE FROM marriage_sons");
            db.Execute("UPDATE SQLITE_SEQUENCE SET SEQ=0 WHERE NAME='marriage_sons'");
        }
예제 #6
0
 public int Execute([JetBrains.Annotations.NotNull] string sql)
 {
     lock (Dblock) {
         return(_database.Execute(sql));
     }
 }