diff options
author | Federico Di Gregorio <fog@initd.org> | 2005-04-10 05:38:34 +0000 |
---|---|---|
committer | Federico Di Gregorio <fog@initd.org> | 2005-04-10 05:38:34 +0000 |
commit | 48d8bd39a1be26c436adc9413011dec899f955ae (patch) | |
tree | b8506b25ee98b4bc1a6ee72b339df068cff97fef /psycopg/cursor_type.c | |
parent | 1430849c813cbeea246917f8a4a790b26b28b4fc (diff) | |
download | psycopg2-48d8bd39a1be26c436adc9413011dec899f955ae.tar.gz |
Array support completed (closes: #1).
Diffstat (limited to 'psycopg/cursor_type.c')
-rw-r--r-- | psycopg/cursor_type.c | 36 |
1 files changed, 2 insertions, 34 deletions
diff --git a/psycopg/cursor_type.c b/psycopg/cursor_type.c index 8c239ae..cf73ccf 100644 --- a/psycopg/cursor_type.c +++ b/psycopg/cursor_type.c @@ -62,38 +62,6 @@ psyco_curs_close(cursorObject *self, PyObject *args) /* mogrify a query string and build argument array or dict */ -static PyObject* -_mogrify_getquoted(PyObject *obj, connectionObject *conn) -{ - PyObject *res = NULL; - PyObject *tmp = microprotocols_adapt( - obj, (PyObject*)&isqlquoteType, NULL); - - if (tmp != NULL) { - Dprintf("_mogrify: adapted to %s", tmp->ob_type->tp_name); - - /* if requested prepare the object passing it the connection */ - if (PyObject_HasAttrString(tmp, "prepare")) { - res = PyObject_CallMethod(tmp, "prepare", "O", (PyObject*)conn); - if (res == NULL) { - Py_DECREF(tmp); - return NULL; - } - else { - Py_DECREF(res); - } - } - - /* call the getquoted method on tmp (that should exist because we - adapted to the right protocol) */ - res = PyObject_CallMethod(tmp, "getquoted", NULL); - Py_DECREF(tmp); - } - - /* we return res with one extra reference, the caller shall free it */ - return res; -} - static int _mogrify(PyObject *var, PyObject *fmt, connectionObject *conn, PyObject **new) { @@ -164,7 +132,7 @@ _mogrify(PyObject *var, PyObject *fmt, connectionObject *conn, PyObject **new) if (*d) *d = 's'; } else { - t = _mogrify_getquoted(value, conn); + t = microprotocol_getquoted(value, conn); if (t != NULL) { PyDict_SetItem(n, key, t); @@ -222,7 +190,7 @@ _mogrify(PyObject *var, PyObject *fmt, connectionObject *conn, PyObject **new) Py_DECREF(value); } else { - PyObject *t = _mogrify_getquoted(value, conn); + PyObject *t = microprotocol_getquoted(value, conn); if (t != NULL) { PyTuple_SET_ITEM(n, index, t); |