Example #1
0
 /// <summary>
 /// Creates a new <see cref="SQLiteConnection"/> object, opens it and executes the
 /// InitializationCommand via ExecuteNonQuery()
 /// </summary>
 /// <returns>Newly created and initialized <see cref="SQLiteConnection"/></returns>
 private SQLiteConnection CreateOpenAndInitializeConnection()
 {
   var connection = new SQLiteConnection(_connectionString);
   connection.Open();
   connection.SetChunkSize(_settings.ChunkSizeInMegabytes * 1024 * 1024);
   using (var command = new SQLiteCommand(_settings.InitializationCommand, connection))
     command.ExecuteNonQuery();
   return connection;
 }
Example #2
0
        private static IDbConnection GetDatabaseConnectionSDS(string cs)
        {
            var rv = new SQLiteConnection(cs);
              if (rv == null) {
            throw new ArgumentException("no connection");
              }
              rv.Open();

              try {
            rv.SetChunkSize(GROW_SIZE);
              }
              catch (Exception ex) {
            LogManager.GetLogger(typeof (Sqlite)).Error(
              "Failed to sqlite control", ex);
              }

              if (clearPool == null) {
            clearPool = conn =>
            {
              SQLiteConnection.ClearPool(
            conn as SQLiteConnection);
            };
              }
              return rv;
        }