summaryrefslogtreecommitdiff
path: root/psycopg/adapter_qstring.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_qstring.c
parente816aa07b67efc8a327c194db6857e2c4df6e3a1 (diff)
downloadpsycopg2-515d66cc9fbfb34c50b4a7a27a915fd46e70b846.tar.gz
Added __conform__ to all adapters.
Diffstat (limited to 'psycopg/adapter_qstring.c')
-rw-r--r--psycopg/adapter_qstring.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/psycopg/adapter_qstring.c b/psycopg/adapter_qstring.c
index 755cdf1..93d3dad 100644
--- a/psycopg/adapter_qstring.c
+++ b/psycopg/adapter_qstring.c
@@ -32,6 +32,7 @@
#include "psycopg/psycopg.h"
#include "psycopg/connection.h"
#include "psycopg/adapter_qstring.h"
+#include "psycopg/microprotocols_proto.h"
/** the quoting code */
@@ -183,6 +184,21 @@ qstring_prepare(qstringObject *self, PyObject *args)
return Py_None;
}
+PyObject *
+qstring_conform(binaryObject *self, PyObject *args)
+{
+ PyObject *res, *proto;
+
+ if (!PyArg_ParseTuple(args, "O", &proto)) return NULL;
+
+ if (proto == (PyObject*)&isqlquoteType)
+ res = (PyObject*)self;
+ else
+ res = Py_None;
+
+ Py_INCREF(res);
+ return res;
+}
/** the QuotedString object **/
@@ -202,6 +218,7 @@ static PyMethodDef qstringObject_methods[] = {
"getquoted() -> wrapped object value as SQL-quoted string"},
{"prepare", (PyCFunction)qstring_prepare, METH_VARARGS,
"prepare(conn) -> set encoding to conn->encoding"},
+ {"__conform__", (PyCFunction)qstring_conform, METH_VARARGS, NULL},
{NULL} /* Sentinel */
};