[pgsqlclient-checkins] pgsqlclient/PostgreSql.Data.PGSqlClient.UnitTests/source PGBaseTest.cs,1.5,1.
Status: Inactive
Brought to you by:
carlosga_fb
|
From: <car...@us...> - 2003-07-20 10:01:22
|
Update of /cvsroot/pgsqlclient/pgsqlclient/PostgreSql.Data.PGSqlClient.UnitTests/source
In directory sc8-pr-cvs1:/tmp/cvs-serv30632
Modified Files:
PGBaseTest.cs PGCommandTest.cs PGDataAdapterTest.cs
Log Message:
* Added new test case for money fields.
* Fixed money datatype handling.
Index: PGBaseTest.cs
===================================================================
RCS file: /cvsroot/pgsqlclient/pgsqlclient/PostgreSql.Data.PGSqlClient.UnitTests/source/PGBaseTest.cs,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** PGBaseTest.cs 18 Jul 2003 22:46:04 -0000 1.5
--- PGBaseTest.cs 20 Jul 2003 10:01:19 -0000 1.6
***************
*** 130,134 ****
commandText.Append("CREATE TABLE public.test_table(");
! commandText.Append("int_field int4 NOT NULL,");
commandText.Append("char_field char(10),");
commandText.Append("varchar_field varchar(30),");
--- 130,134 ----
commandText.Append("CREATE TABLE public.test_table(");
! commandText.Append("int4_field int4 NOT NULL,");
commandText.Append("char_field char(10),");
commandText.Append("varchar_field varchar(30),");
***************
*** 141,149 ****
commandText.Append("blob_field bytea,");
commandText.Append("bool_field bool,");
! commandText.Append("bigint_field int8,");
! commandText.Append("decimal_field decimal(8,2),");
! commandText.Append("smallint_field int2,");
commandText.Append("array_int int2[],");
! commandText.Append("CONSTRAINT test_table_pkey PRIMARY KEY (int_field)");
commandText.Append(") WITH OIDS;");
--- 141,150 ----
commandText.Append("blob_field bytea,");
commandText.Append("bool_field bool,");
! commandText.Append("int2_field int2,");
! commandText.Append("int8_field int8,");
! commandText.Append("money_field money,");
! commandText.Append("numeric_field numeric(8,2),");
commandText.Append("array_int int2[],");
! commandText.Append("CONSTRAINT test_table_pkey PRIMARY KEY (int4_field)");
commandText.Append(") WITH OIDS;");
***************
*** 157,161 ****
private void insertTestData()
{
! string commandText = "insert into public.test_table values(@int_field, @char_field, @varchar_field, @single_field, @double_field, @date_Field, @time_field, @timestamp_field)";
PGTransaction transaction = connection.BeginTransaction();
--- 158,162 ----
private void insertTestData()
{
! string commandText = "insert into public.test_table values(@int4_field, @char_field, @varchar_field, @single_field, @double_field, @date_Field, @time_field, @timestamp_field)";
PGTransaction transaction = connection.BeginTransaction();
***************
*** 165,169 ****
{
// Add command parameters
! command.Parameters.Add("@int_field", PGDbType.Int4);
command.Parameters.Add("@char_field", PGDbType.Char);
command.Parameters.Add("@varchar_field", PGDbType.VarChar);
--- 166,170 ----
{
// Add command parameters
! command.Parameters.Add("@int4_field", PGDbType.Int4);
command.Parameters.Add("@char_field", PGDbType.Char);
command.Parameters.Add("@varchar_field", PGDbType.VarChar);
***************
*** 176,180 ****
for (int i = 0; i < 100; i++)
{
! command.Parameters["@int_field"].Value = i;
command.Parameters["@char_field"].Value = "IRow " + i.ToString();
command.Parameters["@varchar_field"].Value = "IRow Number" + i.ToString();
--- 177,181 ----
for (int i = 0; i < 100; i++)
{
! command.Parameters["@int4_field"].Value = i;
command.Parameters["@char_field"].Value = "IRow " + i.ToString();
command.Parameters["@varchar_field"].Value = "IRow Number" + i.ToString();
Index: PGCommandTest.cs
===================================================================
RCS file: /cvsroot/pgsqlclient/pgsqlclient/PostgreSql.Data.PGSqlClient.UnitTests/source/PGCommandTest.cs,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** PGCommandTest.cs 19 Jul 2003 10:12:29 -0000 1.5
--- PGCommandTest.cs 20 Jul 2003 10:01:19 -0000 1.6
***************
*** 32,36 ****
Console.WriteLine("\r\nPGCommandTest.ExecuteNonQueryTest");
! string commandText = "update public.test_table set char_field = @char_field, varchar_field = @varchar_field where int_field = @int_field";
PGTransaction transaction = Connection.BeginTransaction();
--- 32,36 ----
Console.WriteLine("\r\nPGCommandTest.ExecuteNonQueryTest");
! string commandText = "update public.test_table set char_field = @char_field, varchar_field = @varchar_field where int4_field = @int4_field";
PGTransaction transaction = Connection.BeginTransaction();
***************
*** 42,46 ****
command.Parameters.Add("@char_field", PGDbType.Char);
command.Parameters.Add("@varchar_field", PGDbType.VarChar);
! command.Parameters.Add("@int_field", PGDbType.Int4);
for (int i = 0; i < 100; i++)
--- 42,46 ----
command.Parameters.Add("@char_field", PGDbType.Char);
command.Parameters.Add("@varchar_field", PGDbType.VarChar);
! command.Parameters.Add("@int4_field", PGDbType.Int4);
for (int i = 0; i < 100; i++)
***************
*** 101,105 ****
PGCommand command = Connection.CreateCommand();
! command.CommandText = "SELECT char_field FROM public.test_table where int_field = @int_field";
command.Parameters.Add("@int_Field", 2);
--- 101,105 ----
PGCommand command = Connection.CreateCommand();
! command.CommandText = "SELECT char_field FROM public.test_table where int4_field = @int4_field";
command.Parameters.Add("@int_Field", 2);
***************
*** 117,123 ****
PGCommand command = Connection.CreateCommand();
! command.CommandText = "SELECT char_field FROM public.test_table where int_field = @int_field";
! command.Parameters.Add("@int_field", 2);
command.Prepare();
command.Dispose();
--- 117,123 ----
PGCommand command = Connection.CreateCommand();
! command.CommandText = "SELECT char_field FROM public.test_table where int4_field = @int4_field";
! command.Parameters.Add("@int4_field", 2);
command.Prepare();
command.Dispose();
***************
*** 129,135 ****
PGCommand command = Connection.CreateCommand();
! command.CommandText = "SELECT char_field FROM public.test_table where int_field = @int_field or char_field = @char_field";
! command.Parameters.Add("@int_field", 2);
command.Parameters.Add("@char_field", "IRow 20");
--- 129,135 ----
PGCommand command = Connection.CreateCommand();
! command.CommandText = "SELECT char_field FROM public.test_table where int4_field = @int4_field or char_field = @char_field";
! command.Parameters.Add("@int4_field", 2);
command.Parameters.Add("@char_field", "IRow 20");
***************
*** 159,163 ****
{
// Execute a SELECT command
! PGCommand selectCommand = new PGCommand("SELECT * FROM public.test_table WHERE int_field = 100", Connection);
int recordsAffected = selectCommand.ExecuteNonQuery();
Console.WriteLine("\r\nRecords Affected by SELECT command: {0}", recordsAffected);
--- 159,163 ----
{
// Execute a SELECT command
! PGCommand selectCommand = new PGCommand("SELECT * FROM public.test_table WHERE int4_field = 100", Connection);
int recordsAffected = selectCommand.ExecuteNonQuery();
Console.WriteLine("\r\nRecords Affected by SELECT command: {0}", recordsAffected);
***************
*** 167,171 ****
// Execute a DELETE command
! PGCommand deleteCommand = new PGCommand("DELETE FROM public.test_table WHERE int_field = 45", Connection);
recordsAffected = deleteCommand.ExecuteNonQuery();
Console.WriteLine("\r\nRecords Affected by DELETE command: {0}", recordsAffected);
--- 167,171 ----
// Execute a DELETE command
! PGCommand deleteCommand = new PGCommand("DELETE FROM public.test_table WHERE int4_field = 45", Connection);
recordsAffected = deleteCommand.ExecuteNonQuery();
Console.WriteLine("\r\nRecords Affected by DELETE command: {0}", recordsAffected);
Index: PGDataAdapterTest.cs
===================================================================
RCS file: /cvsroot/pgsqlclient/pgsqlclient/PostgreSql.Data.PGSqlClient.UnitTests/source/PGDataAdapterTest.cs,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** PGDataAdapterTest.cs 18 Jul 2003 22:46:04 -0000 1.3
--- PGDataAdapterTest.cs 20 Jul 2003 10:01:19 -0000 1.4
***************
*** 103,111 ****
DataRow newRow = ds.Tables["public.test_table"].NewRow();
! newRow["int_field"] = 100;
newRow["char_field"] = "PostgreSQL";
newRow["varchar_field"] = "PostgreSQL CLient";
! newRow["bigint_field"] = 100000;
! newRow["smallint_field"] = 100;
newRow["double_field"] = 100.01;
newRow["date_field"] = DateTime.Now;
--- 103,111 ----
DataRow newRow = ds.Tables["public.test_table"].NewRow();
! newRow["int4_field"] = 100;
newRow["char_field"] = "PostgreSQL";
newRow["varchar_field"] = "PostgreSQL CLient";
! newRow["int8_field"] = 100000;
! newRow["int2_field"] = 100;
newRow["double_field"] = 100.01;
newRow["date_field"] = DateTime.Now;
***************
*** 127,134 ****
{
PGTransaction transaction = Connection.BeginTransaction();
! PGCommand command = new PGCommand("SELECT * FROM public.test_table WHERE int_field = @int_field", Connection, transaction);
PGDataAdapter adapter = new PGDataAdapter(command);
! adapter.SelectCommand.Parameters.Add("@int_field", PGDbType.Int4, "int_field").Value = 1;
PGCommandBuilder builder = new PGCommandBuilder(adapter);
--- 127,134 ----
{
PGTransaction transaction = Connection.BeginTransaction();
! PGCommand command = new PGCommand("SELECT * FROM public.test_table WHERE int4_field = @int4_field", Connection, transaction);
PGDataAdapter adapter = new PGDataAdapter(command);
! adapter.SelectCommand.Parameters.Add("@int4_field", PGDbType.Int4, "int4_field").Value = 1;
PGCommandBuilder builder = new PGCommandBuilder(adapter);
***************
*** 151,158 ****
{
PGTransaction transaction = Connection.BeginTransaction();
! PGCommand command = new PGCommand("SELECT * FROM public.test_table WHERE int_field = @int_field", Connection, transaction);
PGDataAdapter adapter = new PGDataAdapter(command);
! adapter.SelectCommand.Parameters.Add("@int_field", PGDbType.Int4, "int_field").Value = 10;
PGCommandBuilder builder = new PGCommandBuilder(adapter);
--- 151,158 ----
{
PGTransaction transaction = Connection.BeginTransaction();
! PGCommand command = new PGCommand("SELECT * FROM public.test_table WHERE int4_field = @int4_field", Connection, transaction);
PGDataAdapter adapter = new PGDataAdapter(command);
! adapter.SelectCommand.Parameters.Add("@int4_field", PGDbType.Int4, "int4_field").Value = 10;
PGCommandBuilder builder = new PGCommandBuilder(adapter);
***************
*** 175,182 ****
{
PGTransaction transaction = Connection.BeginTransaction();
! PGCommand command = new PGCommand("SELECT * FROM public.test_table WHERE int_field = @int_field", Connection, transaction);
PGDataAdapter adapter = new PGDataAdapter(command);
! adapter.SelectCommand.Parameters.Add("@int_field", PGDbType.Int4, "int_field").Value = 40;
PGCommandBuilder builder = new PGCommandBuilder(adapter);
--- 175,182 ----
{
PGTransaction transaction = Connection.BeginTransaction();
! PGCommand command = new PGCommand("SELECT * FROM public.test_table WHERE int4_field = @int4_field", Connection, transaction);
PGDataAdapter adapter = new PGDataAdapter(command);
! adapter.SelectCommand.Parameters.Add("@int4_field", PGDbType.Int4, "int4_field").Value = 40;
PGCommandBuilder builder = new PGCommandBuilder(adapter);
***************
*** 185,189 ****
adapter.Fill(ds, "public.test_table");
! ds.Tables["public.test_table"].Rows[0]["smallint_field"] = System.Int16.MaxValue;
adapter.Update(ds, "public.test_table");
--- 185,189 ----
adapter.Fill(ds, "public.test_table");
! ds.Tables["public.test_table"].Rows[0]["int2_field"] = System.Int16.MaxValue;
adapter.Update(ds, "public.test_table");
***************
*** 194,203 ****
transaction.Commit();
! command = new PGCommand("SELECT smallint_field FROM public.test_table WHERE int_field = @int_field", Connection);
! command.Parameters.Add("@int_field", PGDbType.Int4, "int_field").Value = 40;
short val = (short)command.ExecuteScalar();
! Assertion.AssertEquals("smallint_field has not correct value", System.Int16.MaxValue, val);
}
--- 194,203 ----
transaction.Commit();
! command = new PGCommand("SELECT int2_field FROM public.test_table WHERE int4_field = @int4_field", Connection);
! command.Parameters.Add("@int4_field", PGDbType.Int4, "int4_field").Value = 40;
short val = (short)command.ExecuteScalar();
! Assertion.AssertEquals("int2_field has not correct value", System.Int16.MaxValue, val);
}
***************
*** 206,213 ****
{
PGTransaction transaction = Connection.BeginTransaction();
! PGCommand command = new PGCommand("SELECT * FROM public.test_table WHERE int_field = @int_field", Connection, transaction);
PGDataAdapter adapter = new PGDataAdapter(command);
! adapter.SelectCommand.Parameters.Add("@int_field", PGDbType.Int4, "int_field").Value = 20;
PGCommandBuilder builder = new PGCommandBuilder(adapter);
--- 206,213 ----
{
PGTransaction transaction = Connection.BeginTransaction();
! PGCommand command = new PGCommand("SELECT * FROM public.test_table WHERE int4_field = @int4_field", Connection, transaction);
PGDataAdapter adapter = new PGDataAdapter(command);
! adapter.SelectCommand.Parameters.Add("@int4_field", PGDbType.Int4, "int4_field").Value = 20;
PGCommandBuilder builder = new PGCommandBuilder(adapter);
***************
*** 216,220 ****
adapter.Fill(ds, "public.test_table");
! ds.Tables["public.test_table"].Rows[0]["bigint_field"] = System.Int32.MaxValue;
adapter.Update(ds, "public.test_table");
--- 216,220 ----
adapter.Fill(ds, "public.test_table");
! ds.Tables["public.test_table"].Rows[0]["int8_field"] = System.Int32.MaxValue;
adapter.Update(ds, "public.test_table");
***************
*** 225,234 ****
transaction.Commit();
! command = new PGCommand("SELECT bigint_field FROM public.test_table WHERE int_field = @int_field", Connection);
! command.Parameters.Add("@int_field", PGDbType.Int4, "int_field").Value = 20;
long val = (long)command.ExecuteScalar();
! Assertion.AssertEquals("bigint_field has not correct value", System.Int32.MaxValue, val);
}
--- 225,234 ----
transaction.Commit();
! command = new PGCommand("SELECT int8_field FROM public.test_table WHERE int4_field = @int4_field", Connection);
! command.Parameters.Add("@int4_field", PGDbType.Int4, "int4_field").Value = 20;
long val = (long)command.ExecuteScalar();
! Assertion.AssertEquals("int8_field has not correct value", System.Int32.MaxValue, val);
}
***************
*** 237,244 ****
{
PGTransaction transaction = Connection.BeginTransaction();
! PGCommand command = new PGCommand("SELECT * FROM public.test_table WHERE int_field = @int_field", Connection, transaction);
PGDataAdapter adapter = new PGDataAdapter(command);
! adapter.SelectCommand.Parameters.Add("@int_field", PGDbType.Int4, "int_field").Value = 50;
PGCommandBuilder builder = new PGCommandBuilder(adapter);
--- 237,244 ----
{
PGTransaction transaction = Connection.BeginTransaction();
! PGCommand command = new PGCommand("SELECT * FROM public.test_table WHERE int4_field = @int4_field", Connection, transaction);
PGDataAdapter adapter = new PGDataAdapter(command);
! adapter.SelectCommand.Parameters.Add("@int4_field", PGDbType.Int4, "int4_field").Value = 50;
PGCommandBuilder builder = new PGCommandBuilder(adapter);
***************
*** 256,261 ****
transaction.Commit();
! command = new PGCommand("SELECT double_field FROM public.test_table WHERE int_field = @int_field", Connection);
! command.Parameters.Add("@int_field", PGDbType.Int4, "int_field").Value = 50;
double val = (double)command.ExecuteScalar();
--- 256,261 ----
transaction.Commit();
! command = new PGCommand("SELECT double_field FROM public.test_table WHERE int4_field = @int4_field", Connection);
! command.Parameters.Add("@int4_field", PGDbType.Int4, "int4_field").Value = 50;
double val = (double)command.ExecuteScalar();
***************
*** 265,275 ****
[Test]
! public void UpdateDecimalTest()
{
PGTransaction transaction = Connection.BeginTransaction();
! PGCommand command = new PGCommand("SELECT * FROM public.test_table WHERE int_field = @int_field", Connection, transaction);
PGDataAdapter adapter = new PGDataAdapter(command);
! adapter.SelectCommand.Parameters.Add("@int_field", PGDbType.Int4, "int_field").Value = 60;
PGCommandBuilder builder = new PGCommandBuilder(adapter);
--- 265,275 ----
[Test]
! public void UpdateMoneyField()
{
PGTransaction transaction = Connection.BeginTransaction();
! PGCommand command = new PGCommand("SELECT * FROM public.test_table WHERE int4_field = @int4_field", Connection, transaction);
PGDataAdapter adapter = new PGDataAdapter(command);
! adapter.SelectCommand.Parameters.Add("@int4_field", PGDbType.Int4, "int4_field").Value = 27;
PGCommandBuilder builder = new PGCommandBuilder(adapter);
***************
*** 278,282 ****
adapter.Fill(ds, "public.test_table");
! ds.Tables["public.test_table"].Rows[0]["decimal_field"] = System.Int16.MaxValue;
adapter.Update(ds, "public.test_table");
--- 278,282 ----
adapter.Fill(ds, "public.test_table");
! ds.Tables["public.test_table"].Rows[0]["money_field"] = 200.20;
adapter.Update(ds, "public.test_table");
***************
*** 287,296 ****
transaction.Commit();
! command = new PGCommand("SELECT decimal_field FROM public.test_table WHERE int_field = @int_field", Connection);
! command.Parameters.Add("@int_field", PGDbType.Int4, "int_field").Value = 60;
decimal val = (decimal)command.ExecuteScalar();
! Assertion.AssertEquals("decimal_field has not correct value", System.Int16.MaxValue, val);
}
--- 287,327 ----
transaction.Commit();
! command = new PGCommand("SELECT money_field FROM public.test_table WHERE int4_field = @int4_field", Connection);
! command.Parameters.Add("@int4_field", PGDbType.Int4, "int4_field").Value = 27;
!
! float val = (float)command.ExecuteScalar();
!
! Assertion.AssertEquals("money_field has not correct value", 200.20, val);
! }
!
! [Test]
! public void UpdateNumericTest()
! {
! PGTransaction transaction = Connection.BeginTransaction();
! PGCommand command = new PGCommand("SELECT * FROM public.test_table WHERE int4_field = @int4_field", Connection, transaction);
! PGDataAdapter adapter = new PGDataAdapter(command);
!
! adapter.SelectCommand.Parameters.Add("@int4_field", PGDbType.Int4, "int4_field").Value = 60;
!
! PGCommandBuilder builder = new PGCommandBuilder(adapter);
!
! DataSet ds = new DataSet();
! adapter.Fill(ds, "public.test_table");
!
! ds.Tables["public.test_table"].Rows[0]["numeric_field"] = System.Int16.MaxValue;
!
! adapter.Update(ds, "public.test_table");
!
! adapter.Dispose();
! builder.Dispose();
! command.Dispose();
! transaction.Commit();
!
! command = new PGCommand("SELECT numeric_field FROM public.test_table WHERE int4_field = @int4_field", Connection);
! command.Parameters.Add("@int4_field", PGDbType.Int4, "int4_field").Value = 60;
decimal val = (decimal)command.ExecuteScalar();
! Assertion.AssertEquals("numeric_field has not correct value", System.Int16.MaxValue, val);
}
***************
*** 299,306 ****
{
PGTransaction transaction = Connection.BeginTransaction();
! PGCommand command = new PGCommand("SELECT * FROM public.test_table WHERE int_field = @int_field", Connection, transaction);
PGDataAdapter adapter = new PGDataAdapter(command);
! adapter.SelectCommand.Parameters.Add("@int_field", PGDbType.Int4, "int_field").Value = 70;
PGCommandBuilder builder = new PGCommandBuilder(adapter);
--- 330,337 ----
{
PGTransaction transaction = Connection.BeginTransaction();
! PGCommand command = new PGCommand("SELECT * FROM public.test_table WHERE int4_field = @int4_field", Connection, transaction);
PGDataAdapter adapter = new PGDataAdapter(command);
! adapter.SelectCommand.Parameters.Add("@int4_field", PGDbType.Int4, "int4_field").Value = 70;
PGCommandBuilder builder = new PGCommandBuilder(adapter);
***************
*** 320,325 ****
transaction.Commit();
! command = new PGCommand("SELECT date_field FROM public.test_table WHERE int_field = @int_field", Connection);
! command.Parameters.Add("@int_field", PGDbType.Int4, "int_field").Value = 70;
DateTime val = (DateTime)command.ExecuteScalar();
--- 351,356 ----
transaction.Commit();
! command = new PGCommand("SELECT date_field FROM public.test_table WHERE int4_field = @int4_field", Connection);
! command.Parameters.Add("@int4_field", PGDbType.Int4, "int4_field").Value = 70;
DateTime val = (DateTime)command.ExecuteScalar();
***************
*** 334,341 ****
{
PGTransaction transaction = Connection.BeginTransaction();
! PGCommand command = new PGCommand("SELECT * FROM public.test_table WHERE int_field = @int_field", Connection, transaction);
PGDataAdapter adapter = new PGDataAdapter(command);
! adapter.SelectCommand.Parameters.Add("@int_field", PGDbType.Int4, "int_field").Value = 80;
PGCommandBuilder builder = new PGCommandBuilder(adapter);
--- 365,372 ----
{
PGTransaction transaction = Connection.BeginTransaction();
! PGCommand command = new PGCommand("SELECT * FROM public.test_table WHERE int4_field = @int4_field", Connection, transaction);
PGDataAdapter adapter = new PGDataAdapter(command);
! adapter.SelectCommand.Parameters.Add("@int4_field", PGDbType.Int4, "int4_field").Value = 80;
PGCommandBuilder builder = new PGCommandBuilder(adapter);
***************
*** 355,360 ****
transaction.Commit();
! command = new PGCommand("SELECT time_field FROM public.test_table WHERE int_field = @int_field", Connection);
! command.Parameters.Add("@int_field", PGDbType.Int4, "int_field").Value = 80;
DateTime val = (DateTime)command.ExecuteScalar();
--- 386,391 ----
transaction.Commit();
! command = new PGCommand("SELECT time_field FROM public.test_table WHERE int4_field = @int4_field", Connection);
! command.Parameters.Add("@int4_field", PGDbType.Int4, "int4_field").Value = 80;
DateTime val = (DateTime)command.ExecuteScalar();
***************
*** 369,376 ****
{
PGTransaction transaction = Connection.BeginTransaction();
! PGCommand command = new PGCommand("SELECT * FROM public.test_table WHERE int_field = @int_field", Connection, transaction);
PGDataAdapter adapter = new PGDataAdapter(command);
! adapter.SelectCommand.Parameters.Add("@int_field", PGDbType.Int4, "int_field").Value = 90;
PGCommandBuilder builder = new PGCommandBuilder(adapter);
--- 400,407 ----
{
PGTransaction transaction = Connection.BeginTransaction();
! PGCommand command = new PGCommand("SELECT * FROM public.test_table WHERE int4_field = @int4_field", Connection, transaction);
PGDataAdapter adapter = new PGDataAdapter(command);
! adapter.SelectCommand.Parameters.Add("@int4_field", PGDbType.Int4, "int4_field").Value = 90;
PGCommandBuilder builder = new PGCommandBuilder(adapter);
***************
*** 390,395 ****
transaction.Commit();
! command = new PGCommand("SELECT timestamp_field FROM public.test_table WHERE int_field = @int_field", Connection);
! command.Parameters.Add("@int_field", PGDbType.Int4, "int_field").Value = 90;
DateTime val = (DateTime)command.ExecuteScalar();
--- 421,426 ----
transaction.Commit();
! command = new PGCommand("SELECT timestamp_field FROM public.test_table WHERE int4_field = @int4_field", Connection);
! command.Parameters.Add("@int4_field", PGDbType.Int4, "int4_field").Value = 90;
DateTime val = (DateTime)command.ExecuteScalar();
***************
*** 407,414 ****
{
PGTransaction transaction = Connection.BeginTransaction();
! PGCommand command = new PGCommand("SELECT * FROM public.test_table WHERE int_field = @int_field", Connection, transaction);
PGDataAdapter adapter = new PGDataAdapter(command);
! adapter.SelectCommand.Parameters.Add("@int_field", PGDbType.Int4, "int_field").Value = 35;
PGCommandBuilder builder = new PGCommandBuilder(adapter);
--- 438,445 ----
{
PGTransaction transaction = Connection.BeginTransaction();
! PGCommand command = new PGCommand("SELECT * FROM public.test_table WHERE int4_field = @int4_field", Connection, transaction);
PGDataAdapter adapter = new PGDataAdapter(command);
! adapter.SelectCommand.Parameters.Add("@int4_field", PGDbType.Int4, "int4_field").Value = 35;
PGCommandBuilder builder = new PGCommandBuilder(adapter);
|