ptupitsyn commented on code in PR #4371:
URL: https://github.com/apache/ignite-3/pull/4371#discussion_r1753382823


##########
modules/platforms/python/cpp_module/py_cursor.cpp:
##########
@@ -71,15 +164,28 @@ static PyObject* py_cursor_execute(py_cursor* self, 
PyObject* args, PyObject* kw
     };
 
     const char* query = nullptr;
-    // TODO IGNITE-23126 Support parameters
     PyObject *params = nullptr;
 
     int parsed = PyArg_ParseTupleAndKeywords(args, kwargs, "s|O", kwlist, 
&query, &params);
-
     if (!parsed)
         return nullptr;
 
-    self->m_statement->execute_sql_query(query);
+    Py_ssize_t size{0};
+    if (params && params != Py_None) {
+        if (PySequence_Check(params)) {
+            size = PySequence_Size(params);
+            if (size < 0) {
+                PyErr_SetString(PyExc_RuntimeError, "Internal error while 
getting size of the parameters sequence");
+                return nullptr;
+            }
+        } else {
+            PyErr_SetString(PyExc_RuntimeError, "Only sequences of parameters 
are supported");

Review Comment:
   The object comes from the user, right?
   
   I think we should say "The object does not provide the sequence protocol: 
OBJ_TYPE" (according to 
https://docs.python.org/3/c-api/sequence.html#c.PySequence_Check).



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to