本文整理汇总了C#中System.Data.SQLite.SQLiteTransaction类的典型用法代码示例。如果您正苦于以下问题:C# SQLiteTransaction类的具体用法?C# SQLiteTransaction怎么用?C# SQLiteTransaction使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SQLiteTransaction类属于System.Data.SQLite命名空间,在下文中一共展示了SQLiteTransaction类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Transaction
public Transaction(SQLiteTransaction transaction)
{
if (_base == null)
throw new ArgumentNullException("transaction");
_base = transaction;
}
示例2: CreateAddProductCommand
public SQLiteCommand CreateAddProductCommand(SQLiteConnection conn, SQLiteTransaction transaction)
{
var cmd = new SQLiteCommand(_sql, conn, transaction);
CreateParameters(cmd);
return cmd;
}
示例3: PrepareCommand
internal static void PrepareCommand(SQLiteCommand command, SQLiteConnection connection, SQLiteTransaction transaction,
CommandType commandType, string commandText, SQLiteParameter[] commandParameters,
out bool mustCloseConnection)
{
if (command == null) throw new ArgumentNullException("command");
if (string.IsNullOrEmpty(commandText)) throw new ArgumentNullException("commandText");
if (connection.State == ConnectionState.Open)
mustCloseConnection = false;
else
{
mustCloseConnection = true;
connection.Open();
}
command.Connection = connection;
command.CommandText = commandText;
if (transaction != null)
{
if (transaction.Connection == null)
throw new ArgumentException(
"The transaction was rollbacked or commited, please provide an open transaction.", "transaction");
command.Transaction = transaction;
}
command.CommandType = commandType;
if (commandParameters != null)
AttachParameters(command, commandParameters);
return;
}
示例4: SQLiteTransaction
public SQLiteTransaction(SQLiteDatabase database, IsolationLevel level, SQLiteSettings settings)
{
_database = database;
_settings = settings;
_connection = _database.ConnectionPool.GetConnection();
_transaction = _connection.BeginTransaction(level);
}
示例5: GetCommandOnCurrentConnect
public SQLiteCommand GetCommandOnCurrentConnect(String commandText, out SQLiteTransaction sqLiteTransaction){
var connection = GetCurrentConnection();
sqLiteTransaction = connection.BeginTransaction();
return new SQLiteCommand(commandText, connection, sqLiteTransaction);
}
示例6: ExecuteNonQuery
protected long ExecuteNonQuery(
string sql,
IEnumerable<SQLiteParameter> parameters,
SQLiteTransaction transaction = null
)
{
long iRows = 0L;
this.Logger.DebugFormat("Datasource:'{0}';sql:'{1}'",
this.Connection.DataSource,
sql
);
using (SQLiteCommand command = this.GetCommand(sql, transaction))
{
if (parameters != null)
{
foreach (SQLiteParameter parameter in parameters)
{
command.Parameters.Add(parameter);
}
}
iRows = command.ExecuteNonQuery();
}
// this.Logger.DebugFormat("ExecuteNonQuery:ExecuteNonQuery:sql:'{0}';rows:'{1}'",
// sql,
// iRows
// );
return iRows;
}
示例7: SQLiteCommand
public SQLiteCommand(string commandText, SQLiteConnection connection, SQLiteTransaction transaction)
{
CommandText = commandText;
DbConnection = connection;
DbTransaction = transaction;
m_parameterCollection = new SQLiteParameterCollection();
}
示例8: GetCommand
private SQLiteCommand GetCommand(string sql, SQLiteTransaction transaction)
{
return new SQLiteCommand(
sql,
this.Connection,
transaction
);
}
示例9: SetCommandConstraints
public void SetCommandConstraints(
string clause,
IEnumerable<SQLiteParameter> parameters,
SQLiteTransaction transaction = null
)
{
this._clause = clause;
this._parameters = parameters;
this._transaction = transaction;
}
示例10: SQLiteMonTransaction
public SQLiteMonTransaction(SQLiteTransaction transaction)
{
this.wrappedTrans = transaction;
StackTrace trace = new StackTrace(true);
lock (readerInfoLock)
{
readerInfo.Add(this.wrappedTrans, trace.ToString());
}
}
示例11: Persist
/// <summary>
/// Takes a GIS model and a file and writes the model to that file.
/// </summary>
/// <param name="model">
/// The GisModel which is to be persisted.
/// </param>
/// <param name="fileName">
/// The name of the file in which the model is to be persisted.
/// </param>
public void Persist(GisModel model, string fileName)
{
Initialize(model);
PatternedPredicate[] predicates = GetPredicates();
if ( File.Exists(fileName))
{
File.Delete(fileName);
}
using (mDataConnection = new SQLiteConnection("Data Source=" + fileName + ";New=True;Compress=False;Synchronous=Off;UTF8Encoding=True;Version=3"))
{
mDataConnection.Open();
mDataCommand = mDataConnection.CreateCommand();
CreateDataStructures();
using (mDataTransaction = mDataConnection.BeginTransaction())
{
mDataCommand.Transaction = mDataTransaction;
CreateModel(model.CorrectionConstant, model.CorrectionParameter);
InsertOutcomes(model.GetOutcomeNames());
InsertPredicates(predicates);
InsertPredicateParameters(model.GetOutcomePatterns(), predicates);
mDataTransaction.Commit();
}
mDataConnection.Close();
}
}
示例12: open
public void open()
{
SetConnection();
sql_con.Open();
_sqLiteTransaction = sql_con.BeginTransaction();
sql_cmd = sql_con.CreateCommand();
}
示例13: CommitTransaction
public void CommitTransaction()
{
globalTransaction.Commit();
globalTransaction.Dispose();
globalTransaction = null;
Close();
}
示例14: SQLiteEnlistment
internal SQLiteEnlistment(SQLiteConnection cnn, Transaction scope)
{
_transaction = cnn.BeginTransaction();
_scope = scope;
_scope.EnlistVolatile(this, System.Transactions.EnlistmentOptions.None);
}
示例15: Dispose
///////////////////////////////////////////////////////////////////////////////////////////////
private /* protected virtual */ void Dispose(bool disposing)
{
if (!disposed)
{
if (disposing)
{
////////////////////////////////////
// dispose managed resources here...
////////////////////////////////////
if (_transaction != null)
{
_transaction.Dispose();
_transaction = null;
}
if (_scope != null)
{
// _scope.Dispose(); // NOTE: Not "owned" by us.
_scope = null;
}
}
//////////////////////////////////////
// release unmanaged resources here...
//////////////////////////////////////
disposed = true;
}
}