Skip to content

Commit 52e1960

Browse files
Correct determination of the names of the bind variables in prepared SQL
tatements (which behaves a little differently from PL/SQL statements).
1 parent 14a1d2d commit 52e1960

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

src/Cursor.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1982,7 +1982,8 @@ static PyObject *Cursor_BindNames(udt_Cursor *self, PyObject *args)
19821982
}
19831983

19841984
// get the bind names
1985-
if (dpiStmt_getBindNames(self->handle, numBinds, names, nameLengths) < 0) {
1985+
if (dpiStmt_getBindNames(self->handle, &numBinds, names,
1986+
nameLengths) < 0) {
19861987
PyMem_Free((void*) names);
19871988
PyMem_Free(nameLengths);
19881989
return Error_RaiseAndReturnNull();

test/Cursor.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,8 @@ def testBindNames(self):
238238
":h + :i + :j + :k + :l; end;")
239239
self.assertEqual(self.cursor.bindnames(),
240240
["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L"])
241+
self.cursor.prepare("select :a * :a + :b * :b from dual")
242+
self.assertEqual(self.cursor.bindnames(), ["A", "B"])
241243

242244
def testBadPrepare(self):
243245
"""test that subsequent executes succeed after bad prepare"""

0 commit comments

Comments
 (0)