OracleDataReader.cs 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Data;
  4. using System.Linq;
  5. using System.Text;
  6. namespace Ant.Oracle
  7. {
  8. public class OracleDataReader : IDataReader, IDataRecord, IDisposable
  9. {
  10. IDataReader _reader;
  11. public OracleDataReader(IDataReader reader)
  12. {
  13. Utils.CheckNull(reader);
  14. this._reader = reader;
  15. }
  16. #region IDataReader
  17. public int Depth { get { return this._reader.Depth; } }
  18. public bool IsClosed { get { return this._reader.IsClosed; } }
  19. public int RecordsAffected { get { return this._reader.RecordsAffected; } }
  20. public void Close()
  21. {
  22. this._reader.Close();
  23. }
  24. public DataTable GetSchemaTable()
  25. {
  26. return this._reader.GetSchemaTable();
  27. }
  28. public bool NextResult()
  29. {
  30. return this._reader.NextResult();
  31. }
  32. public bool Read()
  33. {
  34. return this._reader.Read();
  35. }
  36. public void Dispose()
  37. {
  38. this._reader.Dispose();
  39. }
  40. #endregion
  41. public int FieldCount { get { return this._reader.FieldCount; } }
  42. public object this[int i] { get { return this._reader[i]; } }
  43. public object this[string name] { get { return this._reader[name]; } }
  44. public bool GetBoolean(int i)
  45. {
  46. Type fieldType = this._reader.GetFieldType(i);
  47. if (fieldType == UtilConstants.TypeOfInt32)
  48. return Convert.ToBoolean(this._reader.GetInt32(i));
  49. if (fieldType == UtilConstants.TypeOfDecimal)
  50. return Convert.ToBoolean(this._reader.GetDecimal(i));
  51. return this._reader.GetBoolean(i);
  52. }
  53. public byte GetByte(int i)
  54. {
  55. return this._reader.GetByte(i);
  56. }
  57. public long GetBytes(int i, long fieldOffset, byte[] buffer, int bufferoffset, int length)
  58. {
  59. return this._reader.GetBytes(i, fieldOffset, buffer, bufferoffset, length);
  60. }
  61. public char GetChar(int i)
  62. {
  63. return this._reader.GetChar(i);
  64. }
  65. public long GetChars(int i, long fieldoffset, char[] buffer, int bufferoffset, int length)
  66. {
  67. return this._reader.GetChars(i, fieldoffset, buffer, bufferoffset, length);
  68. }
  69. public IDataReader GetData(int i)
  70. {
  71. return this._reader.GetData(i);
  72. }
  73. public string GetDataTypeName(int i)
  74. {
  75. return this._reader.GetDataTypeName(i);
  76. }
  77. public DateTime GetDateTime(int i)
  78. {
  79. return this._reader.GetDateTime(i);
  80. }
  81. public decimal GetDecimal(int i)
  82. {
  83. return this._reader.GetDecimal(i);
  84. }
  85. public double GetDouble(int i)
  86. {
  87. return this._reader.GetDouble(i);
  88. }
  89. public Type GetFieldType(int i)
  90. {
  91. return this._reader.GetFieldType(i);
  92. }
  93. public float GetFloat(int i)
  94. {
  95. return this._reader.GetFloat(i);
  96. }
  97. public Guid GetGuid(int i)
  98. {
  99. return this._reader.GetGuid(i);
  100. }
  101. public short GetInt16(int i)
  102. {
  103. return this._reader.GetInt16(i);
  104. }
  105. public int GetInt32(int i)
  106. {
  107. return this._reader.GetInt32(i);
  108. }
  109. public long GetInt64(int i)
  110. {
  111. return this._reader.GetInt64(i);
  112. }
  113. public string GetName(int i)
  114. {
  115. return this._reader.GetName(i);
  116. }
  117. public int GetOrdinal(string name)
  118. {
  119. return this._reader.GetOrdinal(name);
  120. }
  121. public string GetString(int i)
  122. {
  123. return this._reader.GetString(i);
  124. }
  125. public object GetValue(int i)
  126. {
  127. return this._reader.GetValue(i);
  128. }
  129. public int GetValues(object[] values)
  130. {
  131. return this._reader.GetValues(values);
  132. }
  133. public bool IsDBNull(int i)
  134. {
  135. return this._reader.IsDBNull(i);
  136. }
  137. }
  138. }