@@ -2578,3 +2578,38 @@ def test_charset(self):
2578
2578
2579
2579
self .assertEqual (exp_nonunicode , res_nonunicode )
2580
2580
self .assertEqual (exp_unicode , res_unicode )
2581
+
2582
+
2583
+ class BugOra18742429 (tests .MySQLConnectorTests ):
2584
+ """BUG#18742429: CPY FAILS WHEN QUERYING LARGE NUMBER OF COLUMNS
2585
+ """
2586
+ def setUp (self ):
2587
+ config = tests .get_mysql_config ()
2588
+ self .cnx = connection .MySQLConnection (** config )
2589
+ self .cursor = self .cnx .cursor ()
2590
+
2591
+ self .tbl = 'Bug18742429'
2592
+ self .cursor .execute ("DROP TABLE IF EXISTS %s" % self .tbl )
2593
+
2594
+ create = 'CREATE TABLE {0}({1})' .format (self .tbl , ',' .join (
2595
+ ['col' + str (i )+ ' INT(10)' for i in range (1000 )]))
2596
+
2597
+ self .cursor .execute (create )
2598
+
2599
+ def tearDown (self ):
2600
+ self .cursor .execute ("DROP TABLE IF EXISTS %s" % self .tbl )
2601
+ self .cursor .close ()
2602
+ self .cnx .close ()
2603
+
2604
+ def test_columns (self ):
2605
+ stmt = "INSERT INTO {0} VALUES({1})" .format (self .tbl , ',' .join (
2606
+ [str (i ) if i % 2 == 0 else 'NULL' for i in range (1000 )]
2607
+ ))
2608
+ exp = tuple (i if i % 2 == 0 else None for i in range (1000 ))
2609
+ self .cursor .execute (stmt )
2610
+
2611
+ self .cursor = self .cnx .cursor (prepared = True )
2612
+ stmt = 'SELECT * FROM {0} WHERE col0=?' .format (self .tbl )
2613
+ self .cursor .execute (stmt , (0 ,))
2614
+ self .assertEqual (exp , self .cursor .fetchone ())
2615
+
0 commit comments