public Result PrepareStatement() { this._resultOut = Result.NewPrepareStatementRequest(); this._resultOut.SetMainString(this._sqlStatement); this._resultOut.SetPrepareOrExecuteProperties(this._sqlStatement, 0, 0, 0, this.queryTimeout, ResultProperties.DefaultPropsValue, this._command.FetchGeneratedResults ? 1 : 2, null, null); Result r = this._command.Connection.InnerConnection.SessionProxy.Execute(this._resultOut); if (r.IsError()) { UtlException.ThrowError(r); } try { this._statementId = r.GetStatementId(); this._pmdDescriptor = r.ParameterMetaData; this._parameterTypes = this._pmdDescriptor.GetParameterTypes(); this._parameterValues = new object[this._parameterTypes.Length]; this._streamLengths = new long[this._parameterTypes.Length]; this._parameterModes = this._pmdDescriptor.ParamModes; this._parameterNames = this._pmdDescriptor.ColumnLabels; this._isNamedParameters = this._pmdDescriptor.IsNamedParameters; } catch (Exception exception) { throw Error.GetError(0x1ca, exception.ToString()); } this._resultOut = Result.NewPreparedExecuteRequest(this._parameterTypes, this._statementId); this._resultOut.SetStatement(r.GetStatement()); return(r); }
public Result Execute(int maxrows, int fetchsize, bool updatable) { Result rResult = null; Result r = Result.NewExecuteDirectRequest(); try { r.SetPrepareOrExecuteProperties(this._sqlStatement, maxrows, fetchsize, this.statementReturnType, this.queryTimeout, ResultProperties.DefaultPropsValue, this._command.FetchGeneratedResults ? 1 : 2, null, null); if (updatable) { r.SetDataResultProperties(maxrows, fetchsize, 0x3eb, 0x3f0, 1); } rResult = this._command.Connection.InnerConnection.SessionProxy.Execute(r); } catch (CoreException exception1) { throw UtlException.GetException(exception1); } finally { this.PerformPostExecute(rResult); r.ClearLobResults(); } if (rResult.IsError()) { UtlException.ThrowError(rResult); } return(rResult); }
public override bool NextResult() { this.CheckClosed(); if (this._readingState == -1) { this.FetchResult(); this._rResult = this._resultIn; } else { if (this._resultIn == null) { return(false); } if ((this._rResult == this._resultIn) && (this._generatedResult != null)) { this._rResult = this._generatedResult; } else { if ((this._resultSets == null) || (this._resultSets.Count == 0)) { return(false); } Result result = this._resultSets.Dequeue(); this._bInit = false; this._rResult = result; } } if (this._rResult.IsUpdateCount()) { if (this._iUpdateCount == -1) { this._iUpdateCount = 0; } this._iUpdateCount += this._rResult.GetUpdateCount(); this._readingState = 2; return(this.NextResult()); } if (this._rResult.IsError()) { this._readingState = 2; UtlException.ThrowError(this._rResult); } else if (this._rResult.IsData()) { this._iColumnCount = this._rResult.MetaData.GetColumnCount(); this._readingState = 0; } else { this._readingState = 2; } return(true); }
public void ReleaseSavePoint(string savePoint) { try { this.Conn.InnerConnection.SessionProxy.ReleaseSavepoint(savePoint); } catch (CoreException exception1) { UtlException.ThrowError(exception1); } }
public void RollbackToSavePoint(string savePoint) { this.IsValid(true); try { this.Conn.InnerConnection.SessionProxy.RollbackToSavepoint(savePoint); } catch (CoreException exception1) { UtlException.ThrowError(exception1); } }
public void CreateSavePoint(string savePoint) { if (string.IsNullOrEmpty(savePoint)) { throw new ArgumentException("Required argumet missing : SavePoint"); } this.IsValid(true); try { this.Conn.InnerConnection.SessionProxy.Savepoint(savePoint); } catch (CoreException exception1) { UtlException.ThrowError(exception1); } }
public override void Commit() { this.IsValid(true); UtlConnection conn = Interlocked.Exchange <UtlConnection>(ref this.Conn, null); try { conn.InnerConnection.SessionProxy.Commit(true); } catch (CoreException exception1) { UtlException.ThrowError(exception1); } finally { this.RestoreAutoCommit(conn); } this.IsCompleted = true; }
private object GetColumnInType(int columnIndex, SqlType targetType) { this.CheckClosed(); this.CheckValidRow(); SqlType otherType = this._rResult.MetaData.ColumnTypes[columnIndex]; object a = this._nCurrent.GetCurrent()[columnIndex]; if (a == null) { return(null); } if (targetType.TypeCode == 0x6b) { return(new MonthSpan((int)((IntervalMonthData)a).Units)); } if (targetType.TypeCode == 110) { IntervalSecondData data = (IntervalSecondData)a; return(new TimeSpan((data.Units * 0x989680L) + (data.Nanos / 100))); } if (otherType.TypeCode != targetType.TypeCode) { try { a = targetType.ConvertToTypeAdo(this._command.Connection.InnerConnection.SessionProxy, a, otherType); } catch (Exception) { try { return(otherType.ConvertToTypeAdo(this._command.Connection.InnerConnection.SessionProxy, a, targetType)); } catch (Exception) { } object[] objArray1 = new object[] { "from SQL type ", otherType.GetNameString(), " to ", targetType.GetCSharpClassName(), ", value: ", a }; string add = string.Concat(objArray1); UtlException.ThrowError(Error.GetError(0x15b9, add)); } return(a); } return(a); }
public Result Execute(UtlParameterCollection parameters, int maxrows, int fetchsize, bool updatable) { Result resultIn = null; this.BindParameters(this._command.Parameters, this._isNamedParameters); this.PerformPreExecute(); try { this._resultOut.ParameterMetaData = this._pmdDescriptor; if (this._command.CommandType == CommandType.StoredProcedure) { this._resultOut.SetPreparedResultUpdateProperties(this._parameterValues); } else { this._resultOut.SetPreparedExecuteProperties(this._parameterValues, maxrows, fetchsize, ResultProperties.DefaultPropsValue); } if (updatable) { this._resultOut.SetDataResultProperties(maxrows, fetchsize, 0x3eb, 0x3f0, 1); } resultIn = this._command.Connection.InnerConnection.SessionProxy.Execute(this._resultOut); if (resultIn.GetResultType() == 0x2b) { this.SetOutParameterValues(resultIn); } this.SetReturnParameterValue(resultIn); } catch (CoreException exception1) { throw UtlException.GetException(exception1); } finally { this.PerformPostExecute(resultIn); this._resultOut.ClearLobResults(); } if (resultIn.IsError()) { UtlException.ThrowError(resultIn); } return(resultIn); }
public void IssueRollback() { UtlConnection conn = Interlocked.Exchange <UtlConnection>(ref this.Conn, null); if (conn != null) { try { conn.InnerConnection.SessionProxy.Rollback(true); } catch (CoreException exception1) { UtlException.ThrowError(exception1); } finally { this.RestoreAutoCommit(conn); } } }
private void SetParameter(int i, UtlParameter param) { object o = param.Value; if ((o == null) || (o == DBNull.Value)) { this._parameterValues[i] = null; return; } ISessionInterface sessionProxy = this._command.Connection.InnerConnection.SessionProxy; SqlType type = this._parameterTypes[i]; int typeCode = type.TypeCode; if (typeCode <= 30) { if (typeCode > 0x15) { switch (typeCode) { case 0x19: case 30: goto Label_028B; } this._parameterValues[i] = o; return; } switch (typeCode) { case 0x15: { DataTable dataTable = o as DataTable; if (dataTable != null) { dataTable.TableName = this._parameterNames[i]; if (!((TableType)this._parameterTypes[i]).IsCompatible(dataTable)) { goto Label_0379; } goto Label_03AF; } DbDataReader reader = o as DbDataReader; if (reader == null) { goto Label_03AF; } dataTable = new DataTable(this._parameterNames[i]); UtlMetaData.PopulateDataTable(dataTable, reader); if (((TableType)this._parameterTypes[i]).IsCompatible(dataTable)) { o = dataTable; goto Label_03AF; } goto Label_0379; } } } else { if (typeCode <= 0x3d) { if (typeCode == 40) { this._parameterValues[i] = o; return; } if ((typeCode - 60) > 1) { goto Label_028B; } byte[] data = o as byte[]; if (data != null) { o = new BinaryData(data, !this._command.Connection.IsNetConnection); } else { try { if (o is string) { o = type.ConvertToDefaultType(sessionProxy, o); goto Label_03AF; } } catch (CoreException exception1) { UtlException.ThrowError(exception1); } UtlException.ThrowError(Error.GetError(0x15bd)); } goto Label_03AF; } switch (typeCode) { case 0x5b: case 0x5c: case 0x5d: case 0x5e: case 0x5f: try { if (((param.UtlType == UtlType.Null) && (o is string)) || (((param.UtlType == UtlType.VarChar) || (param.UtlType == UtlType.Char)) || (param.UtlType == UtlType.VarCharIngnoreCase))) { o = type.ConvertToType(sessionProxy, o, SqlType.SqlVarchar); } else { o = type.ConvertCSharpToSQL(sessionProxy, o); } } catch (CoreException exception2) { UtlException.ThrowError(exception2); } goto Label_03AF; case 0x65: case 0x66: case 0x6b: { MonthSpan span = (MonthSpan)o; o = new IntervalMonthData((long)span.TotalMonths); goto Label_03AF; } case 0x67: case 0x68: case 0x69: case 0x6a: case 0x6c: case 0x6d: case 110: case 0x6f: case 0x70: case 0x71: { TimeSpan span2 = (TimeSpan)o; long totalSeconds = (long)span2.TotalSeconds; int nanos = (int)((span2.TotalSeconds - totalSeconds) * 1000000000.0); o = new IntervalSecondData(totalSeconds, nanos); goto Label_03AF; } case 0x457: try { if (o.GetType().IsSerializable) { o = new OtherData(o); goto Label_03AF; } } catch (CoreException exception3) { UtlException.ThrowError(exception3); } UtlException.ThrowError(Error.GetError(0x15bd)); goto Label_03AF; } } Label_028B :; try { if (((param.UtlType == UtlType.Null) && (o is string)) || (((param.UtlType == UtlType.VarChar) || (param.UtlType == UtlType.Char)) || (param.UtlType == UtlType.VarCharIngnoreCase))) { o = type.ConvertToType(sessionProxy, o, SqlType.SqlVarchar); } else if (param.UtlType == UtlType.Null) { o = type.ConvertToDefaultType(sessionProxy, o); } else { SqlType type2 = this.UtlType2SqlType(param.UtlType); o = type.ConvertToType(sessionProxy, o, type2); } } catch (CoreException exception4) { UtlException.ThrowError(exception4); } goto Label_03AF; Label_0379 :; try { if (param.UtlType == UtlType.Null) { o = type.ConvertToDefaultType(sessionProxy, o); } else { SqlType type3 = this.UtlType2SqlType(param.UtlType); o = type.ConvertToType(sessionProxy, o, type3); } } catch (CoreException exception5) { UtlException.ThrowError(exception5); } Label_03AF: this._parameterValues[i] = o; }