|
1 | 1 | # -*- coding: utf-8 -*-
|
2 | 2 | # MySQL Connector/Python - MySQL driver written in Python.
|
3 |
| -# Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved. |
| 3 | +# Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved. |
4 | 4 |
|
5 | 5 | # MySQL Connector/Python is licensed under the terms of the GPLv2
|
6 | 6 | # <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
|
@@ -3292,3 +3292,47 @@ def test_warning_with_rows(self):
|
3292 | 3292 | self.assertEqual(exp, cur.stored_results().next().fetchall())
|
3293 | 3293 | exp = [(u'Warning', 1642, u'TEST WARNING')]
|
3294 | 3294 | self.assertEqual(exp, cur.fetchwarnings())
|
| 3295 | + |
| 3296 | + |
| 3297 | +class BugOra20407036(tests.MySQLConnectorTests): |
| 3298 | + """BUG#20407036: INCORRECT ARGUMENTS TO MYSQLD_STMT_EXECUTE ERROR |
| 3299 | + """ |
| 3300 | + def setUp(self): |
| 3301 | + config = tests.get_mysql_config() |
| 3302 | + self.cnx = connection.MySQLConnection(**config) |
| 3303 | + self.cur = self.cnx.cursor() |
| 3304 | + |
| 3305 | + self.tbl = 'Bug20407036' |
| 3306 | + self.cur.execute("DROP TABLE IF EXISTS {0}".format(self.tbl)) |
| 3307 | + |
| 3308 | + create = ("CREATE TABLE {0} ( id int(10) unsigned NOT NULL, " |
| 3309 | + "text VARCHAR(70000) CHARACTER SET utf8 NOT NULL, " |
| 3310 | + "rooms tinyint(3) unsigned NOT NULL) " |
| 3311 | + "ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 " |
| 3312 | + "COLLATE=utf8_unicode_ci".format(self.tbl)) |
| 3313 | + self.cur.execute(create) |
| 3314 | + |
| 3315 | + def tearDown(self): |
| 3316 | + self.cur.execute("DROP TABLE IF EXISTS {0}".format(self.tbl)) |
| 3317 | + self.cur.close() |
| 3318 | + self.cnx.close() |
| 3319 | + |
| 3320 | + def test_binary_charset(self): |
| 3321 | + cur = self.cnx.cursor(prepared=True) |
| 3322 | + sql = "INSERT INTO {0}(text, rooms) VALUES(%s, %s)".format(self.tbl) |
| 3323 | + cur.execute(sql, ('a'*252, 1)) |
| 3324 | + cur.execute(sql, ('a'*253, 2)) |
| 3325 | + cur.execute(sql, ('a'*255, 3)) |
| 3326 | + cur.execute(sql, ('a'*251, 4)) |
| 3327 | + cur.execute(sql, ('a'*65535, 5)) |
| 3328 | + |
| 3329 | + exp = [ |
| 3330 | + (0, 'a'*252, 1), |
| 3331 | + (0, 'a'*253, 2), |
| 3332 | + (0, 'a'*255, 3), |
| 3333 | + (0, 'a'*251, 4), |
| 3334 | + (0, 'a'*65535, 5), |
| 3335 | + ] |
| 3336 | + |
| 3337 | + self.cur.execute("SELECT * FROM {0}".format(self.tbl)) |
| 3338 | + self.assertEqual(exp, self.cur.fetchall()) |
0 commit comments