summaryrefslogtreecommitdiff
path: root/psycopg/adapter_asis.c
diff options
context:
space:
mode:
authorFederico Di Gregorio <fog@initd.org>2005-03-03 06:31:03 +0000
committerFederico Di Gregorio <fog@initd.org>2005-03-03 06:31:03 +0000
commit515d66cc9fbfb34c50b4a7a27a915fd46e70b846 (patch)
treeb1c5cde759dfc00b1ea8191cfe72f85248e8c269 /psycopg/adapter_asis.c
parente816aa07b67efc8a327c194db6857e2c4df6e3a1 (diff)
downloadpsycopg2-515d66cc9fbfb34c50b4a7a27a915fd46e70b846.tar.gz
Added __conform__ to all adapters.
Diffstat (limited to 'psycopg/adapter_asis.c')
-rw-r--r--psycopg/adapter_asis.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/psycopg/adapter_asis.c b/psycopg/adapter_asis.c
index 5e5fb86..93a793c 100644
--- a/psycopg/adapter_asis.c
+++ b/psycopg/adapter_asis.c
@@ -29,7 +29,7 @@
#include "psycopg/python.h"
#include "psycopg/psycopg.h"
#include "psycopg/adapter_asis.h"
-
+#include "psycopg/microprotocols_proto.h"
/** the AsIs object **/
@@ -52,14 +52,19 @@ asis_getquoted(asisObject *self, PyObject *args)
}
PyObject *
-asis_prepare(asisObject *self, PyObject *args)
+asis_conform(binaryObject *self, PyObject *args)
{
- PyObject *fake;
+ PyObject *res, *proto;
- if (!PyArg_ParseTuple(args, "O", &fake)) return NULL;
+ if (!PyArg_ParseTuple(args, "O", &proto)) return NULL;
- Py_INCREF(Py_None);
- return Py_None;
+ if (proto == (PyObject*)&isqlquoteType)
+ res = (PyObject*)self;
+ else
+ res = Py_None;
+
+ Py_INCREF(res);
+ return res;
}
/** the AsIs object */
@@ -76,8 +81,7 @@ static struct PyMemberDef asisObject_members[] = {
static PyMethodDef asisObject_methods[] = {
{"getquoted", (PyCFunction)asis_getquoted, METH_VARARGS,
"getquoted() -> wrapped object value as SQL-quoted string"},
- /* {"prepare", (PyCFunction)asis_prepare, METH_VARARGS,
- "prepare(conn) -> currently does nothing"}, */
+ {"__conform__", (PyCFunction)asis_conform, METH_VARARGS, NULL},
{NULL} /* Sentinel */
};