[Python] python driver has not return cci error code when insert failed
Test case: http://svn.cubrid.org/cubridapis/python/branches/RB-9.1.0/test2/python/_02_fetchall/fetchall_dataType_test.py
Test Environment:
{noformat}
cubrid_rel: 9.1.0.0201
python driver: http://svn.cubrid.org/cubridapis/python/branches/RB-9.1.0 1491
python: 2.6.5
{noformat}
Test codes:
{noformat}
def test_nchar(self):
# test normal string type
dataList = ['a','abcd','abcdefg']
dataCheck = ['1 ','1234','1234']
sqlInsert = insert into character_db(c_nchar) values
for i in dataList:
sqlInsert = sqlInsert + (' + i + '),
sqlInsert = sqlInsert.rstrip(',')
try:
rowNum = self.cur.execute(sqlInsert)
except Exception,e:
errorValue=str(e)
print (errorValue: ,e)
#self.assertEquals(errorValue,(-1, \ERROR: DBMS, -494, Semantic: Cannot coerce \'a\' to type nchar. insert into charact
er_db (c_nchar) values ( cast(\'a\' as nchar(4))), ( cast(\'abcd\' as nchar(4))), ( cast(\'abcdefg\' as nchar(4)))\))
self.assertEquals(errorValue,(-20001, \ERROR: DBMS, -494, Semantic: Cannot coerce \'a\' to type nchar. insert into char
acter_db (c_nchar) values ( cast(\'a\' as ncha...\));
sqlSelect = select * from character_db
self.cur.execute(sqlSelect)
results=self.cur.fetchall()
for res in results:
print(res)
self.assertEquals(0,len(results))
print
{noformat}
Test error:
The error occured in line *194*
{noformat}
Traceback (most recent call last):
File python/_02_fetchall/fetchall_dataType_test.py, line 194, in test_nchar
self.assertEquals(errorValue,(-20001, \ERROR: DBMS, -494, Semantic: Cannot coerce \'a\' to type nchar. insert into character_db (c_nchar) values ( cast(\'a\' as ncha...\));
AssertionError: '(-494, ERROR: DBMS, -494, Semantic: Cannot coerce \'a\' to type nchar. insert into character_db character_db (character_db.c_nchar)...)' != '(-20001, ERROR: DBMS, -494, Semantic: Cannot coerce \'a\' to type nchar. insert into character_db (c_nchar) values ( cast(\'a\' as ncha...)'
{noformat}
Through the test error, we can see that the cci error code *-20001* has been contained in error value.