示例#1
0
		public void GetSchemaTable ()
		{
			IDataReader reader = null;
			DataTable schema;
			DataRow pkRow;

			try {
				cmd.CommandText = "select id, fname, id + 20 as plustwenty from employee";
				reader = cmd.ExecuteReader (CommandBehavior.SchemaOnly | CommandBehavior.KeyInfo);
				schema = reader.GetSchemaTable ();
				reader.Close ();

				AssertSchemaTableStructure (schema, "#A:");
				Assert.AreEqual (3, schema.Rows.Count, "#A:RowCount");
				pkRow = schema.Select ("ColumnName = 'id'") [0];
				Assert.IsFalse (pkRow.IsNull ("ColumnName"), "#A:ColumnName_IsNull");
				Assert.AreEqual ("id", pkRow ["ColumnName"], "#A:ColumnName_Value");
				Assert.IsFalse (pkRow.IsNull ("ColumnOrdinal"), "#A:ColumnOrdinal_IsNull");
				Assert.AreEqual (0, pkRow ["ColumnOrdinal"], "#A:ColumnOrdinal_Value");
				Assert.IsFalse (pkRow.IsNull ("ColumnSize"), "#A:ColumnSize_IsNull");
				Assert.AreEqual (4, pkRow ["ColumnSize"], "#A:ColumnSize_Value");
				Assert.IsFalse (pkRow.IsNull ("NumericPrecision"), "#A:NumericPrecision_IsNull");
				Assert.AreEqual (10, pkRow ["NumericPrecision"], "#A:NumericPrecision_Value");
				Assert.IsFalse (pkRow.IsNull ("NumericScale"), "#A:NumericScale_IsNull");
				Assert.AreEqual (0, pkRow ["NumericScale"], "#A:NumericScale_Value");
				Assert.IsFalse (pkRow.IsNull ("DataType"), "#A:DataType_IsNull");
				Assert.AreEqual (typeof (int), pkRow ["DataType"], "#A:DataType_Value");
				Assert.IsFalse (pkRow.IsNull ("ProviderType"), "#A:ProviderType_IsNull");
				Assert.AreEqual (10, pkRow ["ProviderType"], "#A:ProviderType_Value");
				Assert.IsFalse (pkRow.IsNull ("IsLong"), "#A:IsLong_IsNull");
				Assert.AreEqual (false, pkRow ["IsLong"], "#A:IsLong_Value");
				Assert.IsFalse (pkRow.IsNull ("AllowDBNull"), "#A:AllowDBNull_IsNull");
				Assert.AreEqual (false, pkRow ["AllowDBNull"], "#A:AllowDBNull_Value");
				Assert.IsFalse (pkRow.IsNull ("IsReadOnly"), "#A:IsReadOnly_IsNull");
				Assert.AreEqual (false, pkRow ["IsReadOnly"], "#A:IsReadOnly_Value");
				Assert.IsFalse (pkRow.IsNull ("IsRowVersion"), "#A:IsRowVersion_IsNull");
				Assert.AreEqual (false, pkRow ["IsRowVersion"], "#A:IsRowVersion_Value");
				Assert.IsFalse (pkRow.IsNull ("IsUnique"), "#A:IsUnique_IsNull");
				Assert.AreEqual (true, pkRow ["IsUnique"], "#A:IsUnique_Value");
				Assert.IsFalse (pkRow.IsNull ("IsKey"), "#A:IsKey_IsNull");
				Assert.AreEqual (true, pkRow ["IsKey"], "#A:IsKey_Value");
				Assert.IsFalse (pkRow.IsNull ("IsAutoIncrement"), "#A:IsAutoIncrement_IsNull");
				Assert.AreEqual (false, pkRow ["IsAutoIncrement"], "#A:IsAutoIncrement_Value");
				Assert.IsTrue (pkRow.IsNull ("BaseSchemaName"), "#A:BaseSchemaName_IsNull");
				Assert.AreEqual (DBNull.Value, pkRow ["BaseSchemaName"], "#A:BaseSchemaName_Value");
				Assert.IsFalse (pkRow.IsNull ("BaseCatalogName"), "#A:BaseCatalogName_IsNull");
				Assert.AreEqual ("monotest", pkRow ["BaseCatalogName"], "#A:BaseCatalogName_Value");
				Assert.IsFalse (pkRow.IsNull ("BaseTableName"), "#A:BaseTableName_IsNull");
				Assert.AreEqual ("employee", pkRow ["BaseTableName"], "#A:BaseTableName_Value");
				Assert.IsFalse (pkRow.IsNull ("BaseColumnName"), "#A:BaseColumnName_IsNull");
				Assert.AreEqual ("id", pkRow ["BaseColumnName"], "#A:BaseColumnName_Value");

				reader = cmd.ExecuteReader (CommandBehavior.SchemaOnly);
				schema = reader.GetSchemaTable ();
				reader.Close ();

				AssertSchemaTableStructure (schema, "#B:");
				Assert.AreEqual (3, schema.Rows.Count, "#B:RowCount");
				pkRow = schema.Select ("ColumnName = 'id'") [0];
				Assert.IsFalse (pkRow.IsNull ("ColumnName"), "#B:ColumnName_IsNull");
				Assert.AreEqual ("id", pkRow ["ColumnName"], "#B:ColumnName_Value");
				Assert.IsFalse (pkRow.IsNull ("ColumnOrdinal"), "#B:ColumnOrdinal_IsNull");
				Assert.AreEqual (0, pkRow ["ColumnOrdinal"], "#B:ColumnOrdinal_Value");
				Assert.IsFalse (pkRow.IsNull ("ColumnSize"), "#B:ColumnSize_IsNull");
				Assert.AreEqual (4, pkRow ["ColumnSize"], "#B:ColumnSize_Value");
				Assert.IsFalse (pkRow.IsNull ("NumericPrecision"), "#B:NumericPrecision_IsNull");
				Assert.AreEqual (10, pkRow ["NumericPrecision"], "#B:NumericPrecision_Value");
				Assert.IsFalse (pkRow.IsNull ("NumericScale"), "#B:NumericScale_IsNull");
				Assert.AreEqual (0, pkRow ["NumericScale"], "#B:NumericScale_Value");
				Assert.IsFalse (pkRow.IsNull ("DataType"), "#B:DataType_IsNull");
				Assert.AreEqual (typeof (int), pkRow ["DataType"], "#B:DataType_Value");
				Assert.IsFalse (pkRow.IsNull ("ProviderType"), "#B:ProviderType_IsNull");
				Assert.AreEqual (10, pkRow ["ProviderType"], "#B:ProviderType_Value");
				Assert.IsFalse (pkRow.IsNull ("IsLong"), "#B:IsLong_IsNull");
				Assert.AreEqual (false, pkRow ["IsLong"], "#B:IsLong_Value");
				Assert.IsFalse (pkRow.IsNull ("AllowDBNull"), "#B:AllowDBNull_IsNull");
				Assert.AreEqual (false, pkRow ["AllowDBNull"], "#B:AllowDBNull_Value");
				Assert.IsFalse (pkRow.IsNull ("IsReadOnly"), "#B:IsReadOnly_IsNull");
				Assert.AreEqual (false, pkRow ["IsReadOnly"], "#B:IsReadOnly_Value");
				Assert.IsFalse (pkRow.IsNull ("IsRowVersion"), "#B:IsRowVersion_IsNull");
				Assert.AreEqual (false, pkRow ["IsRowVersion"], "#B:IsRowVersion_Value");
				Assert.IsFalse (pkRow.IsNull ("IsUnique"), "#B:IsUnique_IsNull");
				Assert.AreEqual (false, pkRow ["IsUnique"], "#B:IsUnique_Value");
				Assert.IsFalse (pkRow.IsNull ("IsKey"), "#B:IsKey_IsNull");
				Assert.AreEqual (false, pkRow ["IsKey"], "#B:IsKey_Value");
				Assert.IsFalse (pkRow.IsNull ("IsAutoIncrement"), "#B:IsAutoIncrement_IsNull");
				Assert.AreEqual (false, pkRow ["IsAutoIncrement"], "#B:IsAutoIncrement_Value");
				Assert.IsTrue (pkRow.IsNull ("BaseSchemaName"), "#B:BaseSchemaName_IsNull");
				Assert.AreEqual (DBNull.Value, pkRow ["BaseSchemaName"], "#B:BaseSchemaName_Value");
				Assert.IsTrue (pkRow.IsNull ("BaseCatalogName"), "#B:BaseCatalogName_IsNull");
				Assert.AreEqual (DBNull.Value, pkRow ["BaseCatalogName"], "#B:BaseCatalogName_Value");
				Assert.IsTrue (pkRow.IsNull ("BaseTableName"), "#B:BaseTableName_IsNull");
				Assert.AreEqual (DBNull.Value, pkRow ["BaseTableName"], "#B:BaseTableName_Value");
				Assert.IsTrue (pkRow.IsNull ("BaseColumnName"), "#B:BaseColumnName_IsNull");
				Assert.AreEqual (DBNull.Value, pkRow ["BaseColumnName"], "#B:BaseColumnName_Value");

				reader = cmd.ExecuteReader (CommandBehavior.KeyInfo);
				schema = reader.GetSchemaTable ();
				reader.Close ();

				AssertSchemaTableStructure (schema, "#C:");
				Assert.AreEqual (3, schema.Rows.Count, "#C:RowCount");
				pkRow = schema.Select ("ColumnName = 'id'") [0];
				Assert.IsFalse (pkRow.IsNull ("ColumnName"), "#C:ColumnName_IsNull");
				Assert.AreEqual ("id", pkRow ["ColumnName"], "#C:ColumnName_Value");
				Assert.IsFalse (pkRow.IsNull ("ColumnOrdinal"), "#C:ColumnOrdinal_IsNull");
				Assert.AreEqual (0, pkRow ["ColumnOrdinal"], "#C:ColumnOrdinal_Value");
				Assert.IsFalse (pkRow.IsNull ("ColumnSize"), "#C:ColumnSize_IsNull");
				Assert.AreEqual (4, pkRow ["ColumnSize"], "#C:ColumnSize_Value");
				Assert.IsFalse (pkRow.IsNull ("NumericPrecision"), "#C:NumericPrecision_IsNull");
				Assert.AreEqual (10, pkRow ["NumericPrecision"], "#C:NumericPrecision_Value");
				Assert.IsFalse (pkRow.IsNull ("NumericScale"), "#C:NumericScale_IsNull");
				Assert.AreEqual (0, pkRow ["NumericScale"], "#C:NumericScale_Value");
				Assert.IsFalse (pkRow.IsNull ("DataType"), "#C:DataType_IsNull");
				Assert.AreEqual (typeof (int), pkRow ["DataType"], "#C:DataType_Value");
				Assert.IsFalse (pkRow.IsNull ("ProviderType"), "#C:ProviderType_IsNull");
				Assert.AreEqual (10, pkRow ["ProviderType"], "#C:ProviderType_Value");
				Assert.IsFalse (pkRow.IsNull ("IsLong"), "#C:IsLong_IsNull");
				Assert.AreEqual (false, pkRow ["IsLong"], "#C:IsLong_Value");
				Assert.IsFalse (pkRow.IsNull ("AllowDBNull"), "#C:AllowDBNull_IsNull");
				Assert.AreEqual (false, pkRow ["AllowDBNull"], "#C:AllowDBNull_Value");
				Assert.IsFalse (pkRow.IsNull ("IsReadOnly"), "#C:IsReadOnly_IsNull");
				Assert.AreEqual (false, pkRow ["IsReadOnly"], "#C:IsReadOnly_Value");
				Assert.IsFalse (pkRow.IsNull ("IsRowVersion"), "#C:IsRowVersion_IsNull");
				Assert.AreEqual (false, pkRow ["IsRowVersion"], "#C:IsRowVersion_Value");
				Assert.IsFalse (pkRow.IsNull ("IsUnique"), "#C:IsUnique_IsNull");
				Assert.AreEqual (true, pkRow ["IsUnique"], "#C:IsUnique_Value");
				Assert.IsFalse (pkRow.IsNull ("IsKey"), "#C:IsKey_IsNull");
				Assert.AreEqual (true, pkRow ["IsKey"], "#C:IsKey_Value");
				Assert.IsFalse (pkRow.IsNull ("IsAutoIncrement"), "#C:IsAutoIncrement_IsNull");
				Assert.AreEqual (false, pkRow ["IsAutoIncrement"], "#C:IsAutoIncrement_Value");
				Assert.IsTrue (pkRow.IsNull ("BaseSchemaName"), "#C:BaseSchemaName_IsNull");
				Assert.AreEqual (DBNull.Value, pkRow ["BaseSchemaName"], "#C:BaseSchemaName_Value");
				Assert.IsFalse (pkRow.IsNull ("BaseCatalogName"), "#C:BaseCatalogName_IsNull");
				Assert.AreEqual ("monotest", pkRow ["BaseCatalogName"], "#C:BaseCatalogName_Value");
				Assert.IsFalse (pkRow.IsNull ("BaseTableName"), "#C:BaseTableName_IsNull");
				Assert.AreEqual ("employee", pkRow ["BaseTableName"], "#C:BaseTableName_Value");
				Assert.IsFalse (pkRow.IsNull ("BaseColumnName"), "#C:BaseColumnName_IsNull");
				Assert.AreEqual ("id", pkRow ["BaseColumnName"], "#C:BaseColumnName_Value");

				reader = cmd.ExecuteReader ();
				schema = reader.GetSchemaTable ();
				reader.Close ();

				AssertSchemaTableStructure (schema, "#D:");
				Assert.AreEqual (3, schema.Rows.Count, "#D:RowCount");
				pkRow = schema.Select ("ColumnName = 'id'") [0];
				Assert.IsFalse (pkRow.IsNull ("ColumnName"), "#D:ColumnName_IsNull");
				Assert.AreEqual ("id", pkRow ["ColumnName"], "#D:ColumnName_Value");
				Assert.IsFalse (pkRow.IsNull ("ColumnOrdinal"), "#D:ColumnOrdinal_IsNull");
				Assert.AreEqual (0, pkRow ["ColumnOrdinal"], "#D:ColumnOrdinal_Value");
				Assert.IsFalse (pkRow.IsNull ("ColumnSize"), "#D:ColumnSize_IsNull");
				Assert.AreEqual (4, pkRow ["ColumnSize"], "#D:ColumnSize_Value");
				Assert.IsFalse (pkRow.IsNull ("NumericPrecision"), "#D:NumericPrecision_IsNull");
				Assert.AreEqual (10, pkRow ["NumericPrecision"], "#D:NumericPrecision_Value");
				Assert.IsFalse (pkRow.IsNull ("NumericScale"), "#D:NumericScale_IsNull");
				Assert.AreEqual (0, pkRow ["NumericScale"], "#D:NumericScale_Value");
				Assert.IsFalse (pkRow.IsNull ("DataType"), "#D:DataType_IsNull");
				Assert.AreEqual (typeof (int), pkRow ["DataType"], "#D:DataType_Value");
				Assert.IsFalse (pkRow.IsNull ("ProviderType"), "#D:ProviderType_IsNull");
				Assert.AreEqual (10, pkRow ["ProviderType"], "#D:ProviderType_Value");
				Assert.IsFalse (pkRow.IsNull ("IsLong"), "#D:IsLong_IsNull");
				Assert.AreEqual (false, pkRow ["IsLong"], "#D:IsLong_Value");
				Assert.IsFalse (pkRow.IsNull ("AllowDBNull"), "#D:AllowDBNull_IsNull");
				Assert.AreEqual (false, pkRow ["AllowDBNull"], "#D:AllowDBNull_Value");
				Assert.IsFalse (pkRow.IsNull ("IsReadOnly"), "#D:IsReadOnly_IsNull");
				Assert.AreEqual (false, pkRow ["IsReadOnly"], "#D:IsReadOnly_Value");
				Assert.IsFalse (pkRow.IsNull ("IsRowVersion"), "#D:IsRowVersion_IsNull");
				Assert.AreEqual (false, pkRow ["IsRowVersion"], "#D:IsRowVersion_Value");
				Assert.IsFalse (pkRow.IsNull ("IsUnique"), "#D:IsUnique_IsNull");
				Assert.AreEqual (false, pkRow ["IsUnique"], "#D:IsUnique_Value");
				Assert.IsFalse (pkRow.IsNull ("IsKey"), "#D:IsKey_IsNull");
				Assert.AreEqual (false, pkRow ["IsKey"], "#D:IsKey_Value");
				Assert.IsFalse (pkRow.IsNull ("IsAutoIncrement"), "#D:IsAutoIncrement_IsNull");
				Assert.AreEqual (false, pkRow ["IsAutoIncrement"], "#D:IsAutoIncrement_Value");
				Assert.IsTrue (pkRow.IsNull ("BaseSchemaName"), "#D:BaseSchemaName_IsNull");
				Assert.AreEqual (DBNull.Value, pkRow ["BaseSchemaName"], "#D:BaseSchemaName_Value");
				Assert.IsTrue (pkRow.IsNull ("BaseCatalogName"), "#D:BaseCatalogName_IsNull");
				Assert.AreEqual (DBNull.Value, pkRow ["BaseCatalogName"], "#D:BaseCatalogName_Value");
				Assert.IsTrue (pkRow.IsNull ("BaseTableName"), "#D:BaseTableName_IsNull");
				Assert.AreEqual (DBNull.Value, pkRow ["BaseTableName"], "#D:BaseTableName_Value");
				Assert.IsTrue (pkRow.IsNull ("BaseColumnName"), "#D:BaseColumnName_IsNull");
				Assert.AreEqual (DBNull.Value, pkRow ["BaseColumnName"], "#D:BaseColumnName_Value");

				cmd = conn.CreateCommand ();
				cmd.CommandText = "select id, fname, id + 20 as plustwenty from employee";
				cmd.Prepare ();
				reader = cmd.ExecuteReader (CommandBehavior.SchemaOnly | CommandBehavior.KeyInfo);
				schema = reader.GetSchemaTable ();
				reader.Close ();

				AssertSchemaTableStructure (schema, "#E:");
				Assert.AreEqual (3, schema.Rows.Count, "#E:RowCount");
				pkRow = schema.Select ("ColumnName = 'id'") [0];
				Assert.IsFalse (pkRow.IsNull ("ColumnName"), "#E:ColumnName_IsNull");
				Assert.AreEqual ("id", pkRow ["ColumnName"], "#E:ColumnName_Value");
				Assert.IsFalse (pkRow.IsNull ("ColumnOrdinal"), "#E:ColumnOrdinal_IsNull");
				Assert.AreEqual (0, pkRow ["ColumnOrdinal"], "#E:ColumnOrdinal_Value");
				Assert.IsFalse (pkRow.IsNull ("ColumnSize"), "#E:ColumnSize_IsNull");
				Assert.AreEqual (4, pkRow ["ColumnSize"], "#E:ColumnSize_Value");
				Assert.IsFalse (pkRow.IsNull ("NumericPrecision"), "#E:NumericPrecision_IsNull");
				Assert.AreEqual (10, pkRow ["NumericPrecision"], "#E:NumericPrecision_Value");
				Assert.IsFalse (pkRow.IsNull ("NumericScale"), "#E:NumericScale_IsNull");
				Assert.AreEqual (0, pkRow ["NumericScale"], "#E:NumericScale_Value");
				Assert.IsFalse (pkRow.IsNull ("DataType"), "#E:DataType_IsNull");
				Assert.AreEqual (typeof (int), pkRow ["DataType"], "#E:DataType_Value");
				Assert.IsFalse (pkRow.IsNull ("ProviderType"), "#E:ProviderType_IsNull");
				Assert.AreEqual (10, pkRow ["ProviderType"], "#E:ProviderType_Value");
				Assert.IsFalse (pkRow.IsNull ("IsLong"), "#E:IsLong_IsNull");
				Assert.AreEqual (false, pkRow ["IsLong"], "#E:IsLong_Value");
				Assert.IsFalse (pkRow.IsNull ("AllowDBNull"), "#E:AllowDBNull_IsNull");
				Assert.AreEqual (false, pkRow ["AllowDBNull"], "#E:AllowDBNull_Value");
				Assert.IsFalse (pkRow.IsNull ("IsReadOnly"), "#E:IsReadOnly_IsNull");
				Assert.AreEqual (false, pkRow ["IsReadOnly"], "#E:IsReadOnly_Value");
				Assert.IsFalse (pkRow.IsNull ("IsRowVersion"), "#E:IsRowVersion_IsNull");
				Assert.AreEqual (false, pkRow ["IsRowVersion"], "#E:IsRowVersion_Value");
				Assert.IsFalse (pkRow.IsNull ("IsUnique"), "#E:IsUnique_IsNull");
				Assert.AreEqual (true, pkRow ["IsUnique"], "#E:IsUnique_Value");
				Assert.IsFalse (pkRow.IsNull ("IsKey"), "#E:IsKey_IsNull");
				Assert.AreEqual (true, pkRow ["IsKey"], "#E:IsKey_Value");
				Assert.IsFalse (pkRow.IsNull ("IsAutoIncrement"), "#E:IsAutoIncrement_IsNull");
				Assert.AreEqual (false, pkRow ["IsAutoIncrement"], "#E:IsAutoIncrement_Value");
				Assert.IsTrue (pkRow.IsNull ("BaseSchemaName"), "#E:BaseSchemaName_IsNull");
				Assert.AreEqual (DBNull.Value, pkRow ["BaseSchemaName"], "#E:BaseSchemaName_Value");
				Assert.IsFalse (pkRow.IsNull ("BaseCatalogName"), "#E:BaseCatalogName_IsNull");
				Assert.AreEqual ("monotest", pkRow ["BaseCatalogName"], "#E:BaseCatalogName_Value");
				Assert.IsFalse (pkRow.IsNull ("BaseTableName"), "#E:BaseTableName_IsNull");
				Assert.AreEqual ("employee", pkRow ["BaseTableName"], "#E:BaseTableName_Value");
				Assert.IsFalse (pkRow.IsNull ("BaseColumnName"), "#E:BaseColumnName_IsNull");
				Assert.AreEqual ("id", pkRow ["BaseColumnName"], "#E:BaseColumnName_Value");

				reader = cmd.ExecuteReader (CommandBehavior.SchemaOnly);
				schema = reader.GetSchemaTable ();
				reader.Close ();

				AssertSchemaTableStructure (schema, "#F:");
				Assert.AreEqual (3, schema.Rows.Count, "#F:RowCount");
				pkRow = schema.Select ("ColumnName = 'id'") [0];
				Assert.IsFalse (pkRow.IsNull ("ColumnName"), "#F:ColumnName_IsNull");
				Assert.AreEqual ("id", pkRow ["ColumnName"], "#F:ColumnName_Value");
				Assert.IsFalse (pkRow.IsNull ("ColumnOrdinal"), "#F:ColumnOrdinal_IsNull");
				Assert.AreEqual (0, pkRow ["ColumnOrdinal"], "#F:ColumnOrdinal_Value");
				Assert.IsFalse (pkRow.IsNull ("ColumnSize"), "#F:ColumnSize_IsNull");
				Assert.AreEqual (4, pkRow ["ColumnSize"], "#F:ColumnSize_Value");
				Assert.IsFalse (pkRow.IsNull ("NumericPrecision"), "#F:NumericPrecision_IsNull");
				Assert.AreEqual (10, pkRow ["NumericPrecision"], "#F:NumericPrecision_Value");
				Assert.IsFalse (pkRow.IsNull ("NumericScale"), "#F:NumericScale_IsNull");
				Assert.AreEqual (0, pkRow ["NumericScale"], "#F:NumericScale_Value");
				Assert.IsFalse (pkRow.IsNull ("DataType"), "#F:DataType_IsNull");
				Assert.AreEqual (typeof (int), pkRow ["DataType"], "#F:DataType_Value");
				Assert.IsFalse (pkRow.IsNull ("ProviderType"), "#F:ProviderType_IsNull");
				Assert.AreEqual (10, pkRow ["ProviderType"], "#F:ProviderType_Value");
				Assert.IsFalse (pkRow.IsNull ("IsLong"), "#F:IsLong_IsNull");
				Assert.AreEqual (false, pkRow ["IsLong"], "#F:IsLong_Value");
				Assert.IsFalse (pkRow.IsNull ("AllowDBNull"), "#F:AllowDBNull_IsNull");
				Assert.AreEqual (false, pkRow ["AllowDBNull"], "#F:AllowDBNull_Value");
				Assert.IsFalse (pkRow.IsNull ("IsReadOnly"), "#F:IsReadOnly_IsNull");
				Assert.AreEqual (false, pkRow ["IsReadOnly"], "#F:IsReadOnly_Value");
				Assert.IsFalse (pkRow.IsNull ("IsRowVersion"), "#F:IsRowVersion_IsNull");
				Assert.AreEqual (false, pkRow ["IsRowVersion"], "#F:IsRowVersion_Value");
				Assert.IsFalse (pkRow.IsNull ("IsUnique"), "#F:IsUnique_IsNull");
				Assert.AreEqual (false, pkRow ["IsUnique"], "#F:IsUnique_Value");
				Assert.IsFalse (pkRow.IsNull ("IsKey"), "#F:IsKey_IsNull");
				Assert.AreEqual (false, pkRow ["IsKey"], "#F:IsKey_Value");
				Assert.IsFalse (pkRow.IsNull ("IsAutoIncrement"), "#F:IsAutoIncrement_IsNull");
				Assert.AreEqual (false, pkRow ["IsAutoIncrement"], "#F:IsAutoIncrement_Value");
				Assert.IsTrue (pkRow.IsNull ("BaseSchemaName"), "#F:BaseSchemaName_IsNull");
				Assert.AreEqual (DBNull.Value, pkRow ["BaseSchemaName"], "#F:BaseSchemaName_Value");
				Assert.IsTrue (pkRow.IsNull ("BaseCatalogName"), "#F:BaseCatalogName_IsNull");
				Assert.AreEqual (DBNull.Value, pkRow ["BaseCatalogName"], "#F:BaseCatalogName_Value");
				Assert.IsTrue (pkRow.IsNull ("BaseTableName"), "#F:BaseTableName_IsNull");
				Assert.AreEqual (DBNull.Value, pkRow ["BaseTableName"], "#F:BaseTableName_Value");
				Assert.IsTrue (pkRow.IsNull ("BaseColumnName"), "#F:BaseColumnName_IsNull");
				Assert.AreEqual (DBNull.Value, pkRow ["BaseColumnName"], "#F:BaseColumnName_Value");

				reader = cmd.ExecuteReader (CommandBehavior.KeyInfo);
				schema = reader.GetSchemaTable ();
				reader.Close ();

				AssertSchemaTableStructure (schema, "#G:");
				Assert.AreEqual (3, schema.Rows.Count, "#G:RowCount");
				pkRow = schema.Select ("ColumnName = 'id'") [0];
				Assert.IsFalse (pkRow.IsNull ("ColumnName"), "#G:ColumnName_IsNull");
				Assert.AreEqual ("id", pkRow ["ColumnName"], "#G:ColumnName_Value");
				Assert.IsFalse (pkRow.IsNull ("ColumnOrdinal"), "#G:ColumnOrdinal_IsNull");
				Assert.AreEqual (0, pkRow ["ColumnOrdinal"], "#G:ColumnOrdinal_Value");
				Assert.IsFalse (pkRow.IsNull ("ColumnSize"), "#G:ColumnSize_IsNull");
				Assert.AreEqual (4, pkRow ["ColumnSize"], "#G:ColumnSize_Value");
				Assert.IsFalse (pkRow.IsNull ("NumericPrecision"), "#G:NumericPrecision_IsNull");
				Assert.AreEqual (10, pkRow ["NumericPrecision"], "#G:NumericPrecision_Value");
				Assert.IsFalse (pkRow.IsNull ("NumericScale"), "#G:NumericScale_IsNull");
				Assert.AreEqual (0, pkRow ["NumericScale"], "#G:NumericScale_Value");
				Assert.IsFalse (pkRow.IsNull ("DataType"), "#G:DataType_IsNull");
				Assert.AreEqual (typeof (int), pkRow ["DataType"], "#G:DataType_Value");
				Assert.IsFalse (pkRow.IsNull ("ProviderType"), "#G:ProviderType_IsNull");
				Assert.AreEqual (10, pkRow ["ProviderType"], "#G:ProviderType_Value");
				Assert.IsFalse (pkRow.IsNull ("IsLong"), "#G:IsLong_IsNull");
				Assert.AreEqual (false, pkRow ["IsLong"], "#G:IsLong_Value");
				Assert.IsFalse (pkRow.IsNull ("AllowDBNull"), "#G:AllowDBNull_IsNull");
				Assert.AreEqual (false, pkRow ["AllowDBNull"], "#G:AllowDBNull_Value");
				Assert.IsFalse (pkRow.IsNull ("IsReadOnly"), "#G:IsReadOnly_IsNull");
				Assert.AreEqual (false, pkRow ["IsReadOnly"], "#G:IsReadOnly_Value");
				Assert.IsFalse (pkRow.IsNull ("IsRowVersion"), "#G:IsRowVersion_IsNull");
				Assert.AreEqual (false, pkRow ["IsRowVersion"], "#G:IsRowVersion_Value");
				Assert.IsFalse (pkRow.IsNull ("IsUnique"), "#G:IsUnique_IsNull");
				Assert.AreEqual (true, pkRow ["IsUnique"], "#G:IsUnique_Value");
				Assert.IsFalse (pkRow.IsNull ("IsKey"), "#G:IsKey_IsNull");
				Assert.AreEqual (true, pkRow ["IsKey"], "#G:IsKey_Value");
				Assert.IsFalse (pkRow.IsNull ("IsAutoIncrement"), "#G:IsAutoIncrement_IsNull");
				Assert.AreEqual (false, pkRow ["IsAutoIncrement"], "#G:IsAutoIncrement_Value");
				Assert.IsTrue (pkRow.IsNull ("BaseSchemaName"), "#G:BaseSchemaName_IsNull");
				Assert.AreEqual (DBNull.Value, pkRow ["BaseSchemaName"], "#G:BaseSchemaName_Value");
				Assert.IsFalse (pkRow.IsNull ("BaseCatalogName"), "#G:BaseCatalogName_IsNull");
				Assert.AreEqual ("monotest", pkRow ["BaseCatalogName"], "#G:BaseCatalogName_Value");
				Assert.IsFalse (pkRow.IsNull ("BaseTableName"), "#G:BaseTableName_IsNull");
				Assert.AreEqual ("employee", pkRow ["BaseTableName"], "#G:BaseTableName_Value");
				Assert.IsFalse (pkRow.IsNull ("BaseColumnName"), "#G:BaseColumnName_IsNull");
				Assert.AreEqual ("id", pkRow ["BaseColumnName"], "#G:BaseColumnName_Value");

				reader = cmd.ExecuteReader ();
				schema = reader.GetSchemaTable ();
				reader.Close ();

				AssertSchemaTableStructure (schema, "#H:");
				Assert.AreEqual (3, schema.Rows.Count, "#H:RowCount");
				pkRow = schema.Select ("ColumnName = 'id'") [0];
				Assert.IsFalse (pkRow.IsNull ("ColumnName"), "#H:ColumnName_IsNull");
				Assert.AreEqual ("id", pkRow ["ColumnName"], "#H:ColumnName_Value");
				Assert.IsFalse (pkRow.IsNull ("ColumnOrdinal"), "#H:ColumnOrdinal_IsNull");
				Assert.AreEqual (0, pkRow ["ColumnOrdinal"], "#H:ColumnOrdinal_Value");
				Assert.IsFalse (pkRow.IsNull ("ColumnSize"), "#H:ColumnSize_IsNull");
				Assert.AreEqual (4, pkRow ["ColumnSize"], "#H:ColumnSize_Value");
				Assert.IsFalse (pkRow.IsNull ("NumericPrecision"), "#H:NumericPrecision_IsNull");
				Assert.AreEqual (10, pkRow ["NumericPrecision"], "#H:NumericPrecision_Value");
				Assert.IsFalse (pkRow.IsNull ("NumericScale"), "#H:NumericScale_IsNull");
				Assert.AreEqual (0, pkRow ["NumericScale"], "#H:NumericScale_Value");
				Assert.IsFalse (pkRow.IsNull ("DataType"), "#H:DataType_IsNull");
				Assert.AreEqual (typeof (int), pkRow ["DataType"], "#H:DataType_Value");
				Assert.IsFalse (pkRow.IsNull ("ProviderType"), "#H:ProviderType_IsNull");
				Assert.AreEqual (10, pkRow ["ProviderType"], "#H:ProviderType_Value");
				Assert.IsFalse (pkRow.IsNull ("IsLong"), "#H:IsLong_IsNull");
				Assert.AreEqual (false, pkRow ["IsLong"], "#H:IsLong_Value");
				Assert.IsFalse (pkRow.IsNull ("AllowDBNull"), "#H:AllowDBNull_IsNull");
				Assert.AreEqual (false, pkRow ["AllowDBNull"], "#H:AllowDBNull_Value");
				Assert.IsFalse (pkRow.IsNull ("IsReadOnly"), "#H:IsReadOnly_IsNull");
				Assert.AreEqual (false, pkRow ["IsReadOnly"], "#H:IsReadOnly_Value");
				Assert.IsFalse (pkRow.IsNull ("IsRowVersion"), "#H:IsRowVersion_IsNull");
				Assert.AreEqual (false, pkRow ["IsRowVersion"], "#H:IsRowVersion_Value");
				Assert.IsFalse (pkRow.IsNull ("IsUnique"), "#H:IsUnique_IsNull");
				Assert.AreEqual (false, pkRow ["IsUnique"], "#H:IsUnique_Value");
				Assert.IsFalse (pkRow.IsNull ("IsKey"), "#H:IsKey_IsNull");
				Assert.AreEqual (false, pkRow ["IsKey"], "#H:IsKey_Value");
				Assert.IsFalse (pkRow.IsNull ("IsAutoIncrement"), "#H:IsAutoIncrement_IsNull");
				Assert.AreEqual (false, pkRow ["IsAutoIncrement"], "#H:IsAutoIncrement_Value");
				Assert.IsTrue (pkRow.IsNull ("BaseSchemaName"), "#H:BaseSchemaName_IsNull");
				Assert.AreEqual (DBNull.Value, pkRow ["BaseSchemaName"], "#H:BaseSchemaName_Value");
				Assert.IsTrue (pkRow.IsNull ("BaseCatalogName"), "#H:BaseCatalogName_IsNull");
				Assert.AreEqual (DBNull.Value, pkRow ["BaseCatalogName"], "#H:BaseCatalogName_Value");
				Assert.IsTrue (pkRow.IsNull ("BaseTableName"), "#H:BaseTableName_IsNull");
				Assert.AreEqual (DBNull.Value, pkRow ["BaseTableName"], "#H:BaseTableName_Value");
				Assert.IsTrue (pkRow.IsNull ("BaseColumnName"), "#H:BaseColumnName_IsNull");
				Assert.AreEqual (DBNull.Value, pkRow ["BaseColumnName"], "#H:BaseColumnName_Value");

				cmd.CommandText = "select id, fname, id + 20 as plustwenty from employee where id = ?";
				IDbDataParameter param = cmd.CreateParameter ();
				cmd.Parameters.Add (param);
				param.DbType = DbType.Int32;
				param.Value = 2;
				reader = cmd.ExecuteReader (CommandBehavior.SchemaOnly | CommandBehavior.KeyInfo);
				schema = reader.GetSchemaTable ();
				reader.Close ();

				AssertSchemaTableStructure (schema, "#I:");
				Assert.AreEqual (3, schema.Rows.Count, "#I:RowCount");
				pkRow = schema.Select ("ColumnName = 'id'") [0];
				Assert.IsFalse (pkRow.IsNull ("ColumnName"), "#I:ColumnName_IsNull");
				Assert.AreEqual ("id", pkRow ["ColumnName"], "#I:ColumnName_Value");
				Assert.IsFalse (pkRow.IsNull ("ColumnOrdinal"), "#I:ColumnOrdinal_IsNull");
				Assert.AreEqual (0, pkRow ["ColumnOrdinal"], "#I:ColumnOrdinal_Value");
				Assert.IsFalse (pkRow.IsNull ("ColumnSize"), "#I:ColumnSize_IsNull");
				Assert.AreEqual (4, pkRow ["ColumnSize"], "#I:ColumnSize_Value");
				Assert.IsFalse (pkRow.IsNull ("NumericPrecision"), "#I:NumericPrecision_IsNull");
				Assert.AreEqual (10, pkRow ["NumericPrecision"], "#I:NumericPrecision_Value");
				Assert.IsFalse (pkRow.IsNull ("NumericScale"), "#I:NumericScale_IsNull");
				Assert.AreEqual (0, pkRow ["NumericScale"], "#I:NumericScale_Value");
				Assert.IsFalse (pkRow.IsNull ("DataType"), "#I:DataType_IsNull");
				Assert.AreEqual (typeof (int), pkRow ["DataType"], "#I:DataType_Value");
				Assert.IsFalse (pkRow.IsNull ("ProviderType"), "#I:ProviderType_IsNull");
				Assert.AreEqual (10, pkRow ["ProviderType"], "#I:ProviderType_Value");
				Assert.IsFalse (pkRow.IsNull ("IsLong"), "#I:IsLong_IsNull");
				Assert.AreEqual (false, pkRow ["IsLong"], "#I:IsLong_Value");
				Assert.IsFalse (pkRow.IsNull ("AllowDBNull"), "#I:AllowDBNull_IsNull");
				Assert.AreEqual (false, pkRow ["AllowDBNull"], "#I:AllowDBNull_Value");
				Assert.IsFalse (pkRow.IsNull ("IsReadOnly"), "#I:IsReadOnly_IsNull");
				Assert.AreEqual (false, pkRow ["IsReadOnly"], "#I:IsReadOnly_Value");
				Assert.IsFalse (pkRow.IsNull ("IsRowVersion"), "#I:IsRowVersion_IsNull");
				Assert.AreEqual (false, pkRow ["IsRowVersion"], "#I:IsRowVersion_Value");
				Assert.IsFalse (pkRow.IsNull ("IsUnique"), "#I:IsUnique_IsNull");
				Assert.AreEqual (true, pkRow ["IsUnique"], "#I:IsUnique_Value");
				Assert.IsFalse (pkRow.IsNull ("IsKey"), "#I:IsKey_IsNull");
				Assert.AreEqual (true, pkRow ["IsKey"], "#I:IsKey_Value");
				Assert.IsFalse (pkRow.IsNull ("IsAutoIncrement"), "#I:IsAutoIncrement_IsNull");
				Assert.AreEqual (false, pkRow ["IsAutoIncrement"], "#I:IsAutoIncrement_Value");
				Assert.IsTrue (pkRow.IsNull ("BaseSchemaName"), "#I:BaseSchemaName_IsNull");
				Assert.AreEqual (DBNull.Value, pkRow ["BaseSchemaName"], "#I:BaseSchemaName_Value");
				Assert.IsFalse (pkRow.IsNull ("BaseCatalogName"), "#I:BaseCatalogName_IsNull");
				Assert.AreEqual ("monotest", pkRow ["BaseCatalogName"], "#I:BaseCatalogName_Value");
				Assert.IsFalse (pkRow.IsNull ("BaseTableName"), "#I:BaseTableName_IsNull");
				Assert.AreEqual ("employee", pkRow ["BaseTableName"], "#I:BaseTableName_Value");
				Assert.IsFalse (pkRow.IsNull ("BaseColumnName"), "#I:BaseColumnName_IsNull");
				Assert.AreEqual ("id", pkRow ["BaseColumnName"], "#I:BaseColumnName_Value");

				reader = cmd.ExecuteReader (CommandBehavior.SchemaOnly);
				schema = reader.GetSchemaTable ();
				reader.Close ();

				AssertSchemaTableStructure (schema, "#J:");
				Assert.AreEqual (3, schema.Rows.Count, "#J:RowCount");
				pkRow = schema.Select ("ColumnName = 'id'") [0];
				Assert.IsFalse (pkRow.IsNull ("ColumnName"), "#J:ColumnName_IsNull");
				Assert.AreEqual ("id", pkRow ["ColumnName"], "#J:ColumnName_Value");
				Assert.IsFalse (pkRow.IsNull ("ColumnOrdinal"), "#J:ColumnOrdinal_IsNull");
				Assert.AreEqual (0, pkRow ["ColumnOrdinal"], "#J:ColumnOrdinal_Value");
				Assert.IsFalse (pkRow.IsNull ("ColumnSize"), "#J:ColumnSize_IsNull");
				Assert.AreEqual (4, pkRow ["ColumnSize"], "#J:ColumnSize_Value");
				Assert.IsFalse (pkRow.IsNull ("NumericPrecision"), "#J:NumericPrecision_IsNull");
				Assert.AreEqual (10, pkRow ["NumericPrecision"], "#J:NumericPrecision_Value");
				Assert.IsFalse (pkRow.IsNull ("NumericScale"), "#J:NumericScale_IsNull");
				Assert.AreEqual (0, pkRow ["NumericScale"], "#J:NumericScale_Value");
				Assert.IsFalse (pkRow.IsNull ("DataType"), "#J:DataType_IsNull");
				Assert.AreEqual (typeof (int), pkRow ["DataType"], "#J:DataType_Value");
				Assert.IsFalse (pkRow.IsNull ("ProviderType"), "#J:ProviderType_IsNull");
				Assert.AreEqual (10, pkRow ["ProviderType"], "#J:ProviderType_Value");
				Assert.IsFalse (pkRow.IsNull ("IsLong"), "#J:IsLong_IsNull");
				Assert.AreEqual (false, pkRow ["IsLong"], "#J:IsLong_Value");
				Assert.IsFalse (pkRow.IsNull ("AllowDBNull"), "#J:AllowDBNull_IsNull");
				Assert.AreEqual (false, pkRow ["AllowDBNull"], "#J:AllowDBNull_Value");
				Assert.IsFalse (pkRow.IsNull ("IsReadOnly"), "#J:IsReadOnly_IsNull");
				Assert.AreEqual (false, pkRow ["IsReadOnly"], "#J:IsReadOnly_Value");
				Assert.IsFalse (pkRow.IsNull ("IsRowVersion"), "#J:IsRowVersion_IsNull");
				Assert.AreEqual (false, pkRow ["IsRowVersion"], "#J:IsRowVersion_Value");
				Assert.IsFalse (pkRow.IsNull ("IsUnique"), "#J:IsUnique_IsNull");
				Assert.AreEqual (false, pkRow ["IsUnique"], "#J:IsUnique_Value");
				Assert.IsFalse (pkRow.IsNull ("IsKey"), "#J:IsKey_IsNull");
				Assert.AreEqual (false, pkRow ["IsKey"], "#J:IsKey_Value");
				Assert.IsFalse (pkRow.IsNull ("IsAutoIncrement"), "#J:IsAutoIncrement_IsNull");
				Assert.AreEqual (false, pkRow ["IsAutoIncrement"], "#J:IsAutoIncrement_Value");
				Assert.IsTrue (pkRow.IsNull ("BaseSchemaName"), "#J:BaseSchemaName_IsNull");
				Assert.AreEqual (DBNull.Value, pkRow ["BaseSchemaName"], "#J:BaseSchemaName_Value");
				Assert.IsTrue (pkRow.IsNull ("BaseCatalogName"), "#J:BaseCatalogName_IsNull");
				Assert.AreEqual (DBNull.Value, pkRow ["BaseCatalogName"], "#J:BaseCatalogName_Value");
				Assert.IsTrue (pkRow.IsNull ("BaseTableName"), "#J:BaseTableName_IsNull");
				Assert.AreEqual (DBNull.Value, pkRow ["BaseTableName"], "#J:BaseTableName_Value");
				Assert.IsTrue (pkRow.IsNull ("BaseColumnName"), "#J:BaseColumnName_IsNull");
				Assert.AreEqual (DBNull.Value, pkRow ["BaseColumnName"], "#J:BaseColumnName_Value");

				reader = cmd.ExecuteReader (CommandBehavior.KeyInfo);
				schema = reader.GetSchemaTable ();
				reader.Close ();

				AssertSchemaTableStructure (schema, "#K:");
				Assert.AreEqual (3, schema.Rows.Count, "#K:RowCount");
				pkRow = schema.Select ("ColumnName = 'id'") [0];
				Assert.IsFalse (pkRow.IsNull ("ColumnName"), "#K:ColumnName_IsNull");
				Assert.AreEqual ("id", pkRow ["ColumnName"], "#K:ColumnName_Value");
				Assert.IsFalse (pkRow.IsNull ("ColumnOrdinal"), "#K:ColumnOrdinal_IsNull");
				Assert.AreEqual (0, pkRow ["ColumnOrdinal"], "#K:ColumnOrdinal_Value");
				Assert.IsFalse (pkRow.IsNull ("ColumnSize"), "#K:ColumnSize_IsNull");
				Assert.AreEqual (4, pkRow ["ColumnSize"], "#K:ColumnSize_Value");
				Assert.IsFalse (pkRow.IsNull ("NumericPrecision"), "#K:NumericPrecision_IsNull");
				Assert.AreEqual (10, pkRow ["NumericPrecision"], "#K:NumericPrecision_Value");
				Assert.IsFalse (pkRow.IsNull ("NumericScale"), "#K:NumericScale_IsNull");
				Assert.AreEqual (0, pkRow ["NumericScale"], "#K:NumericScale_Value");
				Assert.IsFalse (pkRow.IsNull ("DataType"), "#K:DataType_IsNull");
				Assert.AreEqual (typeof (int), pkRow ["DataType"], "#K:DataType_Value");
				Assert.IsFalse (pkRow.IsNull ("ProviderType"), "#K:ProviderType_IsNull");
				Assert.AreEqual (10, pkRow ["ProviderType"], "#K:ProviderType_Value");
				Assert.IsFalse (pkRow.IsNull ("IsLong"), "#K:IsLong_IsNull");
				Assert.AreEqual (false, pkRow ["IsLong"], "#K:IsLong_Value");
				Assert.IsFalse (pkRow.IsNull ("AllowDBNull"), "#K:AllowDBNull_IsNull");
				Assert.AreEqual (false, pkRow ["AllowDBNull"], "#K:AllowDBNull_Value");
				Assert.IsFalse (pkRow.IsNull ("IsReadOnly"), "#K:IsReadOnly_IsNull");
				Assert.AreEqual (false, pkRow ["IsReadOnly"], "#K:IsReadOnly_Value");
				Assert.IsFalse (pkRow.IsNull ("IsRowVersion"), "#K:IsRowVersion_IsNull");
				Assert.AreEqual (false, pkRow ["IsRowVersion"], "#K:IsRowVersion_Value");
				Assert.IsFalse (pkRow.IsNull ("IsUnique"), "#K:IsUnique_IsNull");
				Assert.AreEqual (true, pkRow ["IsUnique"], "#K:IsUnique_Value");
				Assert.IsFalse (pkRow.IsNull ("IsKey"), "#K:IsKey_IsNull");
				Assert.AreEqual (true, pkRow ["IsKey"], "#K:IsKey_Value");
				Assert.IsFalse (pkRow.IsNull ("IsAutoIncrement"), "#K:IsAutoIncrement_IsNull");
				Assert.AreEqual (false, pkRow ["IsAutoIncrement"], "#K:IsAutoIncrement_Value");
				Assert.IsTrue (pkRow.IsNull ("BaseSchemaName"), "#K:BaseSchemaName_IsNull");
				Assert.AreEqual (DBNull.Value, pkRow ["BaseSchemaName"], "#K:BaseSchemaName_Value");
				Assert.IsFalse (pkRow.IsNull ("BaseCatalogName"), "#K:BaseCatalogName_IsNull");
				Assert.AreEqual ("monotest", pkRow ["BaseCatalogName"], "#K:BaseCatalogName_Value");
				Assert.IsFalse (pkRow.IsNull ("BaseTableName"), "#K:BaseTableName_IsNull");
				Assert.AreEqual ("employee", pkRow ["BaseTableName"], "#K:BaseTableName_Value");
				Assert.IsFalse (pkRow.IsNull ("BaseColumnName"), "#K:BaseColumnName_IsNull");
				Assert.AreEqual ("id", pkRow ["BaseColumnName"], "#K:BaseColumnName_Value");

				reader = cmd.ExecuteReader ();
				schema = reader.GetSchemaTable ();
				reader.Close ();

				AssertSchemaTableStructure (schema, "#L:");
				Assert.AreEqual (3, schema.Rows.Count, "#L:RowCount");
				pkRow = schema.Select ("ColumnName = 'id'") [0];
				Assert.IsFalse (pkRow.IsNull ("ColumnName"), "#L:ColumnName_IsNull");
				Assert.AreEqual ("id", pkRow ["ColumnName"], "#L:ColumnName_Value");
				Assert.IsFalse (pkRow.IsNull ("ColumnOrdinal"), "#L:ColumnOrdinal_IsNull");
				Assert.AreEqual (0, pkRow ["ColumnOrdinal"], "#L:ColumnOrdinal_Value");
				Assert.IsFalse (pkRow.IsNull ("ColumnSize"), "#L:ColumnSize_IsNull");
				Assert.AreEqual (4, pkRow ["ColumnSize"], "#L:ColumnSize_Value");
				Assert.IsFalse (pkRow.IsNull ("NumericPrecision"), "#L:NumericPrecision_IsNull");
				Assert.AreEqual (10, pkRow ["NumericPrecision"], "#L:NumericPrecision_Value");
				Assert.IsFalse (pkRow.IsNull ("NumericScale"), "#L:NumericScale_IsNull");
				Assert.AreEqual (0, pkRow ["NumericScale"], "#L:NumericScale_Value");
				Assert.IsFalse (pkRow.IsNull ("DataType"), "#L:DataType_IsNull");
				Assert.AreEqual (typeof (int), pkRow ["DataType"], "#L:DataType_Value");
				Assert.IsFalse (pkRow.IsNull ("ProviderType"), "#L:ProviderType_IsNull");
				Assert.AreEqual (10, pkRow ["ProviderType"], "#L:ProviderType_Value");
				Assert.IsFalse (pkRow.IsNull ("IsLong"), "#L:IsLong_IsNull");
				Assert.AreEqual (false, pkRow ["IsLong"], "#L:IsLong_Value");
				Assert.IsFalse (pkRow.IsNull ("AllowDBNull"), "#L:AllowDBNull_IsNull");
				Assert.AreEqual (false, pkRow ["AllowDBNull"], "#L:AllowDBNull_Value");
				Assert.IsFalse (pkRow.IsNull ("IsReadOnly"), "#L:IsReadOnly_IsNull");
				Assert.AreEqual (false, pkRow ["IsReadOnly"], "#L:IsReadOnly_Value");
				Assert.IsFalse (pkRow.IsNull ("IsRowVersion"), "#L:IsRowVersion_IsNull");
				Assert.AreEqual (false, pkRow ["IsRowVersion"], "#L:IsRowVersion_Value");
				Assert.IsFalse (pkRow.IsNull ("IsUnique"), "#L:IsUnique_IsNull");
				Assert.AreEqual (false, pkRow ["IsUnique"], "#L:IsUnique_Value");
				Assert.IsFalse (pkRow.IsNull ("IsKey"), "#L:IsKey_IsNull");
				Assert.AreEqual (false, pkRow ["IsKey"], "#L:IsKey_Value");
				Assert.IsFalse (pkRow.IsNull ("IsAutoIncrement"), "#L:IsAutoIncrement_IsNull");
				Assert.AreEqual (false, pkRow ["IsAutoIncrement"], "#L:IsAutoIncrement_Value");
				Assert.IsTrue (pkRow.IsNull ("BaseSchemaName"), "#L:BaseSchemaName_IsNull");
				Assert.AreEqual (DBNull.Value, pkRow ["BaseSchemaName"], "#L:BaseSchemaName_Value");
				Assert.IsTrue (pkRow.IsNull ("BaseCatalogName"), "#L:BaseCatalogName_IsNull");
				Assert.AreEqual (DBNull.Value, pkRow ["BaseCatalogName"], "#L:BaseCatalogName_Value");
				Assert.IsTrue (pkRow.IsNull ("BaseTableName"), "#L:BaseTableName_IsNull");
				Assert.AreEqual (DBNull.Value, pkRow ["BaseTableName"], "#L:BaseTableName_Value");
				Assert.IsTrue (pkRow.IsNull ("BaseColumnName"), "#L:BaseColumnName_IsNull");
				Assert.AreEqual (DBNull.Value, pkRow ["BaseColumnName"], "#L:BaseColumnName_Value");
			} finally {
				if (reader != null)
					reader.Close ();
			}
		}
