|
1 | 1 | # MySQL Connector/Python - MySQL driver written in Python.
|
2 |
| -# Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. |
| 2 | +# Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. |
3 | 3 |
|
4 | 4 | # MySQL Connector/Python is licensed under the terms of the GPLv2
|
5 | 5 | # <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
|
@@ -626,3 +626,39 @@ def test_bug19331658(self):
|
626 | 626 | )
|
627 | 627 |
|
628 | 628 | mysql.connector._CONNECTION_POOLS = {}
|
| 629 | + |
| 630 | + def test_range_hash(self): |
| 631 | + self.assertTrue(self._check_table( |
| 632 | + "employees.employees_hash", 'HASH')) |
| 633 | + tbl_name = "employees_hash" |
| 634 | + |
| 635 | + tables = ["employees.{0}".format(tbl_name)] |
| 636 | + |
| 637 | + self.cnx.set_property(tables=tables, |
| 638 | + scope=fabric.SCOPE_GLOBAL, |
| 639 | + mode=fabric.MODE_READWRITE) |
| 640 | + |
| 641 | + cur = self.cnx.cursor() |
| 642 | + gtid_executed = self._truncate(cur, tbl_name) |
| 643 | + self.cnx.commit() |
| 644 | + |
| 645 | + insert = ("INSERT INTO {0} " |
| 646 | + "VALUES (%s, %s, %s, %s, %s, %s)").format(tbl_name) |
| 647 | + |
| 648 | + self._populate(self.cnx, gtid_executed, tbl_name, insert, |
| 649 | + self.emp_data[1985] + self.emp_data[2000], 3) |
| 650 | + |
| 651 | + time.sleep(2) |
| 652 | + |
| 653 | + emp_exp_hash = self.emp_data[1985] + self.emp_data[2000] |
| 654 | + |
| 655 | + rows = [] |
| 656 | + self.cnx.reset_properties() |
| 657 | + str_keys = ['group1', 'group2'] |
| 658 | + for str_key in str_keys: |
| 659 | + self.cnx.set_property(group=str_key, mode=fabric.MODE_READONLY) |
| 660 | + cur = self.cnx.cursor() |
| 661 | + cur.execute("SELECT * FROM {0}".format(tbl_name)) |
| 662 | + rows += cur.fetchall() |
| 663 | + |
| 664 | + self.assertEqual(rows, emp_exp_hash) |
0 commit comments