MCPcopy Index your code
hub / github.com/PyMySQL/mysqlclient / test_stored_procedures

Method test_stored_procedures

tests/test_MySQLdb_capabilities.py:42–70  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

40 self.check_data_integrity(("col1 TINYINT",), generator)
41
42 def test_stored_procedures(self):
43 db = self.connection
44 c = self.cursor
45 self.create_table(("pos INT", "tree CHAR(20)"))
46 c.executemany(
47 "INSERT INTO %s (pos,tree) VALUES (%%s,%%s)" % self.table,
48 list(enumerate("ash birch cedar Lärche pine".split())),
49 )
50 db.commit()
51
52 c.execute(
53 """
54 CREATE PROCEDURE test_sp(IN t VARCHAR(255))
55 BEGIN
56 SELECT pos FROM %s WHERE tree = t;
57 END
58 """
59 % self.table
60 )
61 db.commit()
62
63 c.callproc("test_sp", ("Lärche",))
64 rows = c.fetchall()
65 self.assertEqual(len(rows), 1)
66 self.assertEqual(rows[0][0], 3)
67 c.nextset()
68
69 c.execute("DROP PROCEDURE test_sp")
70 c.execute("drop table %s" % (self.table))
71
72 def test_small_CHAR(self):
73 # Character data

Callers

nothing calls this directly

Calls 6

create_tableMethod · 0.80
executemanyMethod · 0.80
executeMethod · 0.80
callprocMethod · 0.80
nextsetMethod · 0.80
fetchallMethod · 0.45

Tested by

no test coverage detected