Ejemplo n.º 1
0
        public SimpleDBLayer(string dbPath, bool useWall)
        {
#if USE_SQLITE
            string journalMode = "";
            if (useWall)
            {
                journalMode = " Journal Mode=WAL;";
            }

            string connectionString = String.Format("Data Source={0}; Version=3;{1}", dbPath, journalMode);

#if !USE_SQLITE_MANAGED
            try {
                if (!File.Exists(dbPath))
                {
                    SQLiteConnection.CreateFile(dbPath);
                }
            } catch (IOException ex) {
                throw new SimpleDBLayerException(ex.Message);
            }
#endif // !USE_SQLITE_MANAGED

            this.database = new SQLiteConnection(connectionString);
            this.database.Open();
#endif // USE_SQLITE_MANAGED, USE_SQLITE
        }