Slide 59
Slide 59 text
// mysqlclient/_mysql.c
static PyObject *
_mysql_field_to_python(PyObject *converter, char *rowitem,
unsigned long len, MYSQL_FIELD *field) {
PyObject *v;
if (converter != Py_None) {
v = PyObject_CallFunction(converter, "s#", rowitem, (int)len));
} else {
v = PyBytes_FromStringAndSize(rowitem, (int)len);
}
// ...
if rowitem is a string-encoded float ("2.2718")
Then this turns rowitem into a Python string, then calls
float() on it
Here, the database driver is turning raw character
buffers from the database into Python objects.
59