Inheritance: SQLite.SQLiteConnection
Esempio n. 1
0
        public static WorkspaceDB Create(LocalDB localDB, string fullPath)
        {
            WorkspaceDB ws = new WorkspaceDB(fullPath, SQLite.SQLiteOpenFlags.Create | SQLite.SQLiteOpenFlags.ReadWrite | SQLite.SQLiteOpenFlags.NoMutex, localDB);

            ws.BeginTransaction();
            try
            {
                Objects.FormatInfo formatInfo = new FormatInfo();
                formatInfo.InternalFormat = InternalDBVersion;
                ws.InsertSafe(formatInfo);
                ws.Commit();
                return(ws);
            }
            catch (Exception e)
            {
                ws.Rollback();
                ws.Dispose();
                if (System.IO.File.Exists(fullPath))
                {
                    System.IO.File.Delete(fullPath);
                }
                throw new Exception("Couldn't create database!", e);
            }
        }
Esempio n. 2
0
 public static WorkspaceDB Create(LocalDB localDB, string fullPath)
 {
     WorkspaceDB ws = new WorkspaceDB(fullPath, SQLite.SQLiteOpenFlags.Create | SQLite.SQLiteOpenFlags.ReadWrite | SQLite.SQLiteOpenFlags.NoMutex, localDB);
     ws.BeginTransaction();
     try
     {
         Objects.FormatInfo formatInfo = new FormatInfo();
         formatInfo.InternalFormat = InternalDBVersion;
         ws.InsertSafe(formatInfo);
         ws.Commit();
         return ws;
     }
     catch (Exception e)
     {
         ws.Rollback();
         ws.Dispose();
         if (System.IO.File.Exists(fullPath))
             System.IO.File.Delete(fullPath);
         throw new Exception("Couldn't create database!", e);
     }
 }