internal void BuildTableSchema (IntPtr pgResult)
{
+ pg_result = pgResult;
+
dataTableSchema = new DataTable ();
dataTableSchema.Columns.Add ("ColumnName", typeof (string));
dataTableSchema.Columns.Add ("ColumnOrdinal", typeof (int));
dataTableSchema.Columns.Add ("BaseColumnName", typeof (string));
dataTableSchema.Columns.Add ("BaseSchemaName", typeof (string));
dataTableSchema.Columns.Add ("BaseTableName", typeof (string));
- dataTableSchema.Columns.Add ("DataType", typeof (System.Type));
+ dataTableSchema.Columns.Add ("DataType", typeof (string));
dataTableSchema.Columns.Add ("AllowDBNull", typeof (bool));
dataTableSchema.Columns.Add ("ProviderType", typeof (string));
dataTableSchema.Columns.Add ("IsAliased", typeof (bool));
dataTableSchema.Columns.Add ("IsLong", typeof (bool));
dataTableSchema.Columns.Add ("IsReadOnly", typeof (bool));
- int fieldCount = PostgresLibrary.PQnfields (pgResult);
+ fieldCount = PostgresLibrary.PQnfields (pgResult);
+ rowCount = PostgresLibrary.PQntuples(pgResult);
+ pgtypes = new string[fieldCount];\r
+
DataRow schemaRow;
int oid;
string pgType;
DbType dbType;
+ Type typ;
+ DataColumn schemaCol;
-
for (int i = 0; i < fieldCount; i += 1 )
{
oid = PostgresLibrary.PQftype (pgResult, i);
schemaRow["BaseSchemaName"] = ""; // ? tim
schemaRow["BaseTableName"] = ""; // ? tim
+ Console.WriteLine("Calling OidToTypname...");
pgType = PostgresHelper.OidToTypname (oid, con.Types);
+ pgtypes[i] = pgType;
+
+ Console.WriteLine("Calling TypnameToSqlDbType...");
dbType = PostgresHelper.TypnameToSqlDbType (pgType);
- //schemaRow["DataType"] = PostgresHelper.DbTypeToSystemType (dbType); ??? this gives a bad cast.
+
+ Console.WriteLine("Calling DbTypeToSystemType...");
+ typ = PostgresHelper.DbTypeToSystemType (dbType);
+ schemaRow["DataType"] = typ.ToString();
schemaRow["AllowDBNull"] = false; // ? tim
schemaRow["ProviderType"] = ""; // ? tim
internal void BuildTableSchema (IntPtr pgResult)
{
+ pg_result = pgResult;
+
dataTableSchema = new DataTable ();
dataTableSchema.Columns.Add ("ColumnName", typeof (string));
dataTableSchema.Columns.Add ("ColumnOrdinal", typeof (int));
dataTableSchema.Columns.Add ("BaseColumnName", typeof (string));
dataTableSchema.Columns.Add ("BaseSchemaName", typeof (string));
dataTableSchema.Columns.Add ("BaseTableName", typeof (string));
- dataTableSchema.Columns.Add ("DataType", typeof (System.Type));
+ dataTableSchema.Columns.Add ("DataType", typeof (string));
dataTableSchema.Columns.Add ("AllowDBNull", typeof (bool));
dataTableSchema.Columns.Add ("ProviderType", typeof (string));
dataTableSchema.Columns.Add ("IsAliased", typeof (bool));
dataTableSchema.Columns.Add ("IsLong", typeof (bool));
dataTableSchema.Columns.Add ("IsReadOnly", typeof (bool));
- int fieldCount = PostgresLibrary.PQnfields (pgResult);
+ fieldCount = PostgresLibrary.PQnfields (pgResult);
+ rowCount = PostgresLibrary.PQntuples(pgResult);
+ pgtypes = new string[fieldCount];\r
+
DataRow schemaRow;
int oid;
string pgType;
DbType dbType;
+ Type typ;
+ DataColumn schemaCol;
-
for (int i = 0; i < fieldCount; i += 1 )
{
oid = PostgresLibrary.PQftype (pgResult, i);
schemaRow["BaseSchemaName"] = ""; // ? tim
schemaRow["BaseTableName"] = ""; // ? tim
+ Console.WriteLine("Calling OidToTypname...");
pgType = PostgresHelper.OidToTypname (oid, con.Types);
+ pgtypes[i] = pgType;
+
+ Console.WriteLine("Calling TypnameToSqlDbType...");
dbType = PostgresHelper.TypnameToSqlDbType (pgType);
- //schemaRow["DataType"] = PostgresHelper.DbTypeToSystemType (dbType); ??? this gives a bad cast.
+
+ Console.WriteLine("Calling DbTypeToSystemType...");
+ typ = PostgresHelper.DbTypeToSystemType (dbType);
+ schemaRow["DataType"] = typ.ToString();
schemaRow["AllowDBNull"] = false; // ? tim
schemaRow["ProviderType"] = ""; // ? tim
+2002-05-22 Daniel Morgan <danmorg@sc.rr.com>
+
+ * System.Data.SqlClient/SqlCommand.cs: more work on
+ building the schema table
+
2002-05-22 Tim Coleman <tim@timcoleman.com>
* System.Data.SqlClient/SqlCommand.cs: preliminary work
on getting the schema table correctly built.
internal void BuildTableSchema (IntPtr pgResult)
{
+ pg_result = pgResult;
+
dataTableSchema = new DataTable ();
dataTableSchema.Columns.Add ("ColumnName", typeof (string));
dataTableSchema.Columns.Add ("ColumnOrdinal", typeof (int));
dataTableSchema.Columns.Add ("BaseColumnName", typeof (string));
dataTableSchema.Columns.Add ("BaseSchemaName", typeof (string));
dataTableSchema.Columns.Add ("BaseTableName", typeof (string));
- dataTableSchema.Columns.Add ("DataType", typeof (System.Type));
+ dataTableSchema.Columns.Add ("DataType", typeof (string));
dataTableSchema.Columns.Add ("AllowDBNull", typeof (bool));
dataTableSchema.Columns.Add ("ProviderType", typeof (string));
dataTableSchema.Columns.Add ("IsAliased", typeof (bool));
dataTableSchema.Columns.Add ("IsLong", typeof (bool));
dataTableSchema.Columns.Add ("IsReadOnly", typeof (bool));
- int fieldCount = PostgresLibrary.PQnfields (pgResult);
+ fieldCount = PostgresLibrary.PQnfields (pgResult);
+ rowCount = PostgresLibrary.PQntuples(pgResult);
+ pgtypes = new string[fieldCount];\r
+
DataRow schemaRow;
int oid;
string pgType;
DbType dbType;
+ Type typ;
+ DataColumn schemaCol;
-
for (int i = 0; i < fieldCount; i += 1 )
{
oid = PostgresLibrary.PQftype (pgResult, i);
schemaRow["BaseSchemaName"] = ""; // ? tim
schemaRow["BaseTableName"] = ""; // ? tim
+ Console.WriteLine("Calling OidToTypname...");
pgType = PostgresHelper.OidToTypname (oid, con.Types);
+ pgtypes[i] = pgType;
+
+ Console.WriteLine("Calling TypnameToSqlDbType...");
dbType = PostgresHelper.TypnameToSqlDbType (pgType);
- //schemaRow["DataType"] = PostgresHelper.DbTypeToSystemType (dbType); ??? this gives a bad cast.
+
+ Console.WriteLine("Calling DbTypeToSystemType...");
+ typ = PostgresHelper.DbTypeToSystemType (dbType);
+ schemaRow["DataType"] = typ.ToString();
schemaRow["AllowDBNull"] = false; // ? tim
schemaRow["ProviderType"] = ""; // ? tim