haveRead = false;
readResultUsed = false;
this.command = command;
- schemaTable = ConstructSchemaTable ();
resultsRead = 0;
fieldCount = 0;
isClosed = false;
{
if (!disposed) {
if (disposing) {
- schemaTable.Dispose ();
+ if (schemaTable != null)
+ schemaTable.Dispose ();
Close ();
command = null;
}
#endif // NET_2_0
Type GetFieldType (int i)
{
+ if (schemaTable == null)
+ schemaTable = ConstructSchemaTable ();
if (i < 0 || i >= schemaTable.Rows.Count)
throw new IndexOutOfRangeException ();
return (Type) schemaTable.Rows[i]["DataType"];
#endif // NET_2_0
string GetName (int i)
{
+ if (schemaTable == null)
+ schemaTable = ConstructSchemaTable ();
return (string) schemaTable.Rows[i]["ColumnName"];
}
#endif // NET_2_0
int GetOrdinal (string name)
{
+ if (schemaTable == null)
+ schemaTable = ConstructSchemaTable ();
foreach (DataRow schemaRow in schemaTable.Rows)
if (((string) schemaRow ["ColumnName"]).Equals (name))
return (int) schemaRow ["ColumnOrdinal"];
{
ValidateState ();
+ if (schemaTable == null)
+ schemaTable = ConstructSchemaTable ();
+
if (schemaTable.Rows != null && schemaTable.Rows.Count > 0)
return schemaTable;
private static object GetSchemaValue (TdsDataColumn schema, object key)
{
- if (schema.ContainsKey (key) && schema [key] != null)
- return schema [key];
- return DBNull.Value;
+ object val = schema [key];
+ if (val != null)
+ return val;
+ else
+ return DBNull.Value;
}
public
#endif
object GetSqlValue (int i)
{
+ if (schemaTable == null)
+ schemaTable = ConstructSchemaTable ();
+
SqlDbType type = (SqlDbType) (schemaTable.Rows [i]["ProviderType"]);
object value = GetValue (i);
#endif
int GetSqlValues (object[] values)
{
+ if (schemaTable == null)
+ schemaTable = ConstructSchemaTable ();
+
int count = 0;
int columnCount = schemaTable.Rows.Count;
int arrayCount = values.Length;
command.GetOutputParameters ();
else {
//new schema
- schemaTable = ConstructSchemaTable ();
+ schemaTable = null;
GetSchemaTable ();
}