Patchset copy_expert 1/5.

This commit is contained in:
Federico Di Gregorio 2007-05-29 08:13:40 +00:00
parent a779c8ef99
commit a23de80c6b
3 changed files with 13 additions and 5 deletions

View File

@ -1,3 +1,7 @@
2007-05-29 Federico Di Gregorio <fog@initd.org>
* Applied whitespace normalization patch from David Rushby (copy_expert set.)
2007-04-25 Federico Di Gregorio <fog@initd.org> 2007-04-25 Federico Di Gregorio <fog@initd.org>
* psycopg/connection_type.c: added support for a new method * psycopg/connection_type.c: added support for a new method

4
NEWS
View File

@ -17,6 +17,10 @@ What's new in psycopg 2.0.6
* copy_to and copy_from now take an extra "columns" parameter. * copy_to and copy_from now take an extra "columns" parameter.
* Python tuples are now adapted to SQL sequences that can be used with
the "IN" operator by default if the psycopg2.extensions module is
imported (i.e., the SQL_IN adapter was moved from extras to extensions.)
* Fixed some small buglets and build glitches: * Fixed some small buglets and build glitches:
- removed double mutex destroy - removed double mutex destroy
- removed all non-constant initializers - removed all non-constant initializers

View File

@ -100,8 +100,8 @@ _mogrify(PyObject *var, PyObject *fmt, connectionObject *conn, PyObject **new)
4/ ...and add it to the new dictionary to be used as argument 4/ ...and add it to the new dictionary to be used as argument
*/ */
else if (c[0] == '%' && c[1] == '(') { else if (c[0] == '%' && c[1] == '(') {
/* check if some crazy guy mixed formats */ /* check if some crazy guy mixed formats */
if (kind == 2) { if (kind == 2) {
Py_XDECREF(n); Py_XDECREF(n);
psyco_set_error(ProgrammingError, (PyObject*)conn, psyco_set_error(ProgrammingError, (PyObject*)conn,
@ -1090,7 +1090,7 @@ static int _psyco_curs_copy_columns(PyObject *columns, char *columnlist)
coliter = PyObject_GetIter(columns); coliter = PyObject_GetIter(columns);
if (coliter == NULL) return 0; if (coliter == NULL) return 0;
columnlist[0] = '('; columnlist[0] = '(';
while ((col = PyIter_Next(coliter)) != NULL) { while ((col = PyIter_Next(coliter)) != NULL) {
@ -1174,7 +1174,7 @@ psyco_curs_copy_from(cursorObject *self, PyObject *args, PyObject *kwargs)
EXC_IF_CURS_CLOSED(self); EXC_IF_CURS_CLOSED(self);
if (null) { if (null) {
PyOS_snprintf(query, DEFAULT_COPYBUFF-1, PyOS_snprintf(query, DEFAULT_COPYBUFF-1,
"COPY %s%s FROM stdin USING DELIMITERS '%s'" "COPY %s%s FROM stdin USING DELIMITERS '%s'"
" WITH NULL AS '%s'", table_name, columnlist, sep, null); " WITH NULL AS '%s'", table_name, columnlist, sep, null);
} }
@ -1234,7 +1234,7 @@ psyco_curs_copy_to(cursorObject *self, PyObject *args, PyObject *kwargs)
&table_name, &sep, &null, &columns)) { &table_name, &sep, &null, &columns)) {
return NULL; return NULL;
} }
if (_psyco_curs_copy_columns(columns, columnlist) == -1) if (_psyco_curs_copy_columns(columns, columnlist) == -1)
return NULL; return NULL;