mirror of
https://github.com/psycopg/psycopg2.git
synced 2024-11-22 08:56:34 +03:00
Connection encoding case fix (closes: #83).
This commit is contained in:
parent
e72f3dba40
commit
7db16edad3
|
@ -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
|
||||
|
|
5
NEWS
5
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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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}
|
||||
};
|
||||
|
|
|
@ -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
|
||||
|
|
2
setup.py
2
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
|
||||
|
|
Loading…
Reference in New Issue
Block a user