MCPcopy Create free account
hub / github.com/PyMySQL/PyMySQL / test_issue_8

Method test_issue_8

pymysql/tests/test_issues.py:74–92  ·  view source on GitHub ↗

Primary Key and Index error when selecting data

(self)

Source from the content-addressed store, hash-verified

72 conn.close()
73
74 def test_issue_8(self):
75 """Primary Key and Index error when selecting data"""
76 conn = self.connect()
77 c = conn.cursor()
78 with warnings.catch_warnings():
79 warnings.filterwarnings("ignore")
80 c.execute("drop table if exists test")
81 c.execute(
82 """CREATE TABLE `test` (`station` int NOT NULL DEFAULT '0', `dh`
83datetime NOT NULL DEFAULT '2015-01-01 00:00:00', `echeance` int NOT NULL
84DEFAULT '0', `me` double DEFAULT NULL, `mo` double DEFAULT NULL, PRIMARY
85KEY (`station`,`dh`,`echeance`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;"""
86 )
87 try:
88 self.assertEqual(0, c.execute("SELECT * FROM test"))
89 c.execute("ALTER TABLE `test` ADD INDEX `idx_station` (`station`)")
90 self.assertEqual(0, c.execute("SELECT * FROM test"))
91 finally:
92 c.execute("drop table test")
93
94 def test_issue_13(self):
95 """can't handle large result fields"""

Callers

nothing calls this directly

Calls 3

cursorMethod · 0.80
executeMethod · 0.80
connectMethod · 0.45

Tested by

no test coverage detected