The column length returned is wrong when the column charset is UCS2

Bug #1463352 reported by Yu Bo
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Trafodion
New
High
Unassigned

Bug Description

Defect Description:

When test column charset as UCS2, the column length returned is wrong, the expect value is 200K, but the actual values is 886.

Test Environment:

DB cluster: onyx13 (build: trafodion-20150605_0830)
Linux ODBC driver: clients-20150605_0830

Test Steps:

Step 1. create a table

571 sql = "create table tblcolumnsize200kWithUCS2(c1 char(100000) character set ucs2 collate default null, c2 char(100000) character set ucs2 collate default null)"

Sep 2. insert data into the table

573 a = u""
574 b = u""
575 for i in range(1, 100000, 1):
576 a = a + unicode('a') # print sys.maxunicode, if 65535 then ucs2, if 1114111 then ucs4, manually check
577 b = b + unicode('b')
578 a = a + unicode('E')
579 b = b + unicode('E')
580 sql = "insert into tblcolumnsize200kWithUCS2(c1, c2) values('" + a + "', '" + b +"')"
581 cursor.execute(sql)

Step 3. do compare between the expected value and the actual value

585 #print "---", rows
586 print "length of the result set ", len(rows)
587 self.assertEqual(len(rows), 1, 'get total rows from table wrong.')
588 len_a = len(rows[0][0]) # error: length=866
589 print "length of the first column value ", len_a
590 self.assertEqual(len_a, 100000, 'get length of the first column wrong.')
591 self.assertEqual(rows[0][0], a, 'value wrong betwen resultset and table.')

In the step 3, when execute the line 590, the expected value is 100000, but the actual value is 866. Here is the console output,

-bash-4.1$ python -m tests.ODBC.test_scenarios
sslength of the result set 1
length of the first column value 866
Fssss
======================================================================
FAIL: testBigColumnSize_UCS2 (__main__.ScenariosTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/designs/seaquest/yubo/traftests/pyframework_tra/tests/ODBC/test_scenarios.py", line 590, in testBigColumnSize_UCS2
    self.assertEqual(len_a, 100000, 'get length of the first column wrong.')
AssertionError: get length of the first column wrong.

----------------------------------------------------------------------
Ran 7 tests in 13.882s

FAILED (failures=1, skipped=6)

Yu Bo (byu)
Changed in trafodion:
importance: Undecided → High
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.