public override int ExecuteNonQuery() { Prepare(); try { if (_plan == null) { _plan = _connection.ServerProcess.PrepareStatement(PreparedCommandText, _dAERuntimeParams); } } catch (Exception AException) { throw new Exception(String.Format("Error preparing statement {0}. Details ({1})", PreparedCommandText, ExceptionUtility.BriefDescription(AException)), AException); } try { ((IServerStatementPlan)_plan).Execute(_dAERuntimeParams); } catch (Exception AException) { throw new Exception(String.Format("Error Executing statement {0}. Details ({1})", PreparedCommandText, ExceptionUtility.BriefDescription(AException)), AException); } _parameters.UpdateParams(_dAERuntimeParams); return(0); // Return 0 because Dataphor doesn't report modified rows }
public void Unprepare(IServerPlan plan) { if (plan is IServerExpressionPlan) { UnprepareExpression((IServerExpressionPlan)plan); } else { UnprepareStatement((IServerStatementPlan)plan); } }
protected override DbDataReader ExecuteDbDataReader(CommandBehavior behavior) { //This if statement fixes a problem in DbDataAdapter Update abstraction. //The ExecuteReader method calls ExecuteNonQuery if the the DAEDataAdapter is performing an Update. //It also returns a special DataReader where RecordsAffected is 1. //This satisfies the DbDataAdapter.Update abstraction requirements. //Without this if statement there is a lot of code to reproduce. //To remove this if statement, override DbDataAdapter.Update(DataRow[] ADataRows, DataTableMapping ATableMapping). if (_dataAdapterInUpdate) { ExecuteNonQuery(); return(new DAEDataReader(this)); } Prepare(); _behavior = behavior; if (_plan == null) { _plan = _connection.ServerProcess.PrepareExpression(PreparedCommandText, _dAERuntimeParams); } try { IServerCursor cursor = ((IServerExpressionPlan)_plan).Open(_dAERuntimeParams); try { _parameters.UpdateParams(_dAERuntimeParams); return(new DAEDataReader(cursor, this)); } catch { ((IServerExpressionPlan)_plan).Close(cursor); throw; } } catch { if (_plan != null) { _connection.ServerProcess.UnprepareExpression((IServerExpressionPlan)_plan); } throw; } }
public void UnPrepare() { _preparedCommandText = String.Empty; _dAERuntimeParams = null; if (_plan != null) { IServerProcess planProcess = _plan.Process; if (planProcess != null) { if (_plan is IServerExpressionPlan) { planProcess.UnprepareExpression((IServerExpressionPlan)_plan); } else { planProcess.UnprepareStatement((IServerStatementPlan)_plan); } } _plan = null; } }