示例#2
0
文件: test.cs 项目: mono/gert
	static int Main ()
	{
		if (Environment.GetEnvironmentVariable ("MONO_TESTS_ODBC") == null)
			return 0;

		OdbcConnection conn = new OdbcConnection (CreateOdbcConnectionString ());
		conn.Open ();

		OdbcCommand cmd = new OdbcCommand (drop_table, conn);
		cmd.ExecuteNonQuery ();

		OdbcDataReader reader = null;

		try {
			cmd = new OdbcCommand (create_table, conn);
			cmd.ExecuteNonQuery ();

			cmd = new OdbcCommand (insert_data, conn);

			OdbcParameter paramName = cmd.CreateParameter ();
			paramName.ParameterName = "name";
			paramName.DbType = DbType.String;
			paramName.Value = "Drieфen";
			cmd.Parameters.Add (paramName);

			OdbcParameter paramInitials = cmd.CreateParameter ();
			paramInitials.ParameterName = "Initials";
			paramInitials.DbType = DbType.String;
			paramInitials.Value = "GфD";
			cmd.Parameters.Add (paramInitials);

			OdbcParameter paramFirstName = cmd.CreateParameter ();
			paramFirstName.ParameterName = "FirstName";
			paramFirstName.DbType = DbType.String;
			paramFirstName.Value = "Gert";
			cmd.Parameters.Add (paramFirstName);

			OdbcParameter paramIncome = cmd.CreateParameter ();
			paramIncome.ParameterName = "Income";
			paramIncome.DbType = DbType.Decimal;
			paramIncome.Scale = 3;
			paramIncome.Value = 5566.6557f;
			cmd.Parameters.Add (paramIncome);

			OdbcParameter paramBirthDate = cmd.CreateParameter ();
			paramBirthDate.ParameterName = "BirthDate";
			paramBirthDate.DbType = DbType.DateTime;
			paramBirthDate.Value = new DateTime (1973, 8, 13);
			cmd.Parameters.Add (paramBirthDate);

			OdbcParameter paramMarried = cmd.CreateParameter ();
			paramMarried.ParameterName = "Married";
			paramMarried.DbType = DbType.Boolean;
			paramMarried.Value = false;
			cmd.Parameters.Add (paramMarried);

			OdbcParameter paramZipCode = cmd.CreateParameter ();
			paramZipCode.ParameterName = "ZipCode";
			paramZipCode.DbType = DbType.Int32;
			paramZipCode.Value = 3510;
			cmd.Parameters.Add (paramZipCode);

			OdbcParameter paramTown = cmd.CreateParameter ();
			paramTown.ParameterName = "Town";
			paramTown.DbType = DbType.StringFixedLength;
			paramTown.Value = "Kermt";
			cmd.Parameters.Add (paramTown);

			cmd.ExecuteNonQuery ();
			cmd.Dispose ();

			cmd = new OdbcCommand (select_data, conn);
			reader = cmd.ExecuteReader ();
			Assert.IsTrue (reader.Read (), "#A1");
			Assert.AreEqual (8, reader.FieldCount, "#A2");

			Assert.AreEqual ("nvarchar", reader.GetDataTypeName (0), "#B1");
			Assert.AreEqual ("Drieфen", reader.GetValue (0), "#B2");

			Assert.AreEqual ("nchar", reader.GetDataTypeName (1), "#C1");
			Assert.AreEqual ("GфD  ", reader.GetValue (1), "#C2");

			Assert.AreEqual ("varchar", reader.GetDataTypeName (2), "#D1");
			Assert.AreEqual ("Gert", reader.GetValue (2), "#D2");

			Assert.AreEqual ("decimal", reader.GetDataTypeName (3), "#E1");
			Assert.AreEqual (5566.6560m, reader.GetValue (3), "#E2");

			Assert.AreEqual ("datetime", reader.GetDataTypeName (4), "#F1");
			Assert.AreEqual (new DateTime (1973, 8, 13), reader.GetValue (4), "#F2");

			Assert.AreEqual ("bit", reader.GetDataTypeName (5), "#G1");
			Assert.AreEqual (false, reader.GetValue (5), "#G2");

			Assert.AreEqual ("int", reader.GetDataTypeName (6), "#H1");
			Assert.AreEqual (3510, reader.GetValue (6), "#H2");

			Assert.AreEqual ("char", reader.GetDataTypeName (7), "#I1");
			Assert.AreEqual ("Kermt          ", reader.GetValue (7), "#I2");

			reader.Close ();
			cmd.Dispose ();
		} finally {
			if (reader != null)
				reader.Close ();

			cmd = new OdbcCommand (drop_table, conn);
			cmd.ExecuteNonQuery ();
			cmd.Dispose ();

			conn.Dispose ();
		}

		return 0;
	}