mirror of
https://github.com/psycopg/psycopg2.git
synced 2025-02-17 01:20:32 +03:00
asprintf() removal.
This commit is contained in:
parent
0d4db2ec55
commit
3141770f53
|
@ -1,5 +1,9 @@
|
||||||
2005-03-01 Federico Di Gregorio <fog@debian.org>
|
2005-03-01 Federico Di Gregorio <fog@debian.org>
|
||||||
|
|
||||||
|
* psycopg/cursor_type.c (psyco_curs_copy_from): we now use
|
||||||
|
PyOS_snprintf instead of asprintf. On some platforms this can be
|
||||||
|
bad (win32).. if that's your case, get a better platform. :/
|
||||||
|
|
||||||
* psycopg/microprotocols.c (microprotocols_adapt): fixed small
|
* psycopg/microprotocols.c (microprotocols_adapt): fixed small
|
||||||
typo that made adaptation using __conform__ impossible.
|
typo that made adaptation using __conform__ impossible.
|
||||||
|
|
||||||
|
|
|
@ -930,7 +930,8 @@ _psyco_curs_has_write_check(PyObject* o, void* var)
|
||||||
static PyObject *
|
static PyObject *
|
||||||
psyco_curs_copy_from(cursorObject *self, PyObject *args)
|
psyco_curs_copy_from(cursorObject *self, PyObject *args)
|
||||||
{
|
{
|
||||||
char *table_name, *query = NULL;
|
char query[256];
|
||||||
|
char *table_name;
|
||||||
char *sep = "\t", *null ="NULL";
|
char *sep = "\t", *null ="NULL";
|
||||||
long int bufsize = DEFAULT_COPYSIZE;
|
long int bufsize = DEFAULT_COPYSIZE;
|
||||||
PyObject *file, *res = NULL;
|
PyObject *file, *res = NULL;
|
||||||
|
@ -943,8 +944,8 @@ psyco_curs_copy_from(cursorObject *self, PyObject *args)
|
||||||
|
|
||||||
EXC_IF_CURS_CLOSED(self);
|
EXC_IF_CURS_CLOSED(self);
|
||||||
|
|
||||||
asprintf(&query, "COPY %s FROM stdin USING DELIMITERS '%s'"
|
PyOS_snprintf(query, 256, "COPY %s FROM stdin USING DELIMITERS '%s'"
|
||||||
" WITH NULL AS '%s'", table_name, sep, null);
|
" WITH NULL AS '%s'", table_name, sep, null);
|
||||||
Dprintf("psyco_curs_copy_from: query = %s", query);
|
Dprintf("psyco_curs_copy_from: query = %s", query);
|
||||||
|
|
||||||
self->copysize = bufsize;
|
self->copysize = bufsize;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user