Exemple #1
0
        public static void Convert(string filename, string outFilename)
        {
            Trace.WriteLine("Opening " + filename);

            sqlite3 handle;

            SQLite3.Result result = SQLite3.Open(filename, out handle);

            try {
                if (result != SQLite3.Result.OK)
                {
                    string msg = SQLite3.GetErrmsg(handle);
                    throw new Exception(msg);
                }

                Trace.WriteLine("Opened");

                List <string> tableNames = new List <string>();
                var           writer     = new LiteWriter();

                GetTableNames(handle, tableNames);
                // build the table definitions, add the data
                CreateTables(handle, tableNames, writer);

                writer.Write(outFilename);
            } finally {
                if (handle != null)
                {
                    SQLite3.Close(handle);
                    handle = null;
                }
            }
        }
Exemple #2
0
 public void Dispose()
 {
     if (!disposed)
     {
         SQLite3.Close(db);
     }
 }
 public void Dispose()
 {
     if (_open)
     {
         SQLite3.Close(_db);
         _open = false;
     }
 }
 public void Close()
 {
     if (Opened && this.Handle != NullHandle)
     {
         try {
             if (Mappings != null)
             {
                 foreach (TableMapping sqlInsertCommand in Mappings.Values)
                 {
                     sqlInsertCommand.Dispose();
                 }
             }
             SQLite3.Result r = SQLite3.Close(this.Handle);
             if (r != SQLite3.Result.OK)
             {
                 string msg = SQLite3.GetErrmsg(this.Handle);
                 throw SQLiteException.New(r, msg);
             }
         } finally {
             this.Handle = NullHandle;
             Opened      = false;
         }
     }
 }
 private void Dispose(bool disposing)
 {
     if (Opened && NullHandle != Handle)
     {
         try {
             if (null != Mappings)
             {
                 foreach (var item in Mappings.Values)
                 {
                     item.Dispose();
                 }
             }
             SQLite3.Result r = SQLite3.Close(Handle);
             if (r != SQLite3.Result.OK)
             {
                 string msg = SQLite3.GetErrmsg(Handle);
                 throw SQLiteException.New(r, msg);
             }
         } finally {
             Handle = NullHandle;
             Opened = false;
         }
     }
 }