|
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
|
@@ -3110,3 +3110,47 @@ def test_warning_with_rows(self):
|
3110 | 3110 | exp = [(u'Warning', 1642, u'TEST WARNING')]
|
3111 | 3111 | self.assertEqual(exp, cur.fetchwarnings())
|
3112 | 3112 | cur.close()
|
| 3113 | + |
| 3114 | + |
| 3115 | +class BugOra20407036(tests.MySQLConnectorTests): |
| 3116 | + """BUG#20407036: INCORRECT ARGUMENTS TO MYSQLD_STMT_EXECUTE ERROR |
| 3117 | + """ |
| 3118 | + def setUp(self): |
| 3119 | + config = tests.get_mysql_config() |
| 3120 | + self.cnx = connection.MySQLConnection(**config) |
| 3121 | + self.cur = self.cnx.cursor() |
| 3122 | + |
| 3123 | + self.tbl = 'Bug20407036' |
| 3124 | + self.cur.execute("DROP TABLE IF EXISTS {0}".format(self.tbl)) |
| 3125 | + |
| 3126 | + create = ("CREATE TABLE {0} ( id int(10) unsigned NOT NULL, " |
| 3127 | + "text VARCHAR(70000) CHARACTER SET utf8 NOT NULL, " |
| 3128 | + "rooms tinyint(3) unsigned NOT NULL) " |
| 3129 | + "ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 " |
| 3130 | + "COLLATE=utf8_unicode_ci".format(self.tbl)) |
| 3131 | + self.cur.execute(create) |
| 3132 | + |
| 3133 | + def tearDown(self): |
| 3134 | + self.cur.execute("DROP TABLE IF EXISTS {0}".format(self.tbl)) |
| 3135 | + self.cur.close() |
| 3136 | + self.cnx.close() |
| 3137 | + |
| 3138 | + def test_binary_charset(self): |
| 3139 | + cur = self.cnx.cursor(prepared=True) |
| 3140 | + sql = "INSERT INTO {0}(text, rooms) VALUES(%s, %s)".format(self.tbl) |
| 3141 | + cur.execute(sql, ('a'*252, 1)) |
| 3142 | + cur.execute(sql, ('a'*253, 2)) |
| 3143 | + cur.execute(sql, ('a'*255, 3)) |
| 3144 | + cur.execute(sql, ('a'*251, 4)) |
| 3145 | + cur.execute(sql, ('a'*65535, 5)) |
| 3146 | + |
| 3147 | + exp = [ |
| 3148 | + (0, 'a'*252, 1), |
| 3149 | + (0, 'a'*253, 2), |
| 3150 | + (0, 'a'*255, 3), |
| 3151 | + (0, 'a'*251, 4), |
| 3152 | + (0, 'a'*65535, 5), |
| 3153 | + ] |
| 3154 | + |
| 3155 | + self.cur.execute("SELECT * FROM {0}".format(self.tbl)) |
| 3156 | + self.assertEqual(exp, self.cur.fetchall()) |
0 commit comments