diff options
| author | Federico Di Gregorio <fog@initd.org> | 2006-04-24 05:42:02 +0000 |
|---|---|---|
| committer | Federico Di Gregorio <fog@initd.org> | 2006-04-24 05:42:02 +0000 |
| commit | 3806f9688b0a65ad5dc7d0ba0b52f8c4c2e01bee (patch) | |
| tree | 275e18aac5372d9b677f7bddfbac6500dff8b007 | |
| parent | b51a03b663e10aa31659d8b5762013092225a68e (diff) | |
| download | psycopg2-3806f9688b0a65ad5dc7d0ba0b52f8c4c2e01bee.tar.gz | |
Boolean fix for arrays.
| -rw-r--r-- | ChangeLog | 5 | ||||
| -rw-r--r-- | psycopg/adapter_pboolean.c | 9 | ||||
| -rw-r--r-- | setup.cfg | 3 |
3 files changed, 16 insertions, 1 deletions
@@ -1,3 +1,8 @@ +2006-04-24 Federico Di Gregorio <fog@initd.org> + + * psycopg/adapter_pboolean.c: added the possibility to format boolean + values as "true" and "false" instead of "'t'" and "'f'". + 2006-03-08 Federico Di Gregorio <fog@initd.org> * lib/extras.py: added .next() to DictCursot to support iteration. diff --git a/psycopg/adapter_pboolean.c b/psycopg/adapter_pboolean.c index 35e534a..fa70ad0 100644 --- a/psycopg/adapter_pboolean.c +++ b/psycopg/adapter_pboolean.c @@ -37,12 +37,21 @@ static PyObject * pboolean_str(pbooleanObject *self) { +#ifdef PSYCOPG_NEW_BOOLEAN + if (PyObject_IsTrue(self->wrapped)) { + return PyString_FromString("true"); + } + else { + return PyString_FromString("false"); + } +#else if (PyObject_IsTrue(self->wrapped)) { return PyString_FromString("'t'"); } else { return PyString_FromString("'f'"); } +#endif } PyObject * @@ -1,11 +1,12 @@ [build_ext] -define=PSYCOPG_EXTENSIONS,PSYCOPG_DISPLAY_SIZE,HAVE_PQFREEMEM,HAVE_PQPROTOCOL3 +define=PSYCOPG_EXTENSIONS,PSYCOPG_DISPLAY_SIZE,PSYCOPG_NEW_BOOLEAN,HAVE_PQFREEMEM,HAVE_PQPROTOCOL3 # PSYCOPG_EXTENSIONS enables extensions to PEP-249 (you really want this) # PSYCOPG_DISPLAY_SIZE enable display size calculation (a little slower) # HAVE_PQFREEMEM should be defined on PostgreSQL >= 7.3 # HAVE_PQPROTOCOL3 should be defined on PostgreSQL >= 7.4 # PSYCOPG_DEBUG can be added to enable verbose debug information # PSYCOPG_OWN_QUOTING can be added, but it is deprecated (will go away in 2.1) +# PSYCOPG_NEW_BOOLEAN to format booleans as true/false vs 't'/'f' # Set to 1 to use Python datatime objects for default date/time representation use_pydatetime=1 |
