Details
-
Task
-
Status: Open (View Workflow)
-
Minor
-
Resolution: Unresolved
-
None
-
None
-
None
Description
When using C/C within python, every api call needs to be encapsulated by BEGIN/END Threads, e.g.
Py_BEGIN_ALLOW_THREADS()
|
rc= mysql_stmt_execute(self->stmt);
|
Py_END_ALLOW_THREADS()
|
This causes a lot of overhead, in case of callback function for filling values was specified: Whenever calling python code inside mysql_stmt_execute() we need to call Py_END_ALLOW_THREADS and Py_BEGIN_ALLOW_THREADS() again.
Instead of it would be much easier to have a call which fills the buffer and another call which executes the stmt:
buffer= self->connection->mysql->methods->generate_execute_request(self->stmt, &buflen)
|
PY_BEGIN_ALLOW_THREADS()
|
rc= self-connection->mysql->methods->send_command(COM_STMT_EXECUTE, buffer, buflen, ...)
|
PY_BEGIN_END_THREADS()
|
PY_END_ALLOW_THREADS()