本文整理汇总了C#中System.Data.SQLite.SQLiteConnection.ExecuteQuery方法的典型用法代码示例。如果您正苦于以下问题:C# SQLiteConnection.ExecuteQuery方法的具体用法?C# SQLiteConnection.ExecuteQuery怎么用?C# SQLiteConnection.ExecuteQuery使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Data.SQLite.SQLiteConnection
的用法示例。
在下文中一共展示了SQLiteConnection.ExecuteQuery方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateFile
public static System.Data.IDbConnection CreateFile (string path)
{
lock (mutex)
if (newSession == null)
{
Configuration configuration = new Configuration()
.SetProperty("dialect", typeof(CustomSQLiteDialect).AssemblyQualifiedName)
.SetProperty("connection.connection_string", "Data Source=:memory:;Version=3;")
.SetProperty("connection.driver_class", typeof(NHibernate.Driver.SQLite20Driver).AssemblyQualifiedName)
.SetProperty("connection.provider", typeof(NHibernate.Connection.DriverConnectionProvider).AssemblyQualifiedName)
.SetProperty("connection.release_mode", "on_close")
;
ConfigureMappings(configuration);
var sessionFactory = configuration.BuildSessionFactory();
newSession = sessionFactory.OpenStatelessSession();
createSql = configuration.GenerateSchemaCreationScript(Dialect.GetDialect(configuration.Properties));
}
string uncCompatiblePath = Util.GetSQLiteUncCompatiblePath(path);
bool pooling = false;// path == ":memory:";
var conn = new SQLiteConnection(String.Format("Data Source={0};Version=3;{1}", uncCompatiblePath, (pooling ? "Pooling=True;Max Pool Size=1;" : "")));
conn.Open();
var journal_mode = conn.ExecuteQuery("PRAGMA journal_mode").Single()[0];
var synchronous = conn.ExecuteQuery("PRAGMA synchronous").Single()[0];
conn.ExecuteNonQuery(@"PRAGMA journal_mode=OFF;
PRAGMA synchronous=OFF;
PRAGMA automatic_indexing=OFF;
PRAGMA cache_size=30000;
PRAGMA temp_store=MEMORY;
PRAGMA page_size=32768;
PRAGMA mmap_size=70368744177664; -- 2^46");
var transaction = conn.BeginTransaction();
var cmd = conn.CreateCommand();
foreach (string sql in createSql)
cmd.ExecuteNonQuery(sql);
cmd.ExecuteNonQuery(String.Format("INSERT INTO About VALUES (1, 'IDPicker', '{0}', datetime('now'), {1})",
Util.Version, SchemaUpdater.CurrentSchemaRevision));
cmd.ExecuteNonQuery(@"CREATE TABLE PeptideSpectrumMatchScoreName (Id INTEGER PRIMARY KEY, Name TEXT UNIQUE NOT NULL);
CREATE TABLE DistinctMatchQuantitation (Id TEXT PRIMARY KEY, iTRAQ_ReporterIonIntensities BLOB, TMT_ReporterIonIntensities BLOB, PrecursorIonIntensity NUMERIC);
CREATE TABLE IntegerSet (Value INTEGER PRIMARY KEY);");
CreateIndexes(conn);
transaction.Commit();
conn.ExecuteNonQuery("PRAGMA journal_mode=" + journal_mode + ";" +
"PRAGMA synchronous=" + synchronous);
return conn;
}