/// <summary> /// Rolls back the active transaction. /// </summary> public override void Rollback() { CheckDisposed(); SQLiteConnection.Check(_cnn); IsValid(true); IssueRollback(true); }
internal static void Check(SQLiteCommand command) { if (command == null) { throw new ArgumentNullException("command"); } command.CheckDisposed(); SQLiteConnection.Check(command._cnn); }
/// <summary> /// Overrides the default behavior to return a SQLiteDataReader specialization class /// </summary> /// <param name="behavior">The flags to be associated with the reader.</param> /// <returns>A SQLiteDataReader</returns> public new SQLiteDataReader ExecuteReader(CommandBehavior behavior) { CheckDisposed(); SQLiteConnection.Check(_cnn); InitializeForReader(); SQLiteDataReader rd = new SQLiteDataReader(this, behavior); _activeReader = new WeakReference(rd, false); return(rd); }
/// <summary> /// Execute the command and return the first column of the first row of the resultset /// (if present), or null if no resultset was returned. /// </summary> /// <param name="behavior">The flags to be associated with the reader.</param> /// <returns>The first column of the first row of the first resultset from the query.</returns> public object ExecuteScalar( CommandBehavior behavior ) { CheckDisposed(); SQLiteConnection.Check(_cnn); using (SQLiteDataReader reader = ExecuteReader(behavior | CommandBehavior.SingleRow | CommandBehavior.SingleResult)) { if (reader.Read()) { return(reader[0]); } } return(null); }
/// <summary> /// Execute the command and return the number of rows inserted/updated affected by it. /// </summary> /// <param name="behavior">The flags to be associated with the reader.</param> /// <returns>The number of rows inserted/updated affected by it.</returns> public int ExecuteNonQuery( CommandBehavior behavior ) { CheckDisposed(); SQLiteConnection.Check(_cnn); using (SQLiteDataReader reader = ExecuteReader(behavior | CommandBehavior.SingleRow | CommandBehavior.SingleResult)) { while (reader.NextResult()) { ; } return(reader.RecordsAffected); } }
/////////////////////////////////////////////////////////////////////////////////////////////// /// <summary> /// Commits the current transaction. /// </summary> public override void Commit() { CheckDisposed(); SQLiteConnection.Check(_cnn); IsValid(true); if (_cnn._transactionLevel - 1 == 0) { using (SQLiteCommand cmd = _cnn.CreateCommand()) { cmd.CommandText = "COMMIT"; cmd.ExecuteNonQuery(); } } _cnn._transactionLevel--; _cnn = null; }
/// <summary> /// Does nothing. Commands are prepared as they are executed the first time, and kept in prepared state afterwards. /// </summary> public override void Prepare() { CheckDisposed(); SQLiteConnection.Check(_cnn); }
/// <summary> /// Execute the command and return the first column of the first row of the resultset /// (if present), or null if no resultset was returned. /// </summary> /// <returns>The first column of the first row of the first resultset from the query.</returns> public override object ExecuteScalar() { CheckDisposed(); SQLiteConnection.Check(_cnn); return(ExecuteScalar(CommandBehavior.Default)); }
/// <summary> /// Execute the command and return the number of rows inserted/updated affected by it. /// </summary> /// <returns>The number of rows inserted/updated affected by it.</returns> public override int ExecuteNonQuery() { CheckDisposed(); SQLiteConnection.Check(_cnn); return(ExecuteNonQuery(CommandBehavior.Default)); }
/// <summary> /// Overrides the default behavior of DbDataReader to return a specialized SQLiteDataReader class /// </summary> /// <returns>A SQLiteDataReader</returns> public new SQLiteDataReader ExecuteReader() { CheckDisposed(); SQLiteConnection.Check(_cnn); return(ExecuteReader(CommandBehavior.Default)); }