Description:
CUBRIDCommand.ExecuteDbDataReader(CommandBehavior behavior) does not work.
Repro Steps:
Scenario 1
{noformat}
conn.ConnectionString = DBHelper.connString;
conn.Open();
string sql = select * from nation order by code asc;
CUBRIDCommand cmd = new CUBRIDCommand(sql, conn);
CUBRIDDataReader reader = (CUBRIDDataReader)cmd.ExecuteReader(CommandBehavior.CloseConnection);
reader.Close();
{noformat}
at this point, check the following points:
reader.IsClosed
conn.connState
Expected Results:
reader.IsClosed is true;
conn.connState is ConnectionState.Closed
Actual Results:
reader.IsClosed is true;
conn.connState is ConnectionState.Open
Scenario 2
{noformat}
conn.ConnectionString = DBHelper.connString;
conn.Open();
string sql = select * from nation order by code asc;
CUBRIDCommand cmd = new CUBRIDCommand(sql, conn);
reader = (CUBRIDDataReader)cmd.ExecuteReader(CommandBehavior.SingleRow);
//verify the first two results
reader.Read();
Assert.AreEqual(4, reader.FieldCount);
Assert.AreEqual(AFG, reader.GetString(0));
Assert.AreEqual(Afghanistan, reader.GetString(1));
Assert.AreEqual(Asia, reader.GetString(2));
Assert.AreEqual(Kabul, reader.GetString(3));
try
{
bool result = reader.Read();
Assert.AreEqual(4, reader.FieldCount);
Assert.AreEqual(AHO, reader.GetString(0));
Assert.AreEqual(Netherlands Antilles, reader.GetString(1));
Assert.AreEqual(Americas, reader.GetString(2));
Assert.AreEqual(Willemstad, reader.GetString(3));
}
catch (Exception ex)
{
Log(ex.Message);
}
{noformat}
Expected Results:
reader can only ready one row
Actual Results:
reader.Read() returns true;
The second row can be read.