diff options
| author | Federico Di Gregorio <fog@initd.org> | 2005-03-03 06:31:03 +0000 |
|---|---|---|
| committer | Federico Di Gregorio <fog@initd.org> | 2005-03-03 06:31:03 +0000 |
| commit | 515d66cc9fbfb34c50b4a7a27a915fd46e70b846 (patch) | |
| tree | b1c5cde759dfc00b1ea8191cfe72f85248e8c269 /psycopg/adapter_mxdatetime.c | |
| parent | e816aa07b67efc8a327c194db6857e2c4df6e3a1 (diff) | |
| download | psycopg2-515d66cc9fbfb34c50b4a7a27a915fd46e70b846.tar.gz | |
Added __conform__ to all adapters.
Diffstat (limited to 'psycopg/adapter_mxdatetime.c')
| -rw-r--r-- | psycopg/adapter_mxdatetime.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/psycopg/adapter_mxdatetime.c b/psycopg/adapter_mxdatetime.c index 1c83e0c..3a1b596 100644 --- a/psycopg/adapter_mxdatetime.c +++ b/psycopg/adapter_mxdatetime.c @@ -30,6 +30,7 @@ #include "psycopg/python.h" #include "psycopg/psycopg.h" #include "psycopg/adapter_mxdatetime.h" +#include "psycopg/microprotocols_proto.h" /* the pointer to the mxDateTime API is initialized by the module init code, we just need to grab it */ @@ -59,14 +60,19 @@ mxdatetime_getquoted(mxdatetimeObject *self, PyObject *args) } PyObject * -mxdatetime_prepare(mxdatetimeObject *self, PyObject *args) +mxdatetime_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 MxDateTime object **/ @@ -84,8 +90,7 @@ static struct PyMemberDef mxdatetimeObject_members[] = { static PyMethodDef mxdatetimeObject_methods[] = { {"getquoted", (PyCFunction)mxdatetime_getquoted, METH_VARARGS, "getquoted() -> wrapped object value as SQL date/time"}, - /* {"prepare", (PyCFunction)mxdatetime_prepare, METH_VARARGS, - "prepare(conn) -> currently does nothing"}, */ + {"__conform__", (PyCFunction)mxdatetime_conform, METH_VARARGS, NULL}, {NULL} /* Sentinel */ }; |
