Menu

#13 [OLE DB]OleDbDataReader.GetDataTypeName() problem

open
nobody
None
5
2011-08-25
2011-08-25
Jira Trac
No

Brief:
# OleDbDataReader.GetDataTypeName() return value is not match the type of cubrid data

Content: Suspected bug in error table. Verify if it is match in need verify table
* error table
||cubrid data type||return value of GetDataTypeName||
|datetime|char|
|bigint|char|

* need verify table
||cubrid data type||return value of GetDataTypeName||
|set|char|
|multiset|char|
|sequence|char|
|list|char|
|blob|char|
|clob|char|
|double|R8|
|float|R4|
|monetary|R8|
|int|I4|
|short|I2|
|bit|binary|
|bit varying|longvarbinary|
|nchar|wchar|
|nchar varying|wvarchar|

Code reference:
{code}
[Test, Description(test datareader GetDataTypeName)]
[TestCase(DBTYPE_DBDATETIME, 1, TestName = GetDataTypeName_datetime)]//Char
[TestCase(DBTYPE_DBDATE, 2, TestName = GetDataTypeName_date)]
[TestCase(DBTYPE_DBTIME, 3, TestName = GetDataTypeName_time)]
[TestCase(DBTYPE_DBTIMESTAMP, 4, TestName = GetDataTypeName_timestamp)]
[TestCase(DBTYPE_DBDOUBLE, 5, TestName = GetDataTypeName_double)]//R8
[TestCase(DBTYPE_DBFLOAT, 6, TestName = GetDataTypeName_float)]//R4
[TestCase(DBTYPE_NUMERIC, 7, TestName = GetDataTypeName_numeric)]
[TestCase(DBTYPE_BIGINT, 8, TestName = GetDataTypeName_bigint)]//char
[TestCase(DBTYPE_INT, 9, TestName = GetDataTypeName_int)]//I4
[TestCase(DBTYPE_SHORT, 10, TestName = GetDataTypeName_short)]//I2
[TestCase(DBTYPE_MONETARY, 11, TestName = GetDataTypeName_monetary)]//R8
[TestCase(DBTYPE_BIT, 12, TestName = GetDataTypeName_bit)]//binary
[TestCase(DBTYPE_BITVARYING, 13, TestName = GetDataTypeName_bit varying)]//longvarbinary
[TestCase(DBTYPE_CHAR, 14, TestName = GetDataTypeName_char)]
[TestCase(DBTYPE_VARCHAR, 15, TestName = GetDataTypeName_varchar)]
[TestCase(DBTYPE_NCHAR, 16, TestName = GetDataTypeName_nchar)]//wchar
[TestCase(DBTYPE_NCHARVARYING, 17, TestName = GetDataTypeName_nchar varying)]//wvarchar
[TestCase(DBTYPE_SET, 18, TestName = GetDataTypeName_set)]//char
[TestCase(DBTYPE_MULTISET, 19, TestName = GetDataTypeName_multiset)]//char
[TestCase(DBTYPE_LIST, 20, TestName = GetDataTypeName_list)]//char
[TestCase(DBTYPE_SEQUENCE, 21, TestName = GetDataTypeName_sequence)]//char
[TestCase(DBTYPE_BLOB, 22, TestName = GetDataTypeName_blob)]//char
[TestCase(DBTYPE_CLOB, 23, TestName = GetDataTypeName_clob)]//char
public void DataReader_GetDataTypeName(string typeName,int index)
{
string strTable = t_type_all;
string strCreateTable = string.Format(create table {0}(id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,col1 datetime,col2 date,col3 time,col4 timestamp,col5 double,+
col6 float,col7 numeric,col8 bigint,col9 int,col10 short,col11 monetary,col12 bit,col13 bit varying,col14 char(20),+
col15 varchar(20),col16 nchar(20),col17 nchar varying(20),col18 set,col19 multiset,col20 list,col21 sequence,col22 blob,col23 clob);,strTable);
string strDropTable = string.Format(Drop table {0}, strTable);
OleDbUtil oUtil = new OleDbUtil(strConn);
OleDbCommand cmdCubrid = oUtil.CreateCommand(strDropTable);

try
{
cmdCubrid.ExecuteNonQuery();
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
cmdCubrid.CommandText = strCreateTable;
cmdCubrid.ExecuteNonQuery();

string strInsert = string.Format(insert into {0} value(NULL), strTable);
string strSelect = string.Format(select * from {0} order by id desc, strTable);
SqlUtil.ExecuteNonQuery(oUtil.ConnCubrid, strInsert);
OleDbDataReader reader = oUtil.CreateReader(strSelect);
Assert.AreEqual(typeName.ToUpper(), reader.GetDataTypeName(index));
reader.Close();
oUtil.CmdCubrid.Dispose();
oUtil.ConnCubrid.Close();
}
{code}

Discussion

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.