summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--NEWS5
-rw-r--r--psycopg/connection_int.c15
-rw-r--r--psycopg/connection_type.c2
-rw-r--r--psycopg/psycopgmodule.c3
-rw-r--r--setup.cfg2
-rw-r--r--setup.py2
7 files changed, 28 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index f4004db..1b7d7ac 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2006-01-01 Federico Di Gregorio <fog@initd.org>
+
+ * psycopg/connection_int.c: PostgreSQL encoding names are now force
+ uppercase (after all PostgreSQL documentation reports them this way.)
+
2005-12-11 Federico Di Gregorio <fog@initd.org>
* psycopg/typecast_array.c (typecast_array_cleanup): added functio
diff --git a/NEWS b/NEWS
index b1210f7..a25ded7 100644
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,11 @@ What's new in psycopg 2.0 beta 7
* Ironed out last problems with times and date (should be quite solid now.)
+* Fixed problems with some arrays.
+
+* Slightly better ZPsycopgDA (no more double connection objects in the menu
+ and other minor fixes.)
+
* Documentation! (With many kudos to piro.)
What's new in psycopg 2.0 beta 6
diff --git a/psycopg/connection_int.c b/psycopg/connection_int.c
index 9795e0e..1aa20fb 100644
--- a/psycopg/connection_int.c
+++ b/psycopg/connection_int.c
@@ -53,7 +53,8 @@ conn_connect(connectionObject *self)
{
PGconn *pgconn;
PGresult *pgres;
- char *data;
+ char *data, *tmp;
+ int i;
/* we need the initial date style to be ISO, for typecasters; if the user
later change it, she must know what she's doing... */
@@ -110,7 +111,17 @@ conn_connect(connectionObject *self)
IFCLEARPGRES(pgres);
return -1;
}
- self->encoding = strdup(PQgetvalue(pgres, 0, 0));
+ tmp = PQgetvalue(pgres, 0, 0);
+ self->encoding = PyMem_Malloc(strlen(tmp));
+ if (self->encoding == NULL) {
+ /* exception already set by PyMem_Malloc() */
+ PQfinish(pgconn);
+ IFCLEARPGRES(pgres);
+ return -1;
+ }
+ for (i=0 ; i < strlen(tmp) ; i++)
+ self->encoding[i] = toupper(tmp[i]);
+ self->encoding[i] = '\0';
CLEARPGRES(pgres);
Py_BEGIN_ALLOW_THREADS;
diff --git a/psycopg/connection_type.c b/psycopg/connection_type.c
index e44f55a..98b380f 100644
--- a/psycopg/connection_type.c
+++ b/psycopg/connection_type.c
@@ -295,7 +295,7 @@ connection_dealloc(PyObject* obj)
if (self->closed == 0) conn_close(self);
if (self->dsn) free(self->dsn);
- if (self->encoding) free(self->encoding);
+ if (self->encoding) PyMem_Free(self->encoding);
if (self->critical) free(self->critical);
Py_XDECREF(self->notice_list);
diff --git a/psycopg/psycopgmodule.c b/psycopg/psycopgmodule.c
index eee3acb..bef1e7a 100644
--- a/psycopg/psycopgmodule.c
+++ b/psycopg/psycopgmodule.c
@@ -281,8 +281,9 @@ static encodingPair encodings[] = {
{"LATIN1", "latin_1"},
{"UNICODE", "utf_8"},
{"UTF8", "utf_8"},
+
/* some compatibility stuff */
- {"latin-1", "latin_1"},
+ {"LATIN-1", "latin_1"},
{NULL, NULL}
};
diff --git a/setup.cfg b/setup.cfg
index 5570bea..741546c 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -1,5 +1,5 @@
[build_ext]
-define=PSYCOPG_DEBUG,PSYCOPG_EXTENSIONS,PSYCOPG_DISPLAY_SIZE,HAVE_PQFREEMEM,HAVE_PQPROTOCOL3
+define=PSYCOPG_EXTENSIONS,PSYCOPG_DISPLAY_SIZE,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
diff --git a/setup.py b/setup.py
index fba0189..0e947b7 100644
--- a/setup.py
+++ b/setup.py
@@ -55,7 +55,7 @@ from distutils.command.build_ext import build_ext
from distutils.sysconfig import get_python_inc
from distutils.ccompiler import get_default_compiler
-PSYCOPG_VERSION = '2.0b6'
+PSYCOPG_VERSION = '2.0b7'
version_flags = []
# to work around older distutil limitations