本文整理汇总了C#中SqliteCommand.Dispose方法的典型用法代码示例。如果您正苦于以下问题:C# SqliteCommand.Dispose方法的具体用法?C# SqliteCommand.Dispose怎么用?C# SqliteCommand.Dispose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SqliteCommand
的用法示例。
在下文中一共展示了SqliteCommand.Dispose方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CloseCommand
protected void CloseCommand(SqliteCommand cmd)
{
cmd.Connection.Close();
cmd.Connection.Dispose();
cmd.Dispose();
}
示例2: InsertWithOnConflict
public override long InsertWithOnConflict (String table, String nullColumnHack, ContentValues initialValues, ConflictResolutionStrategy conflictResolutionStrategy)
{
if (!String.IsNullOrWhiteSpace(nullColumnHack)) {
var e = new InvalidOperationException("{0} does not support the 'nullColumnHack'.".Fmt(Tag));
Log.E(Tag, "Unsupported use of nullColumnHack", e);
throw e;
}
var command = GetInsertCommand(table, initialValues, conflictResolutionStrategy);
var lastInsertedId = -1L;
try {
command.ExecuteNonQuery();
// Get the new row's id.
// TODO.ZJG: This query should ultimately be replaced with a call to sqlite3_last_insert_rowid.
var lastInsertedIndexCommand = new SqliteCommand("select last_insert_rowid()", Connection, currentTransaction);
lastInsertedId = (Int64)lastInsertedIndexCommand.ExecuteScalar();
lastInsertedIndexCommand.Dispose();
if (lastInsertedId == -1L) {
Log.E(Tag, "Error inserting " + initialValues + " using " + command.CommandText);
} else {
Log.V(Tag, "Inserting row " + lastInsertedId + " from " + initialValues + " using " + command.CommandText);
}
} catch (Exception ex) {
Log.E(Tag, "Error inserting into table " + table, ex);
} finally {
command.Dispose();
}
return lastInsertedId;
}
示例3: CheckToken
public bool CheckToken(UUID principalID, string token, int lifetime)
{
if (System.Environment.TickCount - m_LastExpire > 30000)
DoExpire();
SqliteCommand cmd = new SqliteCommand("update tokens set validity = datetime('now', 'localtime', '+" + lifetime.ToString() +
" minutes') where UUID = '" + principalID.ToString() + "' and token = '" + token + "' and validity > datetime('now', 'localtime')");
if (ExecuteNonQuery(cmd, m_Connection) > 0)
{
cmd.Dispose();
return true;
}
cmd.Dispose();
return false;
}
示例4: DoExpire
private void DoExpire()
{
SqliteCommand cmd = new SqliteCommand("delete from tokens where validity < datetime('now', 'localtime')");
ExecuteNonQuery(cmd, m_Connection);
cmd.Dispose();
m_LastExpire = System.Environment.TickCount;
}
示例5: SetToken
public bool SetToken(UUID principalID, string token, int lifetime)
{
if (System.Environment.TickCount - m_LastExpire > 30000)
DoExpire();
SqliteCommand cmd = new SqliteCommand("insert into tokens (UUID, token, validity) values ('" + principalID.ToString() +
"', '" + token + "', datetime('now', 'localtime', '+" + lifetime.ToString() + " minutes'))");
if (ExecuteNonQuery(cmd, m_Connection) > 0)
{
cmd.Dispose();
return true;
}
cmd.Dispose();
return false;
}