public byte GetByte(int i) { return(reader.GetByte(i)); }
public override byte GetByte(int ordinal) { return(source.GetByte(ordinal)); }
private static List <Transaction> ReadTransactions(OracleCommand command) { List <Transaction> transactions = new List <Transaction>(); OracleDataReader reader = command.ExecuteReader(); try { while (reader.Read()) { Transaction transaction = new Transaction(); transaction.TransactionID = reader.IsDBNull(reader.GetOrdinal("TRANS_ID")) ? null : reader.GetString(reader.GetOrdinal("TRANS_ID")); transaction.ProcessName = reader.IsDBNull(reader.GetOrdinal("PROCESS_NAME")) ? null : reader.GetString(reader.GetOrdinal("PROCESS_NAME")); transaction.TransactionTypeName = reader.IsDBNull(reader.GetOrdinal("TRANSACTION_TYPE_NAME")) ? null : reader.GetString(reader.GetOrdinal("TRANSACTION_TYPE_NAME")); transaction.TransactionTime = reader.IsDBNull(reader.GetOrdinal("TRANS_TIME")) ? (DateTime?)null : reader.GetDateTime(reader.GetOrdinal("TRANS_TIME")); transaction.TransactionCompleted = reader.IsDBNull(reader.GetOrdinal("TRANS_COMPLETED")) ? (bool?)null : Convert.ToBoolean(reader.GetByte(reader.GetOrdinal("TRANS_COMPLETED"))); transaction.TotalElapsedTime = reader.IsDBNull(reader.GetOrdinal("TOTAL_ELAPSED_TIME")) ? (decimal?)null : reader.GetDecimal(reader.GetOrdinal("TOTAL_ELAPSED_TIME")); transaction.Url = reader.IsDBNull(reader.GetOrdinal("URL")) ? null : reader.GetString(reader.GetOrdinal("URL")); transaction.ClientName1 = reader.IsDBNull(reader.GetOrdinal("CLNAME1")) ? null : reader.GetString(reader.GetOrdinal("CLNAME1")); transaction.ClientName2 = reader.IsDBNull(reader.GetOrdinal("CLNAME2")) ? null : reader.GetString(reader.GetOrdinal("CLNAME2")); transaction.PingFlag = reader.IsDBNull(reader.GetOrdinal("PING_FLAG")) ? null : reader.GetString(reader.GetOrdinal("PING_FLAG")); transaction.Successful = reader.IsDBNull(reader.GetOrdinal("IS_SUCCESSFUL")) ? null : reader.GetString(reader.GetOrdinal("IS_SUCCESSFUL")); transaction.CheckpointCount = reader.GetInt32(reader.GetOrdinal("CHECKPOINTCOUNT")); transactions.Add(transaction); } } finally { reader.Close(); } return(transactions); }
public void DoTestTypes(DbTypeParametersCollection row) { testTypesInvocations++; exp = null; string rowId = "43967_" + this.testTypesInvocations.ToString(); OracleDataReader rdr = null; OracleConnection con = null; try { row.ExecuteInsert(rowId); row.ExecuteSelectReader(rowId, out rdr, out con); while (rdr.Read()) { //Run over all the columns in the result set row. //For each column, try to read it as a byte. for (int i = 0; i < row.Count; i++) { if (row[i].Value.GetType() == typeof(byte)) //The value in the result set should be a byte. { try { BeginCase(string.Format("Calling GetByte() on a field of dbtype {0}", row[i].DbTypeName)); byte retByte = rdr.GetByte(i); Compare(row[i].Value, retByte); } catch (Exception ex) { exp = ex; } finally { EndCase(exp); exp = null; } } else //The value in the result set should NOT be byte. In this case an Invalid case exception should be thrown. { try { BeginCase(string.Format("Calling GetByte() on a field of dbtype {0}", row[i].DbTypeName)); byte retByte = rdr.GetByte(i); ExpectedExceptionNotCaught("InvalidCastException"); } catch (InvalidCastException ex) { ExpectedExceptionCaught(ex); } catch (Exception ex) { exp = ex; } finally { EndCase(exp); exp = null; } } } } } finally { row.ExecuteDelete(rowId); if ((rdr != null) && (!rdr.IsClosed)) { rdr.Close(); } if ((con != null) && (con.State != ConnectionState.Closed)) { con.Close(); } } }