diff options
| author | Federico Di Gregorio <fog@initd.org> | 2005-03-02 14:51:24 +0000 |
|---|---|---|
| committer | Federico Di Gregorio <fog@initd.org> | 2005-03-02 14:51:24 +0000 |
| commit | e816aa07b67efc8a327c194db6857e2c4df6e3a1 (patch) | |
| tree | 42506391c87c2b819f2ef96493f551d7e0f14a71 /psycopg/adapter_binary.c | |
| parent | e8e6c0ada3c2165e372d2b5ca4235236b0929f81 (diff) | |
| download | psycopg2-e816aa07b67efc8a327c194db6857e2c4df6e3a1.tar.gz | |
Adding missing __conform__ methods before release.
Diffstat (limited to 'psycopg/adapter_binary.c')
| -rw-r--r-- | psycopg/adapter_binary.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/psycopg/adapter_binary.c b/psycopg/adapter_binary.c index 43be441..a114f3f 100644 --- a/psycopg/adapter_binary.c +++ b/psycopg/adapter_binary.c @@ -31,6 +31,7 @@ #include "psycopg/python.h" #include "psycopg/psycopg.h" #include "psycopg/adapter_binary.h" +#include "psycopg/microprotocols_proto.h" /** the quoting code */ @@ -165,14 +166,19 @@ binary_getquoted(binaryObject *self, PyObject *args) } PyObject * -binary_prepare(binaryObject *self, PyObject *args) +binary_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 Binary object **/ @@ -190,8 +196,7 @@ static struct PyMemberDef binaryObject_members[] = { static PyMethodDef binaryObject_methods[] = { {"getquoted", (PyCFunction)binary_getquoted, METH_VARARGS, "getquoted() -> wrapped object value as SQL-quoted binary string"}, - /* {"prepare", (PyCFunction)binary_prepare, METH_VARARGS, - "prepare(conn) -> currently does nothing"},*/ + {"__conform__", (PyCFunction)binary_conform, METH_VARARGS, NULL}, {NULL} /* Sentinel */ }; |
