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_datetime.c | |
parent | e816aa07b67efc8a327c194db6857e2c4df6e3a1 (diff) | |
download | psycopg2-515d66cc9fbfb34c50b4a7a27a915fd46e70b846.tar.gz |
Added __conform__ to all adapters.
Diffstat (limited to 'psycopg/adapter_datetime.c')
-rw-r--r-- | psycopg/adapter_datetime.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/psycopg/adapter_datetime.c b/psycopg/adapter_datetime.c index 2f3b70a..acbf43b 100644 --- a/psycopg/adapter_datetime.c +++ b/psycopg/adapter_datetime.c @@ -32,6 +32,7 @@ #include "psycopg/python.h" #include "psycopg/psycopg.h" #include "psycopg/adapter_datetime.h" +#include "psycopg/microprotocols_proto.h" /* the pointer to the datetime module API is initialized by the module init @@ -83,14 +84,19 @@ pydatetime_getquoted(pydatetimeObject *self, PyObject *args) } PyObject * -pydatetime_prepare(pydatetimeObject *self, PyObject *args) +datetime_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 DateTime wrapper object **/ @@ -108,8 +114,7 @@ static struct PyMemberDef pydatetimeObject_members[] = { static PyMethodDef pydatetimeObject_methods[] = { {"getquoted", (PyCFunction)pydatetime_getquoted, METH_VARARGS, "getquoted() -> wrapped object value as SQL date/time"}, - /* {"prepare", (PyCFunction)pydatetime_prepare, METH_VARARGS, - "prepare(conn) -> currently does nothing"}, */ + {"__conform__", (PyCFunction)pydatetime_conform, METH_VARARGS, NULL}, {NULL} /* Sentinel */ }; |