mirror of
https://github.com/psycopg/psycopg2.git
synced 2025-02-12 15:20:32 +03:00
Query mogrification in bytes.
This commit is contained in:
parent
c3196ebd9d
commit
87a7ebac10
|
@ -314,7 +314,7 @@ _psyco_curs_merge_query_args(cursorObject *self,
|
||||||
the curren exception (we will later restore it if the type or the
|
the curren exception (we will later restore it if the type or the
|
||||||
strings do not match.) */
|
strings do not match.) */
|
||||||
|
|
||||||
if (!(fquery = Text_Format(query, args))) {
|
if (!(fquery = Bytes_Format(query, args))) {
|
||||||
PyObject *err, *arg, *trace;
|
PyObject *err, *arg, *trace;
|
||||||
int pe = 0;
|
int pe = 0;
|
||||||
|
|
||||||
|
@ -397,15 +397,9 @@ _psyco_curs_execute(cursorObject *self,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (self->name != NULL) {
|
if (self->name != NULL) {
|
||||||
#if PY_MAJOR_VERSION < 3
|
self->query = Bytes_FromFormat(
|
||||||
self->query = PyString_FromFormat(
|
|
||||||
"DECLARE %s CURSOR WITHOUT HOLD FOR %s",
|
"DECLARE %s CURSOR WITHOUT HOLD FOR %s",
|
||||||
self->name, PyString_AS_STRING(fquery));
|
self->name, Bytes_AS_STRING(fquery));
|
||||||
#else
|
|
||||||
self->query = PyUnicode_FromFormat(
|
|
||||||
"DECLARE %s CURSOR WITHOUT HOLD FOR %U",
|
|
||||||
self->name, fquery);
|
|
||||||
#endif
|
|
||||||
Py_DECREF(fquery);
|
Py_DECREF(fquery);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -414,15 +408,9 @@ _psyco_curs_execute(cursorObject *self,
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (self->name != NULL) {
|
if (self->name != NULL) {
|
||||||
#if PY_MAJOR_VERSION < 3
|
self->query = Bytes_FromFormat(
|
||||||
self->query = PyString_FromFormat(
|
|
||||||
"DECLARE %s CURSOR WITHOUT HOLD FOR %s",
|
"DECLARE %s CURSOR WITHOUT HOLD FOR %s",
|
||||||
self->name, PyString_AS_STRING(operation));
|
self->name, Bytes_AS_STRING(operation));
|
||||||
#else
|
|
||||||
self->query = PyUnicode_FromFormat(
|
|
||||||
"DECLARE %s CURSOR WITHOUT HOLD FOR %U",
|
|
||||||
self->name, operation);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* Transfer reference ownership of the str in operation to
|
/* Transfer reference ownership of the str in operation to
|
||||||
|
|
Loading…
Reference in New Issue
Block a user