mirror of
https://github.com/psycopg/psycopg2.git
synced 2024-11-22 17:06:33 +03:00
Merge branch 'naming'
This commit is contained in:
commit
8b7506f80d
|
@ -60,7 +60,7 @@ asis_getquoted(asisObject *self, PyObject *args)
|
|||
static PyObject *
|
||||
asis_str(asisObject *self)
|
||||
{
|
||||
return psycopg_ensure_text(asis_getquoted(self, NULL));
|
||||
return psyco_ensure_text(asis_getquoted(self, NULL));
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
|
|
|
@ -132,7 +132,7 @@ binary_getquoted(binaryObject *self, PyObject *args)
|
|||
static PyObject *
|
||||
binary_str(binaryObject *self)
|
||||
{
|
||||
return psycopg_ensure_text(binary_getquoted(self, NULL));
|
||||
return psyco_ensure_text(binary_getquoted(self, NULL));
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
|
||||
|
||||
RAISES_NEG int
|
||||
psyco_adapter_datetime_init(void)
|
||||
adapter_datetime_init(void)
|
||||
{
|
||||
PyDateTime_IMPORT;
|
||||
|
||||
|
@ -76,7 +76,7 @@ _pydatetime_string_date_time(pydatetimeObject *self)
|
|||
break;
|
||||
}
|
||||
|
||||
if (!(iso = psycopg_ensure_bytes(
|
||||
if (!(iso = psyco_ensure_bytes(
|
||||
PyObject_CallMethod(self->wrapped, "isoformat", NULL)))) {
|
||||
goto error;
|
||||
}
|
||||
|
@ -126,7 +126,7 @@ pydatetime_getquoted(pydatetimeObject *self, PyObject *args)
|
|||
static PyObject *
|
||||
pydatetime_str(pydatetimeObject *self)
|
||||
{
|
||||
return psycopg_ensure_text(pydatetime_getquoted(self, NULL));
|
||||
return psyco_ensure_text(pydatetime_getquoted(self, NULL));
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
|
|
|
@ -45,7 +45,7 @@ typedef struct {
|
|||
} pydatetimeObject;
|
||||
|
||||
|
||||
RAISES_NEG HIDDEN int psyco_adapter_datetime_init(void);
|
||||
RAISES_NEG HIDDEN int adapter_datetime_init(void);
|
||||
|
||||
HIDDEN PyObject *psyco_Date(PyObject *module, PyObject *args);
|
||||
#define psyco_Date_doc \
|
||||
|
|
|
@ -165,7 +165,7 @@ exit:
|
|||
static PyObject *
|
||||
list_str(listObject *self)
|
||||
{
|
||||
return psycopg_ensure_text(list_quote(self));
|
||||
return psyco_ensure_text(list_quote(self));
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
|
|
|
@ -48,7 +48,7 @@ pboolean_getquoted(pbooleanObject *self, PyObject *args)
|
|||
static PyObject *
|
||||
pboolean_str(pbooleanObject *self)
|
||||
{
|
||||
return psycopg_ensure_text(pboolean_getquoted(self, NULL));
|
||||
return psyco_ensure_text(pboolean_getquoted(self, NULL));
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
|
|
|
@ -113,7 +113,7 @@ end:
|
|||
static PyObject *
|
||||
pdecimal_str(pdecimalObject *self)
|
||||
{
|
||||
return psycopg_ensure_text(pdecimal_getquoted(self, NULL));
|
||||
return psyco_ensure_text(pdecimal_getquoted(self, NULL));
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
|
|
|
@ -86,7 +86,7 @@ exit:
|
|||
static PyObject *
|
||||
pfloat_str(pfloatObject *self)
|
||||
{
|
||||
return psycopg_ensure_text(pfloat_getquoted(self, NULL));
|
||||
return psyco_ensure_text(pfloat_getquoted(self, NULL));
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
|
|
|
@ -91,7 +91,7 @@ exit:
|
|||
static PyObject *
|
||||
pint_str(pintObject *self)
|
||||
{
|
||||
return psycopg_ensure_text(pint_getquoted(self, NULL));
|
||||
return psyco_ensure_text(pint_getquoted(self, NULL));
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
|
|
|
@ -73,7 +73,7 @@ qstring_quote(qstringObject *self)
|
|||
|
||||
/* encode the string into buffer */
|
||||
Bytes_AsStringAndSize(str, &s, &len);
|
||||
if (!(buffer = psycopg_escape_string(self->conn, s, len, NULL, &qlen))) {
|
||||
if (!(buffer = psyco_escape_string(self->conn, s, len, NULL, &qlen))) {
|
||||
goto exit;
|
||||
}
|
||||
|
||||
|
@ -107,7 +107,7 @@ qstring_getquoted(qstringObject *self, PyObject *args)
|
|||
static PyObject *
|
||||
qstring_str(qstringObject *self)
|
||||
{
|
||||
return psycopg_ensure_text(qstring_getquoted(self, NULL));
|
||||
return psyco_ensure_text(qstring_getquoted(self, NULL));
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
|
@ -161,9 +161,9 @@ qstring_set_encoding(qstringObject *self, PyObject *pyenc)
|
|||
|
||||
/* get a C copy of the encoding (which may come from unicode) */
|
||||
Py_INCREF(pyenc);
|
||||
if (!(pyenc = psycopg_ensure_bytes(pyenc))) { goto exit; }
|
||||
if (!(pyenc = psyco_ensure_bytes(pyenc))) { goto exit; }
|
||||
if (!(tmp = Bytes_AsString(pyenc))) { goto exit; }
|
||||
if (0 > psycopg_strdup(&cenc, tmp, -1)) { goto exit; }
|
||||
if (0 > psyco_strdup(&cenc, tmp, -1)) { goto exit; }
|
||||
|
||||
Dprintf("qstring_set_encoding: encoding set to %s", cenc);
|
||||
PyMem_Free((void *)self->encoding);
|
||||
|
|
|
@ -79,7 +79,7 @@ const int SRV_STATE_UNCHANGED = -1;
|
|||
PyObject *
|
||||
conn_text_from_chars(connectionObject *self, const char *str)
|
||||
{
|
||||
return psycopg_text_from_chars_safe(str, -1, self ? self->pydecoder : NULL);
|
||||
return psyco_text_from_chars_safe(str, -1, self ? self->pydecoder : NULL);
|
||||
}
|
||||
|
||||
|
||||
|
@ -478,7 +478,7 @@ conn_get_python_codec(const char *encoding,
|
|||
|
||||
/* get the Python name of the encoding as a C string */
|
||||
if (!(encname = conn_pgenc_to_pyenc(encoding, &pgenc))) { goto exit; }
|
||||
if (!(encname = psycopg_ensure_bytes(encname))) { goto exit; }
|
||||
if (!(encname = psyco_ensure_bytes(encname))) { goto exit; }
|
||||
|
||||
/* Look up the codec functions */
|
||||
if (!(enc_tmp = PyCodec_Encoder(Bytes_AS_STRING(encname)))) { goto exit; }
|
||||
|
@ -1424,7 +1424,7 @@ conn_tpc_command(connectionObject *self, const char *cmd, xidObject *xid)
|
|||
Dprintf("conn_tpc_command: %s", cmd);
|
||||
|
||||
/* convert the xid into PostgreSQL transaction id while keeping the GIL */
|
||||
if (!(tid = psycopg_ensure_bytes(xid_get_tid(xid)))) { goto exit; }
|
||||
if (!(tid = psyco_ensure_bytes(xid_get_tid(xid)))) { goto exit; }
|
||||
if (!(ctid = Bytes_AsString(tid))) { goto exit; }
|
||||
|
||||
Py_BEGIN_ALLOW_THREADS;
|
||||
|
|
|
@ -112,10 +112,10 @@ psyco_conn_cursor(connectionObject *self, PyObject *args, PyObject *kwargs)
|
|||
goto exit;
|
||||
}
|
||||
|
||||
if (0 > psyco_curs_withhold_set((cursorObject *)obj, withhold)) {
|
||||
if (0 > curs_withhold_set((cursorObject *)obj, withhold)) {
|
||||
goto exit;
|
||||
}
|
||||
if (0 > psyco_curs_scrollable_set((cursorObject *)obj, scrollable)) {
|
||||
if (0 > curs_scrollable_set((cursorObject *)obj, scrollable)) {
|
||||
goto exit;
|
||||
}
|
||||
|
||||
|
@ -478,7 +478,7 @@ _psyco_conn_parse_isolevel(PyObject *pyval)
|
|||
|
||||
/* parse from the string -- this includes "default" */
|
||||
else {
|
||||
if (!(pyval = psycopg_ensure_bytes(pyval))) {
|
||||
if (!(pyval = psyco_ensure_bytes(pyval))) {
|
||||
goto exit;
|
||||
}
|
||||
for (level = 1; level <= 4; level++) {
|
||||
|
@ -516,7 +516,7 @@ _psyco_conn_parse_onoff(PyObject *pyval)
|
|||
rv = STATE_DEFAULT;
|
||||
}
|
||||
else if (PyUnicode_CheckExact(pyval) || Bytes_CheckExact(pyval)) {
|
||||
if (!(pyval = psycopg_ensure_bytes(pyval))) {
|
||||
if (!(pyval = psyco_ensure_bytes(pyval))) {
|
||||
goto exit;
|
||||
}
|
||||
if (0 == strcasecmp("default", Bytes_AS_STRING(pyval))) {
|
||||
|
@ -918,7 +918,7 @@ psyco_conn_get_dsn_parameters(connectionObject *self, PyObject *dummy)
|
|||
goto exit;
|
||||
}
|
||||
|
||||
res = psycopg_dict_from_conninfo_options(options, /* include_password = */ 0);
|
||||
res = psyco_dict_from_conninfo_options(options, /* include_password = */ 0);
|
||||
|
||||
exit:
|
||||
PQconninfoFree(options);
|
||||
|
@ -1314,7 +1314,7 @@ obscure_password(connectionObject *conn)
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (!(d = psycopg_dict_from_conninfo_options(
|
||||
if (!(d = psyco_dict_from_conninfo_options(
|
||||
options, /* include_password = */ 1))) {
|
||||
goto exit;
|
||||
}
|
||||
|
@ -1327,12 +1327,12 @@ obscure_password(connectionObject *conn)
|
|||
/* scrub the password and put back the connection string together */
|
||||
if (!(v = Text_FromUTF8("xxx"))) { goto exit; }
|
||||
if (0 > PyDict_SetItemString(d, "password", v)) { goto exit; }
|
||||
if (!(dsn = psycopg_make_dsn(Py_None, d))) { goto exit; }
|
||||
if (!(dsn = psycopg_ensure_bytes(dsn))) { goto exit; }
|
||||
if (!(dsn = psyco_make_dsn(Py_None, d))) { goto exit; }
|
||||
if (!(dsn = psyco_ensure_bytes(dsn))) { goto exit; }
|
||||
|
||||
/* Replace the connection string on the connection object */
|
||||
tmp = conn->dsn;
|
||||
psycopg_strdup(&conn->dsn, Bytes_AS_STRING(dsn), -1);
|
||||
psyco_strdup(&conn->dsn, Bytes_AS_STRING(dsn), -1);
|
||||
PyMem_Free(tmp);
|
||||
|
||||
rv = 0;
|
||||
|
@ -1356,7 +1356,7 @@ connection_setup(connectionObject *self, const char *dsn, long int async)
|
|||
self, async, Py_REFCNT(self)
|
||||
);
|
||||
|
||||
if (0 > psycopg_strdup(&self->dsn, dsn, -1)) { goto exit; }
|
||||
if (0 > psyco_strdup(&self->dsn, dsn, -1)) { goto exit; }
|
||||
if (!(self->notice_list = PyList_New(0))) { goto exit; }
|
||||
if (!(self->notifies = PyList_New(0))) { goto exit; }
|
||||
self->async = async;
|
||||
|
|
|
@ -193,7 +193,7 @@ dsn_parameters_get(connInfoObject *self)
|
|||
goto exit;
|
||||
}
|
||||
|
||||
res = psycopg_dict_from_conninfo_options(options, /* include_password = */ 0);
|
||||
res = psyco_dict_from_conninfo_options(options, /* include_password = */ 0);
|
||||
|
||||
exit:
|
||||
PQconninfoFree(options);
|
||||
|
|
|
@ -93,9 +93,9 @@ struct cursorObject {
|
|||
/* C-callable functions in cursor_int.c and cursor_type.c */
|
||||
BORROWED HIDDEN PyObject *curs_get_cast(cursorObject *self, PyObject *oid);
|
||||
HIDDEN void curs_reset(cursorObject *self);
|
||||
RAISES_NEG HIDDEN int psyco_curs_withhold_set(cursorObject *self, PyObject *pyvalue);
|
||||
RAISES_NEG HIDDEN int psyco_curs_scrollable_set(cursorObject *self, PyObject *pyvalue);
|
||||
HIDDEN PyObject *psyco_curs_validate_sql_basic(cursorObject *self, PyObject *sql);
|
||||
RAISES_NEG HIDDEN int curs_withhold_set(cursorObject *self, PyObject *pyvalue);
|
||||
RAISES_NEG HIDDEN int curs_scrollable_set(cursorObject *self, PyObject *pyvalue);
|
||||
HIDDEN PyObject *curs_validate_sql_basic(cursorObject *self, PyObject *sql);
|
||||
HIDDEN void curs_set_result(cursorObject *self, PGresult *pgres);
|
||||
|
||||
/* exception-raising macros */
|
||||
|
|
|
@ -108,7 +108,7 @@ exit:
|
|||
* after having set an exception.
|
||||
*/
|
||||
PyObject *
|
||||
psyco_curs_validate_sql_basic(cursorObject *self, PyObject *sql)
|
||||
curs_validate_sql_basic(cursorObject *self, PyObject *sql)
|
||||
{
|
||||
PyObject *rv = NULL;
|
||||
PyObject *comp = NULL;
|
||||
|
|
|
@ -43,11 +43,11 @@
|
|||
|
||||
/* close method - close the cursor */
|
||||
|
||||
#define psyco_curs_close_doc \
|
||||
#define curs_close_doc \
|
||||
"close() -- Close the cursor."
|
||||
|
||||
static PyObject *
|
||||
psyco_curs_close(cursorObject *self, PyObject *dummy)
|
||||
curs_close(cursorObject *self, PyObject *dummy)
|
||||
{
|
||||
PyObject *rv = NULL;
|
||||
char *lname = NULL;
|
||||
|
@ -86,7 +86,7 @@ psyco_curs_close(cursorObject *self, PyObject *dummy)
|
|||
* closing it (the view exists since PG 8.2 according to docs).
|
||||
*/
|
||||
if (!self->query && self->conn->server_version >= 80200) {
|
||||
if (!(lname = psycopg_escape_string(
|
||||
if (!(lname = psyco_escape_string(
|
||||
self->conn, self->name, -1, NULL, NULL))) {
|
||||
goto exit;
|
||||
}
|
||||
|
@ -110,7 +110,7 @@ close:
|
|||
CLEARPGRES(self->pgres);
|
||||
|
||||
self->closed = 1;
|
||||
Dprintf("psyco_curs_close: cursor at %p closed", self);
|
||||
Dprintf("curs_close: cursor at %p closed", self);
|
||||
|
||||
rv = Py_None;
|
||||
Py_INCREF(rv);
|
||||
|
@ -335,7 +335,7 @@ _psyco_curs_merge_query_args(cursorObject *self,
|
|||
PyErr_Fetch(&err, &arg, &trace);
|
||||
|
||||
if (err && PyErr_GivenExceptionMatches(err, PyExc_TypeError)) {
|
||||
Dprintf("psyco_curs_execute: TypeError exception caught");
|
||||
Dprintf("curs_execute: TypeError exception caught");
|
||||
PyErr_NormalizeException(&err, &arg, &trace);
|
||||
|
||||
if (PyObject_HasAttrString(arg, "args")) {
|
||||
|
@ -343,11 +343,11 @@ _psyco_curs_merge_query_args(cursorObject *self,
|
|||
PyObject *str = PySequence_GetItem(args, 0);
|
||||
const char *s = Bytes_AS_STRING(str);
|
||||
|
||||
Dprintf("psyco_curs_execute: -> %s", s);
|
||||
Dprintf("curs_execute: -> %s", s);
|
||||
|
||||
if (!strcmp(s, "not enough arguments for format string")
|
||||
|| !strcmp(s, "not all arguments converted")) {
|
||||
Dprintf("psyco_curs_execute: -> got a match");
|
||||
Dprintf("curs_execute: -> got a match");
|
||||
psyco_set_error(ProgrammingError, self, s);
|
||||
pe = 1;
|
||||
}
|
||||
|
@ -369,7 +369,7 @@ _psyco_curs_merge_query_args(cursorObject *self,
|
|||
return fquery;
|
||||
}
|
||||
|
||||
#define psyco_curs_execute_doc \
|
||||
#define curs_execute_doc \
|
||||
"execute(query, vars=None) -- Execute query with bound vars."
|
||||
|
||||
RAISES_NEG static int
|
||||
|
@ -382,13 +382,13 @@ _psyco_curs_execute(cursorObject *self,
|
|||
PyObject *fquery = NULL, *cvt = NULL;
|
||||
|
||||
/* query becomes NULL or refcount +1, so good to XDECREF at the end */
|
||||
if (!(query = psyco_curs_validate_sql_basic(self, query))) {
|
||||
if (!(query = curs_validate_sql_basic(self, query))) {
|
||||
goto exit;
|
||||
}
|
||||
|
||||
CLEARPGRES(self->pgres);
|
||||
Py_CLEAR(self->query);
|
||||
Dprintf("psyco_curs_execute: starting execution of new query");
|
||||
Dprintf("curs_execute: starting execution of new query");
|
||||
|
||||
/* here we are, and we have a sequence or a dictionary filled with
|
||||
objects to be substituted (bound variables). we try to be smart and do
|
||||
|
@ -444,7 +444,7 @@ _psyco_curs_execute(cursorObject *self,
|
|||
|
||||
/* At this point, the SQL statement must be str, not unicode */
|
||||
tmp = pq_execute(self, Bytes_AS_STRING(self->query), async, no_result, 0);
|
||||
Dprintf("psyco_curs_execute: res = %d, pgres = %p", tmp, self->pgres);
|
||||
Dprintf("curs_execute: res = %d, pgres = %p", tmp, self->pgres);
|
||||
if (tmp < 0) { goto exit; }
|
||||
|
||||
res = 0; /* Success */
|
||||
|
@ -458,7 +458,7 @@ exit:
|
|||
}
|
||||
|
||||
static PyObject *
|
||||
psyco_curs_execute(cursorObject *self, PyObject *args, PyObject *kwargs)
|
||||
curs_execute(cursorObject *self, PyObject *args, PyObject *kwargs)
|
||||
{
|
||||
PyObject *vars = NULL, *operation = NULL;
|
||||
|
||||
|
@ -495,11 +495,11 @@ psyco_curs_execute(cursorObject *self, PyObject *args, PyObject *kwargs)
|
|||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
#define psyco_curs_executemany_doc \
|
||||
#define curs_executemany_doc \
|
||||
"executemany(query, vars_list) -- Execute many queries with bound vars."
|
||||
|
||||
static PyObject *
|
||||
psyco_curs_executemany(cursorObject *self, PyObject *args, PyObject *kwargs)
|
||||
curs_executemany(cursorObject *self, PyObject *args, PyObject *kwargs)
|
||||
{
|
||||
PyObject *operation = NULL, *vars = NULL;
|
||||
PyObject *v, *iter = NULL;
|
||||
|
@ -556,7 +556,7 @@ psyco_curs_executemany(cursorObject *self, PyObject *args, PyObject *kwargs)
|
|||
}
|
||||
|
||||
|
||||
#define psyco_curs_mogrify_doc \
|
||||
#define curs_mogrify_doc \
|
||||
"mogrify(query, vars=None) -> str -- Return query after vars binding."
|
||||
|
||||
static PyObject *
|
||||
|
@ -565,10 +565,10 @@ _psyco_curs_mogrify(cursorObject *self,
|
|||
{
|
||||
PyObject *fquery = NULL, *cvt = NULL;
|
||||
|
||||
operation = psyco_curs_validate_sql_basic(self, operation);
|
||||
operation = curs_validate_sql_basic(self, operation);
|
||||
if (operation == NULL) { goto cleanup; }
|
||||
|
||||
Dprintf("psyco_curs_mogrify: starting mogrify");
|
||||
Dprintf("curs_mogrify: starting mogrify");
|
||||
|
||||
/* here we are, and we have a sequence or a dictionary filled with
|
||||
objects to be substituted (bound variables). we try to be smart and do
|
||||
|
@ -586,7 +586,7 @@ _psyco_curs_mogrify(cursorObject *self,
|
|||
goto cleanup;
|
||||
}
|
||||
|
||||
Dprintf("psyco_curs_mogrify: cvt->refcnt = " FORMAT_CODE_PY_SSIZE_T
|
||||
Dprintf("curs_mogrify: cvt->refcnt = " FORMAT_CODE_PY_SSIZE_T
|
||||
", fquery->refcnt = " FORMAT_CODE_PY_SSIZE_T,
|
||||
Py_REFCNT(cvt), Py_REFCNT(fquery));
|
||||
}
|
||||
|
@ -603,7 +603,7 @@ cleanup:
|
|||
}
|
||||
|
||||
static PyObject *
|
||||
psyco_curs_mogrify(cursorObject *self, PyObject *args, PyObject *kwargs)
|
||||
curs_mogrify(cursorObject *self, PyObject *args, PyObject *kwargs)
|
||||
{
|
||||
PyObject *vars = NULL, *operation = NULL;
|
||||
|
||||
|
@ -619,7 +619,7 @@ psyco_curs_mogrify(cursorObject *self, PyObject *args, PyObject *kwargs)
|
|||
|
||||
|
||||
/* cast method - convert an oid/string into a Python object */
|
||||
#define psyco_curs_cast_doc \
|
||||
#define curs_cast_doc \
|
||||
"cast(oid, s) -> value\n\n" \
|
||||
"Convert the string s to a Python object according to its oid.\n\n" \
|
||||
"Look for a typecaster first in the cursor, then in its connection," \
|
||||
|
@ -627,7 +627,7 @@ psyco_curs_mogrify(cursorObject *self, PyObject *args, PyObject *kwargs)
|
|||
"leave the value as a string."
|
||||
|
||||
static PyObject *
|
||||
psyco_curs_cast(cursorObject *self, PyObject *args)
|
||||
curs_cast(cursorObject *self, PyObject *args)
|
||||
{
|
||||
PyObject *oid;
|
||||
PyObject *s;
|
||||
|
@ -643,7 +643,7 @@ psyco_curs_cast(cursorObject *self, PyObject *args)
|
|||
|
||||
/* fetchone method - fetch one row of results */
|
||||
|
||||
#define psyco_curs_fetchone_doc \
|
||||
#define curs_fetchone_doc \
|
||||
"fetchone() -> tuple or None\n\n" \
|
||||
"Return the next row of a query result set in the form of a tuple (by\n" \
|
||||
"default) or using the sequence factory previously set in the\n" \
|
||||
|
@ -744,7 +744,7 @@ exit:
|
|||
}
|
||||
|
||||
static PyObject *
|
||||
psyco_curs_fetchone(cursorObject *self, PyObject *dummy)
|
||||
curs_fetchone(cursorObject *self, PyObject *dummy)
|
||||
{
|
||||
PyObject *res;
|
||||
|
||||
|
@ -763,8 +763,8 @@ psyco_curs_fetchone(cursorObject *self, PyObject *dummy)
|
|||
if (_psyco_curs_prefetch(self) < 0) return NULL;
|
||||
}
|
||||
|
||||
Dprintf("psyco_curs_fetchone: fetching row %ld", self->row);
|
||||
Dprintf("psyco_curs_fetchone: rowcount = %ld", self->rowcount);
|
||||
Dprintf("curs_fetchone: fetching row %ld", self->row);
|
||||
Dprintf("curs_fetchone: rowcount = %ld", self->rowcount);
|
||||
|
||||
if (self->row >= self->rowcount) {
|
||||
/* we exausted available data: return None */
|
||||
|
@ -789,11 +789,11 @@ psyco_curs_fetchone(cursorObject *self, PyObject *dummy)
|
|||
* Fetch several records at time. Return NULL when the cursor is exhausted.
|
||||
*/
|
||||
static PyObject *
|
||||
psyco_curs_next_named(cursorObject *self)
|
||||
curs_next_named(cursorObject *self)
|
||||
{
|
||||
PyObject *res;
|
||||
|
||||
Dprintf("psyco_curs_next_named");
|
||||
Dprintf("curs_next_named");
|
||||
EXC_IF_CURS_CLOSED(self);
|
||||
EXC_IF_ASYNC_IN_PROGRESS(self, next);
|
||||
if (_psyco_curs_prefetch(self) < 0) return NULL;
|
||||
|
@ -802,8 +802,8 @@ psyco_curs_next_named(cursorObject *self)
|
|||
EXC_IF_NO_MARK(self);
|
||||
EXC_IF_TPC_PREPARED(self->conn, next);
|
||||
|
||||
Dprintf("psyco_curs_next_named: row %ld", self->row);
|
||||
Dprintf("psyco_curs_next_named: rowcount = %ld", self->rowcount);
|
||||
Dprintf("curs_next_named: row %ld", self->row);
|
||||
Dprintf("curs_next_named: rowcount = %ld", self->rowcount);
|
||||
if (self->row >= self->rowcount) {
|
||||
char buffer[128];
|
||||
|
||||
|
@ -834,7 +834,7 @@ psyco_curs_next_named(cursorObject *self)
|
|||
|
||||
/* fetch many - fetch some results */
|
||||
|
||||
#define psyco_curs_fetchmany_doc \
|
||||
#define curs_fetchmany_doc \
|
||||
"fetchmany(size=self.arraysize) -> list of tuple\n\n" \
|
||||
"Return the next `size` rows of a query result set in the form of a list\n" \
|
||||
"of tuples (by default) or using the sequence factory previously set in\n" \
|
||||
|
@ -842,7 +842,7 @@ psyco_curs_next_named(cursorObject *self)
|
|||
"Return an empty list when no more data is available.\n"
|
||||
|
||||
static PyObject *
|
||||
psyco_curs_fetchmany(cursorObject *self, PyObject *args, PyObject *kwords)
|
||||
curs_fetchmany(cursorObject *self, PyObject *args, PyObject *kwords)
|
||||
{
|
||||
int i;
|
||||
PyObject *list = NULL;
|
||||
|
@ -887,7 +887,7 @@ psyco_curs_fetchmany(cursorObject *self, PyObject *args, PyObject *kwords)
|
|||
size = self->rowcount - self->row;
|
||||
}
|
||||
|
||||
Dprintf("psyco_curs_fetchmany: size = %ld", size);
|
||||
Dprintf("curs_fetchmany: size = %ld", size);
|
||||
|
||||
if (size <= 0) {
|
||||
rv = PyList_New(0);
|
||||
|
@ -927,7 +927,7 @@ exit:
|
|||
|
||||
/* fetch all - fetch all results */
|
||||
|
||||
#define psyco_curs_fetchall_doc \
|
||||
#define curs_fetchall_doc \
|
||||
"fetchall() -> list of tuple\n\n" \
|
||||
"Return all the remaining rows of a query result set.\n\n" \
|
||||
"Rows are returned in the form of a list of tuples (by default) or using\n" \
|
||||
|
@ -935,7 +935,7 @@ exit:
|
|||
"Return `!None` when no more data is available.\n"
|
||||
|
||||
static PyObject *
|
||||
psyco_curs_fetchall(cursorObject *self, PyObject *dummy)
|
||||
curs_fetchall(cursorObject *self, PyObject *dummy)
|
||||
{
|
||||
int i, size;
|
||||
PyObject *list = NULL;
|
||||
|
@ -996,11 +996,11 @@ exit:
|
|||
|
||||
/* callproc method - execute a stored procedure */
|
||||
|
||||
#define psyco_curs_callproc_doc \
|
||||
#define curs_callproc_doc \
|
||||
"callproc(procname, parameters=None) -- Execute stored procedure."
|
||||
|
||||
static PyObject *
|
||||
psyco_curs_callproc(cursorObject *self, PyObject *args)
|
||||
curs_callproc(cursorObject *self, PyObject *args)
|
||||
{
|
||||
const char *procname = NULL;
|
||||
char *sql = NULL;
|
||||
|
@ -1059,10 +1059,10 @@ psyco_curs_callproc(cursorObject *self, PyObject *args)
|
|||
Py_INCREF(pname); /* was borrowed */
|
||||
|
||||
/* this also makes a check for keys being strings */
|
||||
if (!(pname = psycopg_ensure_bytes(pname))) { goto exit; }
|
||||
if (!(pname = psyco_ensure_bytes(pname))) { goto exit; }
|
||||
if (!(cpname = Bytes_AsString(pname))) { goto exit; }
|
||||
|
||||
if (!(scpnames[i] = psycopg_escape_identifier(
|
||||
if (!(scpnames[i] = psyco_escape_identifier(
|
||||
self->conn, cpname, -1))) {
|
||||
Py_CLEAR(pname);
|
||||
goto exit;
|
||||
|
@ -1144,13 +1144,13 @@ exit:
|
|||
|
||||
/* nextset method - return the next set of data (not supported) */
|
||||
|
||||
#define psyco_curs_nextset_doc \
|
||||
#define curs_nextset_doc \
|
||||
"nextset() -- Skip to next set of data.\n\n" \
|
||||
"This method is not supported (PostgreSQL does not have multiple data \n" \
|
||||
"sets) and will raise a NotSupportedError exception."
|
||||
|
||||
static PyObject *
|
||||
psyco_curs_nextset(cursorObject *self, PyObject *dummy)
|
||||
curs_nextset(cursorObject *self, PyObject *dummy)
|
||||
{
|
||||
EXC_IF_CURS_CLOSED(self);
|
||||
|
||||
|
@ -1161,12 +1161,12 @@ psyco_curs_nextset(cursorObject *self, PyObject *dummy)
|
|||
|
||||
/* setinputsizes - predefine memory areas for execute (does nothing) */
|
||||
|
||||
#define psyco_curs_setinputsizes_doc \
|
||||
#define curs_setinputsizes_doc \
|
||||
"setinputsizes(sizes) -- Set memory areas before execute.\n\n" \
|
||||
"This method currently does nothing but it is safe to call it."
|
||||
|
||||
static PyObject *
|
||||
psyco_curs_setinputsizes(cursorObject *self, PyObject *args)
|
||||
curs_setinputsizes(cursorObject *self, PyObject *args)
|
||||
{
|
||||
PyObject *sizes;
|
||||
|
||||
|
@ -1181,12 +1181,12 @@ psyco_curs_setinputsizes(cursorObject *self, PyObject *args)
|
|||
|
||||
/* setoutputsize - predefine memory areas for execute (does nothing) */
|
||||
|
||||
#define psyco_curs_setoutputsize_doc \
|
||||
#define curs_setoutputsize_doc \
|
||||
"setoutputsize(size, column=None) -- Set column buffer size.\n\n" \
|
||||
"This method currently does nothing but it is safe to call it."
|
||||
|
||||
static PyObject *
|
||||
psyco_curs_setoutputsize(cursorObject *self, PyObject *args)
|
||||
curs_setoutputsize(cursorObject *self, PyObject *args)
|
||||
{
|
||||
long int size, column;
|
||||
|
||||
|
@ -1201,11 +1201,11 @@ psyco_curs_setoutputsize(cursorObject *self, PyObject *args)
|
|||
|
||||
/* scroll - scroll position in result list */
|
||||
|
||||
#define psyco_curs_scroll_doc \
|
||||
#define curs_scroll_doc \
|
||||
"scroll(value, mode='relative') -- Scroll to new position according to mode."
|
||||
|
||||
static PyObject *
|
||||
psyco_curs_scroll(cursorObject *self, PyObject *args, PyObject *kwargs)
|
||||
curs_scroll(cursorObject *self, PyObject *args, PyObject *kwargs)
|
||||
{
|
||||
int value, newpos;
|
||||
const char *mode = "relative";
|
||||
|
@ -1263,21 +1263,21 @@ psyco_curs_scroll(cursorObject *self, PyObject *args, PyObject *kwargs)
|
|||
}
|
||||
|
||||
|
||||
#define psyco_curs_enter_doc \
|
||||
#define curs_enter_doc \
|
||||
"__enter__ -> self"
|
||||
|
||||
static PyObject *
|
||||
psyco_curs_enter(cursorObject *self, PyObject *dummy)
|
||||
curs_enter(cursorObject *self, PyObject *dummy)
|
||||
{
|
||||
Py_INCREF(self);
|
||||
return (PyObject *)self;
|
||||
}
|
||||
|
||||
#define psyco_curs_exit_doc \
|
||||
#define curs_exit_doc \
|
||||
"__exit__ -- close the cursor"
|
||||
|
||||
static PyObject *
|
||||
psyco_curs_exit(cursorObject *self, PyObject *args)
|
||||
curs_exit(cursorObject *self, PyObject *args)
|
||||
{
|
||||
PyObject *tmp = NULL;
|
||||
PyObject *rv = NULL;
|
||||
|
@ -1332,7 +1332,7 @@ static char *_psyco_curs_copy_columns(PyObject *columns)
|
|||
columnlist[0] = '(';
|
||||
|
||||
while ((col = PyIter_Next(coliter)) != NULL) {
|
||||
if (!(col = psycopg_ensure_bytes(col))) {
|
||||
if (!(col = psyco_ensure_bytes(col))) {
|
||||
Py_DECREF(coliter);
|
||||
goto error;
|
||||
}
|
||||
|
@ -1379,11 +1379,11 @@ exit:
|
|||
|
||||
/* extension: copy_from - implements COPY FROM */
|
||||
|
||||
#define psyco_curs_copy_from_doc \
|
||||
#define curs_copy_from_doc \
|
||||
"copy_from(file, table, sep='\\t', null='\\\\N', size=8192, columns=None) -- Copy table from file."
|
||||
|
||||
static PyObject *
|
||||
psyco_curs_copy_from(cursorObject *self, PyObject *args, PyObject *kwargs)
|
||||
curs_copy_from(cursorObject *self, PyObject *args, PyObject *kwargs)
|
||||
{
|
||||
static char *kwlist[] = {
|
||||
"file", "table", "sep", "null", "size", "columns", NULL};
|
||||
|
@ -1423,12 +1423,12 @@ psyco_curs_copy_from(cursorObject *self, PyObject *args, PyObject *kwargs)
|
|||
if (NULL == (columnlist = _psyco_curs_copy_columns(columns)))
|
||||
goto exit;
|
||||
|
||||
if (!(quoted_delimiter = psycopg_escape_string(
|
||||
if (!(quoted_delimiter = psyco_escape_string(
|
||||
self->conn, sep, -1, NULL, NULL))) {
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (!(quoted_null = psycopg_escape_string(
|
||||
if (!(quoted_null = psyco_escape_string(
|
||||
self->conn, null, -1, NULL, NULL))) {
|
||||
goto exit;
|
||||
}
|
||||
|
@ -1443,10 +1443,10 @@ psyco_curs_copy_from(cursorObject *self, PyObject *args, PyObject *kwargs)
|
|||
PyOS_snprintf(query, query_size, command,
|
||||
table_name, columnlist, quoted_delimiter, quoted_null);
|
||||
|
||||
Dprintf("psyco_curs_copy_from: query = %s", query);
|
||||
Dprintf("curs_copy_from: query = %s", query);
|
||||
|
||||
/* This routine stores a borrowed reference. Although it is only held
|
||||
* for the duration of psyco_curs_copy_from, nested invocations of
|
||||
* for the duration of curs_copy_from, nested invocations of
|
||||
* Py_BEGIN_ALLOW_THREADS could surrender control to another thread,
|
||||
* which could invoke the garbage collector. We thus need an
|
||||
* INCREF/DECREF pair if we store this pointer in a GC object, such as
|
||||
|
@ -1473,11 +1473,11 @@ exit:
|
|||
|
||||
/* extension: copy_to - implements COPY TO */
|
||||
|
||||
#define psyco_curs_copy_to_doc \
|
||||
#define curs_copy_to_doc \
|
||||
"copy_to(file, table, sep='\\t', null='\\\\N', columns=None) -- Copy table to file."
|
||||
|
||||
static PyObject *
|
||||
psyco_curs_copy_to(cursorObject *self, PyObject *args, PyObject *kwargs)
|
||||
curs_copy_to(cursorObject *self, PyObject *args, PyObject *kwargs)
|
||||
{
|
||||
static char *kwlist[] = {"file", "table", "sep", "null", "columns", NULL};
|
||||
|
||||
|
@ -1515,12 +1515,12 @@ psyco_curs_copy_to(cursorObject *self, PyObject *args, PyObject *kwargs)
|
|||
if (NULL == (columnlist = _psyco_curs_copy_columns(columns)))
|
||||
goto exit;
|
||||
|
||||
if (!(quoted_delimiter = psycopg_escape_string(
|
||||
if (!(quoted_delimiter = psyco_escape_string(
|
||||
self->conn, sep, -1, NULL, NULL))) {
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (!(quoted_null = psycopg_escape_string(
|
||||
if (!(quoted_null = psyco_escape_string(
|
||||
self->conn, null, -1, NULL, NULL))) {
|
||||
goto exit;
|
||||
}
|
||||
|
@ -1535,7 +1535,7 @@ psyco_curs_copy_to(cursorObject *self, PyObject *args, PyObject *kwargs)
|
|||
PyOS_snprintf(query, query_size, command,
|
||||
table_name, columnlist, quoted_delimiter, quoted_null);
|
||||
|
||||
Dprintf("psyco_curs_copy_to: query = %s", query);
|
||||
Dprintf("curs_copy_to: query = %s", query);
|
||||
|
||||
self->copysize = 0;
|
||||
Py_INCREF(file);
|
||||
|
@ -1563,7 +1563,7 @@ exit:
|
|||
SQL statement, rather than composing the statement from parameters.
|
||||
*/
|
||||
|
||||
#define psyco_curs_copy_expert_doc \
|
||||
#define curs_copy_expert_doc \
|
||||
"copy_expert(sql, file, size=8192) -- Submit a user-composed COPY statement.\n" \
|
||||
"`file` must be an open, readable file for COPY FROM or an open, writable\n" \
|
||||
"file for COPY TO. The optional `size` argument, when specified for a COPY\n" \
|
||||
|
@ -1571,7 +1571,7 @@ exit:
|
|||
"buffer size."
|
||||
|
||||
static PyObject *
|
||||
psyco_curs_copy_expert(cursorObject *self, PyObject *args, PyObject *kwargs)
|
||||
curs_copy_expert(cursorObject *self, PyObject *args, PyObject *kwargs)
|
||||
{
|
||||
Py_ssize_t bufsize = DEFAULT_COPYBUFF;
|
||||
PyObject *sql, *file, *res = NULL;
|
||||
|
@ -1587,7 +1587,7 @@ psyco_curs_copy_expert(cursorObject *self, PyObject *args, PyObject *kwargs)
|
|||
EXC_IF_GREEN(copy_expert);
|
||||
EXC_IF_TPC_PREPARED(self->conn, copy_expert);
|
||||
|
||||
sql = psyco_curs_validate_sql_basic(self, sql);
|
||||
sql = curs_validate_sql_basic(self, sql);
|
||||
|
||||
/* Any failure from here forward should 'goto exit' rather than
|
||||
'return NULL' directly. */
|
||||
|
@ -1630,28 +1630,28 @@ exit:
|
|||
|
||||
/* extension: closed - return true if cursor is closed */
|
||||
|
||||
#define psyco_curs_closed_doc \
|
||||
#define curs_closed_doc \
|
||||
"True if cursor is closed, False if cursor is open"
|
||||
|
||||
static PyObject *
|
||||
psyco_curs_get_closed(cursorObject *self, void *closure)
|
||||
curs_closed_get(cursorObject *self, void *closure)
|
||||
{
|
||||
return PyBool_FromLong(self->closed || (self->conn && self->conn->closed));
|
||||
}
|
||||
|
||||
/* extension: withhold - get or set "WITH HOLD" for named cursors */
|
||||
|
||||
#define psyco_curs_withhold_doc \
|
||||
#define curs_withhold_doc \
|
||||
"Set or return cursor use of WITH HOLD"
|
||||
|
||||
static PyObject *
|
||||
psyco_curs_withhold_get(cursorObject *self)
|
||||
curs_withhold_get(cursorObject *self)
|
||||
{
|
||||
return PyBool_FromLong(self->withhold);
|
||||
}
|
||||
|
||||
RAISES_NEG int
|
||||
psyco_curs_withhold_set(cursorObject *self, PyObject *pyvalue)
|
||||
curs_withhold_set(cursorObject *self, PyObject *pyvalue)
|
||||
{
|
||||
int value;
|
||||
|
||||
|
@ -1669,11 +1669,11 @@ psyco_curs_withhold_set(cursorObject *self, PyObject *pyvalue)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#define psyco_curs_scrollable_doc \
|
||||
#define curs_scrollable_doc \
|
||||
"Set or return cursor use of SCROLL"
|
||||
|
||||
static PyObject *
|
||||
psyco_curs_scrollable_get(cursorObject *self)
|
||||
curs_scrollable_get(cursorObject *self)
|
||||
{
|
||||
PyObject *ret = NULL;
|
||||
|
||||
|
@ -1696,7 +1696,7 @@ psyco_curs_scrollable_get(cursorObject *self)
|
|||
}
|
||||
|
||||
RAISES_NEG int
|
||||
psyco_curs_scrollable_set(cursorObject *self, PyObject *pyvalue)
|
||||
curs_scrollable_set(cursorObject *self, PyObject *pyvalue)
|
||||
{
|
||||
int value;
|
||||
|
||||
|
@ -1718,11 +1718,11 @@ psyco_curs_scrollable_set(cursorObject *self, PyObject *pyvalue)
|
|||
}
|
||||
|
||||
|
||||
#define psyco_curs_pgresult_ptr_doc \
|
||||
#define curs_pgresult_ptr_doc \
|
||||
"pgresult_ptr -- Get the PGresult structure pointer."
|
||||
|
||||
static PyObject *
|
||||
psyco_curs_pgresult_ptr_get(cursorObject *self)
|
||||
curs_pgresult_ptr_get(cursorObject *self)
|
||||
{
|
||||
if (self->pgres) {
|
||||
return PyLong_FromVoidPtr((void *)self->pgres);
|
||||
|
@ -1751,8 +1751,8 @@ cursor_next(PyObject *self)
|
|||
PyObject *res;
|
||||
|
||||
if (NULL == ((cursorObject*)self)->name) {
|
||||
/* we don't parse arguments: psyco_curs_fetchone will do that for us */
|
||||
res = psyco_curs_fetchone((cursorObject*)self, NULL);
|
||||
/* we don't parse arguments: curs_fetchone will do that for us */
|
||||
res = curs_fetchone((cursorObject*)self, NULL);
|
||||
|
||||
/* convert a None to NULL to signal the end of iteration */
|
||||
if (res && res == Py_None) {
|
||||
|
@ -1761,7 +1761,7 @@ cursor_next(PyObject *self)
|
|||
}
|
||||
}
|
||||
else {
|
||||
res = psyco_curs_next_named((cursorObject*)self);
|
||||
res = curs_next_named((cursorObject*)self);
|
||||
}
|
||||
|
||||
return res;
|
||||
|
@ -1771,44 +1771,44 @@ cursor_next(PyObject *self)
|
|||
|
||||
static struct PyMethodDef cursorObject_methods[] = {
|
||||
/* DBAPI-2.0 core */
|
||||
{"close", (PyCFunction)psyco_curs_close,
|
||||
METH_NOARGS, psyco_curs_close_doc},
|
||||
{"execute", (PyCFunction)psyco_curs_execute,
|
||||
METH_VARARGS|METH_KEYWORDS, psyco_curs_execute_doc},
|
||||
{"executemany", (PyCFunction)psyco_curs_executemany,
|
||||
METH_VARARGS|METH_KEYWORDS, psyco_curs_executemany_doc},
|
||||
{"fetchone", (PyCFunction)psyco_curs_fetchone,
|
||||
METH_NOARGS, psyco_curs_fetchone_doc},
|
||||
{"fetchmany", (PyCFunction)psyco_curs_fetchmany,
|
||||
METH_VARARGS|METH_KEYWORDS, psyco_curs_fetchmany_doc},
|
||||
{"fetchall", (PyCFunction)psyco_curs_fetchall,
|
||||
METH_NOARGS, psyco_curs_fetchall_doc},
|
||||
{"callproc", (PyCFunction)psyco_curs_callproc,
|
||||
METH_VARARGS, psyco_curs_callproc_doc},
|
||||
{"nextset", (PyCFunction)psyco_curs_nextset,
|
||||
METH_NOARGS, psyco_curs_nextset_doc},
|
||||
{"setinputsizes", (PyCFunction)psyco_curs_setinputsizes,
|
||||
METH_VARARGS, psyco_curs_setinputsizes_doc},
|
||||
{"setoutputsize", (PyCFunction)psyco_curs_setoutputsize,
|
||||
METH_VARARGS, psyco_curs_setoutputsize_doc},
|
||||
{"close", (PyCFunction)curs_close,
|
||||
METH_NOARGS, curs_close_doc},
|
||||
{"execute", (PyCFunction)curs_execute,
|
||||
METH_VARARGS|METH_KEYWORDS, curs_execute_doc},
|
||||
{"executemany", (PyCFunction)curs_executemany,
|
||||
METH_VARARGS|METH_KEYWORDS, curs_executemany_doc},
|
||||
{"fetchone", (PyCFunction)curs_fetchone,
|
||||
METH_NOARGS, curs_fetchone_doc},
|
||||
{"fetchmany", (PyCFunction)curs_fetchmany,
|
||||
METH_VARARGS|METH_KEYWORDS, curs_fetchmany_doc},
|
||||
{"fetchall", (PyCFunction)curs_fetchall,
|
||||
METH_NOARGS, curs_fetchall_doc},
|
||||
{"callproc", (PyCFunction)curs_callproc,
|
||||
METH_VARARGS, curs_callproc_doc},
|
||||
{"nextset", (PyCFunction)curs_nextset,
|
||||
METH_NOARGS, curs_nextset_doc},
|
||||
{"setinputsizes", (PyCFunction)curs_setinputsizes,
|
||||
METH_VARARGS, curs_setinputsizes_doc},
|
||||
{"setoutputsize", (PyCFunction)curs_setoutputsize,
|
||||
METH_VARARGS, curs_setoutputsize_doc},
|
||||
/* DBAPI-2.0 extensions */
|
||||
{"scroll", (PyCFunction)psyco_curs_scroll,
|
||||
METH_VARARGS|METH_KEYWORDS, psyco_curs_scroll_doc},
|
||||
{"__enter__", (PyCFunction)psyco_curs_enter,
|
||||
METH_NOARGS, psyco_curs_enter_doc},
|
||||
{"__exit__", (PyCFunction)psyco_curs_exit,
|
||||
METH_VARARGS, psyco_curs_exit_doc},
|
||||
{"scroll", (PyCFunction)curs_scroll,
|
||||
METH_VARARGS|METH_KEYWORDS, curs_scroll_doc},
|
||||
{"__enter__", (PyCFunction)curs_enter,
|
||||
METH_NOARGS, curs_enter_doc},
|
||||
{"__exit__", (PyCFunction)curs_exit,
|
||||
METH_VARARGS, curs_exit_doc},
|
||||
/* psycopg extensions */
|
||||
{"cast", (PyCFunction)psyco_curs_cast,
|
||||
METH_VARARGS, psyco_curs_cast_doc},
|
||||
{"mogrify", (PyCFunction)psyco_curs_mogrify,
|
||||
METH_VARARGS|METH_KEYWORDS, psyco_curs_mogrify_doc},
|
||||
{"copy_from", (PyCFunction)psyco_curs_copy_from,
|
||||
METH_VARARGS|METH_KEYWORDS, psyco_curs_copy_from_doc},
|
||||
{"copy_to", (PyCFunction)psyco_curs_copy_to,
|
||||
METH_VARARGS|METH_KEYWORDS, psyco_curs_copy_to_doc},
|
||||
{"copy_expert", (PyCFunction)psyco_curs_copy_expert,
|
||||
METH_VARARGS|METH_KEYWORDS, psyco_curs_copy_expert_doc},
|
||||
{"cast", (PyCFunction)curs_cast,
|
||||
METH_VARARGS, curs_cast_doc},
|
||||
{"mogrify", (PyCFunction)curs_mogrify,
|
||||
METH_VARARGS|METH_KEYWORDS, curs_mogrify_doc},
|
||||
{"copy_from", (PyCFunction)curs_copy_from,
|
||||
METH_VARARGS|METH_KEYWORDS, curs_copy_from_doc},
|
||||
{"copy_to", (PyCFunction)curs_copy_to,
|
||||
METH_VARARGS|METH_KEYWORDS, curs_copy_to_doc},
|
||||
{"copy_expert", (PyCFunction)curs_copy_expert,
|
||||
METH_VARARGS|METH_KEYWORDS, curs_copy_expert_doc},
|
||||
{NULL}
|
||||
};
|
||||
|
||||
|
@ -1849,19 +1849,19 @@ static struct PyMemberDef cursorObject_members[] = {
|
|||
|
||||
/* object calculated member list */
|
||||
static struct PyGetSetDef cursorObject_getsets[] = {
|
||||
{ "closed", (getter)psyco_curs_get_closed, NULL,
|
||||
psyco_curs_closed_doc, NULL },
|
||||
{ "closed", (getter)curs_closed_get, NULL,
|
||||
curs_closed_doc, NULL },
|
||||
{ "withhold",
|
||||
(getter)psyco_curs_withhold_get,
|
||||
(setter)psyco_curs_withhold_set,
|
||||
psyco_curs_withhold_doc, NULL },
|
||||
(getter)curs_withhold_get,
|
||||
(setter)curs_withhold_set,
|
||||
curs_withhold_doc, NULL },
|
||||
{ "scrollable",
|
||||
(getter)psyco_curs_scrollable_get,
|
||||
(setter)psyco_curs_scrollable_set,
|
||||
psyco_curs_scrollable_doc, NULL },
|
||||
(getter)curs_scrollable_get,
|
||||
(setter)curs_scrollable_set,
|
||||
curs_scrollable_doc, NULL },
|
||||
{ "pgresult_ptr",
|
||||
(getter)psyco_curs_pgresult_ptr_get, NULL,
|
||||
psyco_curs_pgresult_ptr_doc, NULL },
|
||||
(getter)curs_pgresult_ptr_get, NULL,
|
||||
curs_pgresult_ptr_doc, NULL },
|
||||
{NULL}
|
||||
};
|
||||
|
||||
|
@ -1874,10 +1874,10 @@ cursor_setup(cursorObject *self, connectionObject *conn, const char *name)
|
|||
Dprintf("cursor_setup: parameters: name = %s, conn = %p", name, conn);
|
||||
|
||||
if (name) {
|
||||
if (0 > psycopg_strdup(&self->name, name, -1)) {
|
||||
if (0 > psyco_strdup(&self->name, name, -1)) {
|
||||
return -1;
|
||||
}
|
||||
if (!(self->qname = psycopg_escape_identifier(conn, name, -1))) {
|
||||
if (!(self->qname = psyco_escape_identifier(conn, name, -1))) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
@ -1982,7 +1982,7 @@ cursor_init(PyObject *obj, PyObject *args, PyObject *kwargs)
|
|||
|
||||
if (name != Py_None) {
|
||||
Py_INCREF(name); /* for ensure_bytes */
|
||||
if (!(bname = psycopg_ensure_bytes(name))) {
|
||||
if (!(bname = psyco_ensure_bytes(name))) {
|
||||
/* name has had a ref stolen */
|
||||
goto exit;
|
||||
}
|
||||
|
|
|
@ -61,7 +61,7 @@
|
|||
* If the cursor or its result isn't available, return None.
|
||||
*/
|
||||
static PyObject *
|
||||
psyco_diagnostics_get_field(diagnosticsObject *self, void *closure)
|
||||
diagnostics_get_field(diagnosticsObject *self, void *closure)
|
||||
{
|
||||
const char *errortext;
|
||||
|
||||
|
@ -76,41 +76,41 @@ psyco_diagnostics_get_field(diagnosticsObject *self, void *closure)
|
|||
|
||||
/* object calculated member list */
|
||||
static struct PyGetSetDef diagnosticsObject_getsets[] = {
|
||||
{ "severity", (getter)psyco_diagnostics_get_field, NULL,
|
||||
{ "severity", (getter)diagnostics_get_field, NULL,
|
||||
NULL, (void*) PG_DIAG_SEVERITY },
|
||||
{ "severity_nonlocalized", (getter)psyco_diagnostics_get_field, NULL,
|
||||
{ "severity_nonlocalized", (getter)diagnostics_get_field, NULL,
|
||||
NULL, (void*) PG_DIAG_SEVERITY_NONLOCALIZED },
|
||||
{ "sqlstate", (getter)psyco_diagnostics_get_field, NULL,
|
||||
{ "sqlstate", (getter)diagnostics_get_field, NULL,
|
||||
NULL, (void*) PG_DIAG_SQLSTATE },
|
||||
{ "message_primary", (getter)psyco_diagnostics_get_field, NULL,
|
||||
{ "message_primary", (getter)diagnostics_get_field, NULL,
|
||||
NULL, (void*) PG_DIAG_MESSAGE_PRIMARY },
|
||||
{ "message_detail", (getter)psyco_diagnostics_get_field, NULL,
|
||||
{ "message_detail", (getter)diagnostics_get_field, NULL,
|
||||
NULL, (void*) PG_DIAG_MESSAGE_DETAIL },
|
||||
{ "message_hint", (getter)psyco_diagnostics_get_field, NULL,
|
||||
{ "message_hint", (getter)diagnostics_get_field, NULL,
|
||||
NULL, (void*) PG_DIAG_MESSAGE_HINT },
|
||||
{ "statement_position", (getter)psyco_diagnostics_get_field, NULL,
|
||||
{ "statement_position", (getter)diagnostics_get_field, NULL,
|
||||
NULL, (void*) PG_DIAG_STATEMENT_POSITION },
|
||||
{ "internal_position", (getter)psyco_diagnostics_get_field, NULL,
|
||||
{ "internal_position", (getter)diagnostics_get_field, NULL,
|
||||
NULL, (void*) PG_DIAG_INTERNAL_POSITION },
|
||||
{ "internal_query", (getter)psyco_diagnostics_get_field, NULL,
|
||||
{ "internal_query", (getter)diagnostics_get_field, NULL,
|
||||
NULL, (void*) PG_DIAG_INTERNAL_QUERY },
|
||||
{ "context", (getter)psyco_diagnostics_get_field, NULL,
|
||||
{ "context", (getter)diagnostics_get_field, NULL,
|
||||
NULL, (void*) PG_DIAG_CONTEXT },
|
||||
{ "schema_name", (getter)psyco_diagnostics_get_field, NULL,
|
||||
{ "schema_name", (getter)diagnostics_get_field, NULL,
|
||||
NULL, (void*) PG_DIAG_SCHEMA_NAME },
|
||||
{ "table_name", (getter)psyco_diagnostics_get_field, NULL,
|
||||
{ "table_name", (getter)diagnostics_get_field, NULL,
|
||||
NULL, (void*) PG_DIAG_TABLE_NAME },
|
||||
{ "column_name", (getter)psyco_diagnostics_get_field, NULL,
|
||||
{ "column_name", (getter)diagnostics_get_field, NULL,
|
||||
NULL, (void*) PG_DIAG_COLUMN_NAME },
|
||||
{ "datatype_name", (getter)psyco_diagnostics_get_field, NULL,
|
||||
{ "datatype_name", (getter)diagnostics_get_field, NULL,
|
||||
NULL, (void*) PG_DIAG_DATATYPE_NAME },
|
||||
{ "constraint_name", (getter)psyco_diagnostics_get_field, NULL,
|
||||
{ "constraint_name", (getter)diagnostics_get_field, NULL,
|
||||
NULL, (void*) PG_DIAG_CONSTRAINT_NAME },
|
||||
{ "source_file", (getter)psyco_diagnostics_get_field, NULL,
|
||||
{ "source_file", (getter)diagnostics_get_field, NULL,
|
||||
NULL, (void*) PG_DIAG_SOURCE_FILE },
|
||||
{ "source_line", (getter)psyco_diagnostics_get_field, NULL,
|
||||
{ "source_line", (getter)diagnostics_get_field, NULL,
|
||||
NULL, (void*) PG_DIAG_SOURCE_LINE },
|
||||
{ "source_function", (getter)psyco_diagnostics_get_field, NULL,
|
||||
{ "source_function", (getter)diagnostics_get_field, NULL,
|
||||
NULL, (void*) PG_DIAG_SOURCE_FUNCTION },
|
||||
{NULL}
|
||||
};
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
PyObject *
|
||||
error_text_from_chars(errorObject *self, const char *str)
|
||||
{
|
||||
return psycopg_text_from_chars_safe(str, -1, self->pydecoder);
|
||||
return psyco_text_from_chars_safe(str, -1, self->pydecoder);
|
||||
}
|
||||
|
||||
|
||||
|
@ -229,7 +229,7 @@ static struct PyGetSetDef error_getsets[] = {
|
|||
* would require implementing __getstate__, and as of 2012 it's a little
|
||||
* bit too late to care. */
|
||||
static PyObject *
|
||||
psyco_error_reduce(errorObject *self, PyObject *dummy)
|
||||
error_reduce(errorObject *self, PyObject *dummy)
|
||||
{
|
||||
PyObject *meth = NULL;
|
||||
PyObject *tuple = NULL;
|
||||
|
@ -288,7 +288,7 @@ error:
|
|||
}
|
||||
|
||||
PyObject *
|
||||
psyco_error_setstate(errorObject *self, PyObject *state)
|
||||
error_setstate(errorObject *self, PyObject *state)
|
||||
{
|
||||
PyObject *rv = NULL;
|
||||
|
||||
|
@ -326,8 +326,8 @@ error:
|
|||
|
||||
static PyMethodDef error_methods[] = {
|
||||
/* Make Error and all its subclasses picklable. */
|
||||
{"__reduce__", (PyCFunction)psyco_error_reduce, METH_NOARGS },
|
||||
{"__setstate__", (PyCFunction)psyco_error_setstate, METH_O },
|
||||
{"__reduce__", (PyCFunction)error_reduce, METH_NOARGS },
|
||||
{"__setstate__", (PyCFunction)error_setstate, METH_O },
|
||||
{NULL}
|
||||
};
|
||||
|
||||
|
|
|
@ -36,33 +36,33 @@
|
|||
|
||||
/* getquoted - return quoted representation for object */
|
||||
|
||||
#define psyco_isqlquote_getquoted_doc \
|
||||
#define isqlquote_getquoted_doc \
|
||||
"getquoted() -- return SQL-quoted representation of this object"
|
||||
|
||||
static PyObject *
|
||||
psyco_isqlquote_getquoted(isqlquoteObject *self, PyObject *args)
|
||||
isqlquote_getquoted(isqlquoteObject *self, PyObject *args)
|
||||
{
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
/* getbinary - return quoted representation for object */
|
||||
|
||||
#define psyco_isqlquote_getbinary_doc \
|
||||
#define isqlquote_getbinary_doc \
|
||||
"getbinary() -- return SQL-quoted binary representation of this object"
|
||||
|
||||
static PyObject *
|
||||
psyco_isqlquote_getbinary(isqlquoteObject *self, PyObject *args)
|
||||
isqlquote_getbinary(isqlquoteObject *self, PyObject *args)
|
||||
{
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
/* getbuffer - return quoted representation for object */
|
||||
|
||||
#define psyco_isqlquote_getbuffer_doc \
|
||||
#define isqlquote_getbuffer_doc \
|
||||
"getbuffer() -- return this object"
|
||||
|
||||
static PyObject *
|
||||
psyco_isqlquote_getbuffer(isqlquoteObject *self, PyObject *args)
|
||||
isqlquote_getbuffer(isqlquoteObject *self, PyObject *args)
|
||||
{
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
@ -75,14 +75,12 @@ psyco_isqlquote_getbuffer(isqlquoteObject *self, PyObject *args)
|
|||
/* object method list */
|
||||
|
||||
static struct PyMethodDef isqlquoteObject_methods[] = {
|
||||
{"getquoted", (PyCFunction)psyco_isqlquote_getquoted,
|
||||
METH_NOARGS, psyco_isqlquote_getquoted_doc},
|
||||
{"getbinary", (PyCFunction)psyco_isqlquote_getbinary,
|
||||
METH_NOARGS, psyco_isqlquote_getbinary_doc},
|
||||
{"getbuffer", (PyCFunction)psyco_isqlquote_getbuffer,
|
||||
METH_NOARGS, psyco_isqlquote_getbuffer_doc},
|
||||
/* {"prepare", (PyCFunction)psyco_isqlquote_prepare,
|
||||
METH_VARARGS, psyco_isqlquote_prepare_doc}, */
|
||||
{"getquoted", (PyCFunction)isqlquote_getquoted,
|
||||
METH_NOARGS, isqlquote_getquoted_doc},
|
||||
{"getbinary", (PyCFunction)isqlquote_getbinary,
|
||||
METH_NOARGS, isqlquote_getbinary_doc},
|
||||
{"getbuffer", (PyCFunction)isqlquote_getbuffer,
|
||||
METH_NOARGS, isqlquote_getbuffer_doc},
|
||||
{NULL}
|
||||
};
|
||||
|
||||
|
|
|
@ -657,7 +657,7 @@ pq_tpc_command_locked(
|
|||
PyEval_RestoreThread(*tstate);
|
||||
|
||||
/* convert the xid into the postgres transaction_id and quote it. */
|
||||
if (!(etid = psycopg_escape_string(conn, tid, -1, NULL, NULL)))
|
||||
if (!(etid = psyco_escape_string(conn, tid, -1, NULL, NULL)))
|
||||
{ goto exit; }
|
||||
|
||||
/* prepare the command to the server */
|
||||
|
@ -1298,7 +1298,7 @@ _pq_copy_in_v3(cursorObject *curs)
|
|||
if (ex) {
|
||||
PyObject *str;
|
||||
str = PyObject_Str(ex);
|
||||
str = psycopg_ensure_bytes(str);
|
||||
str = psyco_ensure_bytes(str);
|
||||
if (str) {
|
||||
PyOS_snprintf(buf, sizeof(buf),
|
||||
"error in .read() call: %s %s",
|
||||
|
@ -1374,7 +1374,7 @@ _pq_copy_out_v3(cursorObject *curs)
|
|||
}
|
||||
|
||||
/* if the file is text we must pass it unicode. */
|
||||
if (-1 == (is_text = psycopg_is_text_file(curs->copyfile))) {
|
||||
if (-1 == (is_text = psyco_is_text_file(curs->copyfile))) {
|
||||
goto exit;
|
||||
}
|
||||
|
||||
|
|
|
@ -120,11 +120,11 @@ psyco_connect(PyObject *self, PyObject *args, PyObject *keywds)
|
|||
}
|
||||
|
||||
|
||||
#define psyco_parse_dsn_doc \
|
||||
#define parse_dsn_doc \
|
||||
"parse_dsn(dsn) -> dict -- parse a connection string into parameters"
|
||||
|
||||
static PyObject *
|
||||
psyco_parse_dsn(PyObject *self, PyObject *args, PyObject *kwargs)
|
||||
parse_dsn(PyObject *self, PyObject *args, PyObject *kwargs)
|
||||
{
|
||||
char *err = NULL;
|
||||
PQconninfoOption *options = NULL;
|
||||
|
@ -136,7 +136,7 @@ psyco_parse_dsn(PyObject *self, PyObject *args, PyObject *kwargs)
|
|||
}
|
||||
|
||||
Py_INCREF(dsn); /* for ensure_bytes */
|
||||
if (!(dsn = psycopg_ensure_bytes(dsn))) { goto exit; }
|
||||
if (!(dsn = psyco_ensure_bytes(dsn))) { goto exit; }
|
||||
|
||||
options = PQconninfoParse(Bytes_AS_STRING(dsn), &err);
|
||||
if (options == NULL) {
|
||||
|
@ -149,7 +149,7 @@ psyco_parse_dsn(PyObject *self, PyObject *args, PyObject *kwargs)
|
|||
goto exit;
|
||||
}
|
||||
|
||||
res = psycopg_dict_from_conninfo_options(options, /* include_password = */ 1);
|
||||
res = psyco_dict_from_conninfo_options(options, /* include_password = */ 1);
|
||||
|
||||
exit:
|
||||
PQconninfoFree(options); /* safe on null */
|
||||
|
@ -159,14 +159,14 @@ exit:
|
|||
}
|
||||
|
||||
|
||||
#define psyco_quote_ident_doc \
|
||||
#define quote_ident_doc \
|
||||
"quote_ident(str, conn_or_curs) -> str -- wrapper around PQescapeIdentifier\n\n" \
|
||||
":Parameters:\n" \
|
||||
" * `str`: A bytes or unicode object\n" \
|
||||
" * `conn_or_curs`: A connection or cursor, required"
|
||||
|
||||
static PyObject *
|
||||
psyco_quote_ident(PyObject *self, PyObject *args, PyObject *kwargs)
|
||||
quote_ident(PyObject *self, PyObject *args, PyObject *kwargs)
|
||||
{
|
||||
PyObject *ident = NULL, *obj = NULL, *result = NULL;
|
||||
connectionObject *conn;
|
||||
|
@ -190,9 +190,9 @@ psyco_quote_ident(PyObject *self, PyObject *args, PyObject *kwargs)
|
|||
}
|
||||
|
||||
Py_INCREF(ident); /* for ensure_bytes */
|
||||
if (!(ident = psycopg_ensure_bytes(ident))) { goto exit; }
|
||||
if (!(ident = psyco_ensure_bytes(ident))) { goto exit; }
|
||||
|
||||
if (!(quoted = psycopg_escape_identifier(conn,
|
||||
if (!(quoted = psyco_escape_identifier(conn,
|
||||
Bytes_AS_STRING(ident), Bytes_GET_SIZE(ident)))) { goto exit; }
|
||||
|
||||
result = conn_text_from_chars(conn, quoted);
|
||||
|
@ -205,7 +205,7 @@ exit:
|
|||
}
|
||||
|
||||
/** type registration **/
|
||||
#define psyco_register_type_doc \
|
||||
#define register_type_doc \
|
||||
"register_type(obj, conn_or_curs) -> None -- register obj with psycopg type system\n\n" \
|
||||
":Parameters:\n" \
|
||||
" * `obj`: A type adapter created by `new_type()`\n" \
|
||||
|
@ -233,7 +233,7 @@ exit:
|
|||
" * `baseobj`: Adapter to perform type conversion of a single array item."
|
||||
|
||||
static PyObject *
|
||||
psyco_register_type(PyObject *self, PyObject *args)
|
||||
register_type(PyObject *self, PyObject *args)
|
||||
{
|
||||
PyObject *type, *obj = NULL;
|
||||
|
||||
|
@ -271,7 +271,7 @@ psyco_register_type(PyObject *self, PyObject *args)
|
|||
|
||||
/* Make sure libcrypto thread callbacks are set up. */
|
||||
static void
|
||||
psyco_libcrypto_threads_init(void)
|
||||
libcrypto_threads_init(void)
|
||||
{
|
||||
PyObject *m;
|
||||
|
||||
|
@ -406,20 +406,20 @@ exit:
|
|||
return rv;
|
||||
}
|
||||
|
||||
#define psyco_libpq_version_doc "Query actual libpq version loaded."
|
||||
#define libpq_version_doc "Query actual libpq version loaded."
|
||||
|
||||
static PyObject*
|
||||
psyco_libpq_version(PyObject *self, PyObject *dummy)
|
||||
libpq_version(PyObject *self, PyObject *dummy)
|
||||
{
|
||||
return PyInt_FromLong(PQlibVersion());
|
||||
}
|
||||
|
||||
/* encrypt_password - Prepare the encrypted password form */
|
||||
#define psyco_encrypt_password_doc \
|
||||
#define encrypt_password_doc \
|
||||
"encrypt_password(password, user, [scope], [algorithm]) -- Prepares the encrypted form of a PostgreSQL password.\n\n"
|
||||
|
||||
static PyObject *
|
||||
psyco_encrypt_password(PyObject *self, PyObject *args, PyObject *kwargs)
|
||||
encrypt_password(PyObject *self, PyObject *args, PyObject *kwargs)
|
||||
{
|
||||
char *encrypted = NULL;
|
||||
PyObject *password = NULL, *user = NULL;
|
||||
|
@ -453,10 +453,10 @@ psyco_encrypt_password(PyObject *self, PyObject *args, PyObject *kwargs)
|
|||
}
|
||||
}
|
||||
|
||||
if (!(user = psycopg_ensure_bytes(user))) { goto exit; }
|
||||
if (!(password = psycopg_ensure_bytes(password))) { goto exit; }
|
||||
if (!(user = psyco_ensure_bytes(user))) { goto exit; }
|
||||
if (!(password = psyco_ensure_bytes(password))) { goto exit; }
|
||||
if (algorithm != Py_None) {
|
||||
if (!(algorithm = psycopg_ensure_bytes(algorithm))) {
|
||||
if (!(algorithm = psyco_ensure_bytes(algorithm))) {
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
|
@ -945,9 +945,9 @@ datetime_init(void)
|
|||
|
||||
/* Initialize the PyDateTimeAPI everywhere is used */
|
||||
PyDateTime_IMPORT;
|
||||
if (0 > psyco_adapter_datetime_init()) { return -1; }
|
||||
if (0 > psyco_repl_curs_datetime_init()) { return -1; }
|
||||
if (0 > psyco_replmsg_datetime_init()) { return -1; }
|
||||
if (0 > adapter_datetime_init()) { return -1; }
|
||||
if (0 > repl_curs_datetime_init()) { return -1; }
|
||||
if (0 > replmsg_datetime_init()) { return -1; }
|
||||
|
||||
Py_TYPE(&pydatetimeType) = &PyType_Type;
|
||||
if (0 > PyType_Ready(&pydatetimeType)) { return -1; }
|
||||
|
@ -988,21 +988,21 @@ mxdatetime_init(PyObject *module)
|
|||
static PyMethodDef psycopgMethods[] = {
|
||||
{"_connect", (PyCFunction)psyco_connect,
|
||||
METH_VARARGS|METH_KEYWORDS, psyco_connect_doc},
|
||||
{"parse_dsn", (PyCFunction)psyco_parse_dsn,
|
||||
METH_VARARGS|METH_KEYWORDS, psyco_parse_dsn_doc},
|
||||
{"quote_ident", (PyCFunction)psyco_quote_ident,
|
||||
METH_VARARGS|METH_KEYWORDS, psyco_quote_ident_doc},
|
||||
{"parse_dsn", (PyCFunction)parse_dsn,
|
||||
METH_VARARGS|METH_KEYWORDS, parse_dsn_doc},
|
||||
{"quote_ident", (PyCFunction)quote_ident,
|
||||
METH_VARARGS|METH_KEYWORDS, quote_ident_doc},
|
||||
{"adapt", (PyCFunction)psyco_microprotocols_adapt,
|
||||
METH_VARARGS, psyco_microprotocols_adapt_doc},
|
||||
|
||||
{"register_type", (PyCFunction)psyco_register_type,
|
||||
METH_VARARGS, psyco_register_type_doc},
|
||||
{"register_type", (PyCFunction)register_type,
|
||||
METH_VARARGS, register_type_doc},
|
||||
{"new_type", (PyCFunction)typecast_from_python,
|
||||
METH_VARARGS|METH_KEYWORDS, typecast_from_python_doc},
|
||||
{"new_array_type", (PyCFunction)typecast_array_from_python,
|
||||
METH_VARARGS|METH_KEYWORDS, typecast_array_from_python_doc},
|
||||
{"libpq_version", (PyCFunction)psyco_libpq_version,
|
||||
METH_NOARGS, psyco_libpq_version_doc},
|
||||
{"libpq_version", (PyCFunction)libpq_version,
|
||||
METH_NOARGS, libpq_version_doc},
|
||||
|
||||
{"Date", (PyCFunction)psyco_Date,
|
||||
METH_VARARGS, psyco_Date_doc},
|
||||
|
@ -1042,8 +1042,8 @@ static PyMethodDef psycopgMethods[] = {
|
|||
METH_O, psyco_set_wait_callback_doc},
|
||||
{"get_wait_callback", (PyCFunction)psyco_get_wait_callback,
|
||||
METH_NOARGS, psyco_get_wait_callback_doc},
|
||||
{"encrypt_password", (PyCFunction)psyco_encrypt_password,
|
||||
METH_VARARGS|METH_KEYWORDS, psyco_encrypt_password_doc},
|
||||
{"encrypt_password", (PyCFunction)encrypt_password,
|
||||
METH_VARARGS|METH_KEYWORDS, encrypt_password_doc},
|
||||
|
||||
{NULL, NULL, 0, NULL} /* Sentinel */
|
||||
};
|
||||
|
@ -1078,7 +1078,7 @@ INIT_MODULE(_psycopg)(void)
|
|||
Dprintf("psycopgmodule: initializing psycopg %s", xstr(PSYCOPG_VERSION));
|
||||
|
||||
/* initialize libcrypto threading callbacks */
|
||||
psyco_libcrypto_threads_init();
|
||||
libcrypto_threads_init();
|
||||
|
||||
/* initialize types and objects not exposed to the module */
|
||||
Py_TYPE(&typecastType) = &PyType_Type;
|
||||
|
|
|
@ -97,7 +97,7 @@ replicationConnection_init(replicationConnectionObject *self,
|
|||
goto exit;
|
||||
}
|
||||
|
||||
if (!(newdsn = psycopg_make_dsn(dsn, dsnopts))) { goto exit; }
|
||||
if (!(newdsn = psyco_make_dsn(dsn, dsnopts))) { goto exit; }
|
||||
if (!(newargs = PyTuple_Pack(2, newdsn, async))) { goto exit; }
|
||||
|
||||
/* only attempt the connection once we've handled all possible errors */
|
||||
|
|
|
@ -50,7 +50,7 @@ typedef struct replicationCursorObject {
|
|||
} replicationCursorObject;
|
||||
|
||||
|
||||
RAISES_NEG HIDDEN int psyco_repl_curs_datetime_init(void);
|
||||
RAISES_NEG HIDDEN int repl_curs_datetime_init(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -38,11 +38,11 @@
|
|||
#include "datetime.h"
|
||||
|
||||
|
||||
#define psyco_repl_curs_start_replication_expert_doc \
|
||||
#define start_replication_expert_doc \
|
||||
"start_replication_expert(command, decode=False) -- Start replication with a given command."
|
||||
|
||||
static PyObject *
|
||||
psyco_repl_curs_start_replication_expert(replicationCursorObject *self,
|
||||
start_replication_expert(replicationCursorObject *self,
|
||||
PyObject *args, PyObject *kwargs)
|
||||
{
|
||||
cursorObject *curs = &self->cur;
|
||||
|
@ -60,12 +60,11 @@ psyco_repl_curs_start_replication_expert(replicationCursorObject *self,
|
|||
EXC_IF_GREEN(start_replication_expert);
|
||||
EXC_IF_TPC_PREPARED(conn, start_replication_expert);
|
||||
|
||||
if (!(command = psyco_curs_validate_sql_basic(
|
||||
(cursorObject *)self, command))) {
|
||||
if (!(command = curs_validate_sql_basic((cursorObject *)self, command))) {
|
||||
goto exit;
|
||||
}
|
||||
|
||||
Dprintf("psyco_repl_curs_start_replication_expert: '%s'; decode: %ld",
|
||||
Dprintf("start_replication_expert: '%s'; decode: %ld",
|
||||
Bytes_AS_STRING(command), decode);
|
||||
|
||||
if (pq_execute(curs, Bytes_AS_STRING(command), conn->async,
|
||||
|
@ -82,11 +81,11 @@ exit:
|
|||
return res;
|
||||
}
|
||||
|
||||
#define psyco_repl_curs_consume_stream_doc \
|
||||
#define consume_stream_doc \
|
||||
"consume_stream(consumer, keepalive_interval=10) -- Consume replication stream."
|
||||
|
||||
static PyObject *
|
||||
psyco_repl_curs_consume_stream(replicationCursorObject *self,
|
||||
consume_stream(replicationCursorObject *self,
|
||||
PyObject *args, PyObject *kwargs)
|
||||
{
|
||||
cursorObject *curs = &self->cur;
|
||||
|
@ -104,7 +103,7 @@ psyco_repl_curs_consume_stream(replicationCursorObject *self,
|
|||
EXC_IF_GREEN(consume_stream);
|
||||
EXC_IF_TPC_PREPARED(self->cur.conn, consume_stream);
|
||||
|
||||
Dprintf("psyco_repl_curs_consume_stream");
|
||||
Dprintf("consume_stream");
|
||||
|
||||
if (keepalive_interval < 1.0) {
|
||||
psyco_set_error(ProgrammingError, curs, "keepalive_interval must be >= 1 (sec)");
|
||||
|
@ -136,11 +135,11 @@ psyco_repl_curs_consume_stream(replicationCursorObject *self,
|
|||
return res;
|
||||
}
|
||||
|
||||
#define psyco_repl_curs_read_message_doc \
|
||||
#define read_message_doc \
|
||||
"read_message() -- Try reading a replication message from the server (non-blocking)."
|
||||
|
||||
static PyObject *
|
||||
psyco_repl_curs_read_message(replicationCursorObject *self, PyObject *dummy)
|
||||
read_message(replicationCursorObject *self, PyObject *dummy)
|
||||
{
|
||||
cursorObject *curs = &self->cur;
|
||||
replicationMessageObject *msg = NULL;
|
||||
|
@ -159,11 +158,11 @@ psyco_repl_curs_read_message(replicationCursorObject *self, PyObject *dummy)
|
|||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
#define psyco_repl_curs_send_feedback_doc \
|
||||
#define send_feedback_doc \
|
||||
"send_feedback(write_lsn=0, flush_lsn=0, apply_lsn=0, reply=False) -- Try sending a replication feedback message to the server and optionally request a reply."
|
||||
|
||||
static PyObject *
|
||||
psyco_repl_curs_send_feedback(replicationCursorObject *self,
|
||||
send_feedback(replicationCursorObject *self,
|
||||
PyObject *args, PyObject *kwargs)
|
||||
{
|
||||
cursorObject *curs = &self->cur;
|
||||
|
@ -196,7 +195,7 @@ psyco_repl_curs_send_feedback(replicationCursorObject *self,
|
|||
|
||||
|
||||
RAISES_NEG int
|
||||
psyco_repl_curs_datetime_init(void)
|
||||
repl_curs_datetime_init(void)
|
||||
{
|
||||
PyDateTime_IMPORT;
|
||||
|
||||
|
@ -207,11 +206,11 @@ psyco_repl_curs_datetime_init(void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#define psyco_repl_curs_io_timestamp_doc \
|
||||
#define repl_curs_io_timestamp_doc \
|
||||
"io_timestamp -- the timestamp of latest IO with the server"
|
||||
|
||||
static PyObject *
|
||||
psyco_repl_curs_get_io_timestamp(replicationCursorObject *self)
|
||||
repl_curs_get_io_timestamp(replicationCursorObject *self)
|
||||
{
|
||||
cursorObject *curs = &self->cur;
|
||||
PyObject *tval, *res = NULL;
|
||||
|
@ -232,14 +231,14 @@ psyco_repl_curs_get_io_timestamp(replicationCursorObject *self)
|
|||
/* object method list */
|
||||
|
||||
static struct PyMethodDef replicationCursorObject_methods[] = {
|
||||
{"start_replication_expert", (PyCFunction)psyco_repl_curs_start_replication_expert,
|
||||
METH_VARARGS|METH_KEYWORDS, psyco_repl_curs_start_replication_expert_doc},
|
||||
{"consume_stream", (PyCFunction)psyco_repl_curs_consume_stream,
|
||||
METH_VARARGS|METH_KEYWORDS, psyco_repl_curs_consume_stream_doc},
|
||||
{"read_message", (PyCFunction)psyco_repl_curs_read_message,
|
||||
METH_NOARGS, psyco_repl_curs_read_message_doc},
|
||||
{"send_feedback", (PyCFunction)psyco_repl_curs_send_feedback,
|
||||
METH_VARARGS|METH_KEYWORDS, psyco_repl_curs_send_feedback_doc},
|
||||
{"start_replication_expert", (PyCFunction)start_replication_expert,
|
||||
METH_VARARGS|METH_KEYWORDS, start_replication_expert_doc},
|
||||
{"consume_stream", (PyCFunction)consume_stream,
|
||||
METH_VARARGS|METH_KEYWORDS, consume_stream_doc},
|
||||
{"read_message", (PyCFunction)read_message,
|
||||
METH_NOARGS, read_message_doc},
|
||||
{"send_feedback", (PyCFunction)send_feedback,
|
||||
METH_VARARGS|METH_KEYWORDS, send_feedback_doc},
|
||||
{NULL}
|
||||
};
|
||||
|
||||
|
@ -247,8 +246,8 @@ static struct PyMethodDef replicationCursorObject_methods[] = {
|
|||
|
||||
static struct PyGetSetDef replicationCursorObject_getsets[] = {
|
||||
{ "io_timestamp",
|
||||
(getter)psyco_repl_curs_get_io_timestamp, NULL,
|
||||
psyco_repl_curs_io_timestamp_doc, NULL },
|
||||
(getter)repl_curs_get_io_timestamp, NULL,
|
||||
repl_curs_io_timestamp_doc, NULL },
|
||||
{NULL}
|
||||
};
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ struct replicationMessageObject {
|
|||
int64_t send_time;
|
||||
};
|
||||
|
||||
RAISES_NEG HIDDEN int psyco_replmsg_datetime_init(void);
|
||||
RAISES_NEG HIDDEN int replmsg_datetime_init(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
#include "datetime.h"
|
||||
|
||||
RAISES_NEG int
|
||||
psyco_replmsg_datetime_init(void)
|
||||
replmsg_datetime_init(void)
|
||||
{
|
||||
PyDateTime_IMPORT;
|
||||
|
||||
|
@ -102,11 +102,11 @@ replmsg_dealloc(PyObject* obj)
|
|||
Py_TYPE(obj)->tp_free(obj);
|
||||
}
|
||||
|
||||
#define psyco_replmsg_send_time_doc \
|
||||
#define replmsg_send_time_doc \
|
||||
"send_time - Timestamp of the replication message departure from the server."
|
||||
|
||||
static PyObject *
|
||||
psyco_replmsg_get_send_time(replicationMessageObject *self)
|
||||
replmsg_get_send_time(replicationMessageObject *self)
|
||||
{
|
||||
PyObject *tval, *res = NULL;
|
||||
double t;
|
||||
|
@ -142,8 +142,8 @@ static struct PyMemberDef replicationMessageObject_members[] = {
|
|||
};
|
||||
|
||||
static struct PyGetSetDef replicationMessageObject_getsets[] = {
|
||||
{ "send_time", (getter)psyco_replmsg_get_send_time, NULL,
|
||||
psyco_replmsg_send_time_doc, NULL },
|
||||
{ "send_time", (getter)replmsg_get_send_time, NULL,
|
||||
replmsg_send_time_doc, NULL },
|
||||
{NULL}
|
||||
};
|
||||
|
||||
|
|
|
@ -291,7 +291,7 @@ typecast_init(PyObject *module)
|
|||
|
||||
/* register the date/time typecasters with their original names */
|
||||
#ifdef HAVE_MXDATETIME
|
||||
if (0 == psyco_typecast_mxdatetime_init()) {
|
||||
if (0 == typecast_mxdatetime_init()) {
|
||||
for (i = 0; typecast_mxdatetime[i].name != NULL; i++) {
|
||||
t = (typecastObject *)typecast_from_c(&(typecast_mxdatetime[i]), dict);
|
||||
if (t == NULL) { goto exit; }
|
||||
|
@ -302,7 +302,7 @@ typecast_init(PyObject *module)
|
|||
}
|
||||
#endif
|
||||
|
||||
if (0 > psyco_typecast_datetime_init()) { goto exit; }
|
||||
if (0 > typecast_datetime_init()) { goto exit; }
|
||||
for (i = 0; typecast_pydatetime[i].name != NULL; i++) {
|
||||
t = (typecastObject *)typecast_from_c(&(typecast_pydatetime[i]), dict);
|
||||
if (t == NULL) { goto exit; }
|
||||
|
@ -435,7 +435,7 @@ typecast_repr(PyObject *self)
|
|||
PyObject *rv;
|
||||
|
||||
Py_INCREF(name);
|
||||
if (!(name = psycopg_ensure_bytes(name))) {
|
||||
if (!(name = psyco_ensure_bytes(name))) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -141,7 +141,7 @@ typecast_DECIMAL_cast(const char *s, Py_ssize_t len, PyObject *curs)
|
|||
if ((buffer = PyMem_Malloc(len+1)) == NULL)
|
||||
return PyErr_NoMemory();
|
||||
strncpy(buffer, s, (size_t) len); buffer[len] = '\0';
|
||||
decimalType = psyco_GetDecimalType();
|
||||
decimalType = psyco_get_decimal_type();
|
||||
/* Fall back on float if decimal is not available */
|
||||
if (decimalType != NULL) {
|
||||
res = PyObject_CallFunction(decimalType, "s", buffer);
|
||||
|
|
|
@ -132,9 +132,9 @@ PyTypeObject chunkType = {
|
|||
};
|
||||
|
||||
|
||||
static char *psycopg_parse_hex(
|
||||
static char *parse_hex(
|
||||
const char *bufin, Py_ssize_t sizein, Py_ssize_t *sizeout);
|
||||
static char *psycopg_parse_escape(
|
||||
static char *parse_escape(
|
||||
const char *bufin, Py_ssize_t sizein, Py_ssize_t *sizeout);
|
||||
|
||||
/* The function is not static and not hidden as we use ctypes to test it. */
|
||||
|
@ -154,7 +154,7 @@ typecast_BINARY_cast(const char *s, Py_ssize_t l, PyObject *curs)
|
|||
* So the only robust option is to parse it ourselves - luckily it's
|
||||
* an easy format.
|
||||
*/
|
||||
if (NULL == (buffer = psycopg_parse_hex(s, l, &len))) {
|
||||
if (NULL == (buffer = parse_hex(s, l, &len))) {
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
|
@ -169,7 +169,7 @@ typecast_BINARY_cast(const char *s, Py_ssize_t l, PyObject *curs)
|
|||
* So we'll just have our better integrated parser, let's finish this
|
||||
* story.
|
||||
*/
|
||||
if (NULL == (buffer = psycopg_parse_escape(s, l, &len))) {
|
||||
if (NULL == (buffer = parse_escape(s, l, &len))) {
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
|
@ -219,7 +219,7 @@ static const char hex_lut[128] = {
|
|||
* In case of error set an exception and return NULL.
|
||||
*/
|
||||
static char *
|
||||
psycopg_parse_hex(const char *bufin, Py_ssize_t sizein, Py_ssize_t *sizeout)
|
||||
parse_hex(const char *bufin, Py_ssize_t sizein, Py_ssize_t *sizeout)
|
||||
{
|
||||
char *ret = NULL;
|
||||
const char *bufend = bufin + sizein;
|
||||
|
@ -269,7 +269,7 @@ exit:
|
|||
* In case of error set an exception and return NULL.
|
||||
*/
|
||||
static char *
|
||||
psycopg_parse_escape(const char *bufin, Py_ssize_t sizein, Py_ssize_t *sizeout)
|
||||
parse_escape(const char *bufin, Py_ssize_t sizein, Py_ssize_t *sizeout)
|
||||
{
|
||||
char *ret = NULL;
|
||||
const char *bufend = bufin + sizein;
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#include "datetime.h"
|
||||
|
||||
RAISES_NEG static int
|
||||
psyco_typecast_datetime_init(void)
|
||||
typecast_datetime_init(void)
|
||||
{
|
||||
PyDateTime_IMPORT;
|
||||
|
||||
|
|
|
@ -29,10 +29,10 @@
|
|||
/* Return 0 on success, -1 on failure, but don't set an exception */
|
||||
|
||||
static int
|
||||
psyco_typecast_mxdatetime_init(void)
|
||||
typecast_mxdatetime_init(void)
|
||||
{
|
||||
if (mxDateTime_ImportModuleAndAPI()) {
|
||||
Dprintf("psyco_typecast_mxdatetime_init: mx.DateTime initialization failed");
|
||||
Dprintf("typecast_mxdatetime_init: mx.DateTime initialization failed");
|
||||
PyErr_Clear();
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
* including quotes.
|
||||
*/
|
||||
char *
|
||||
psycopg_escape_string(connectionObject *conn, const char *from, Py_ssize_t len,
|
||||
psyco_escape_string(connectionObject *conn, const char *from, Py_ssize_t len,
|
||||
char *to, Py_ssize_t *tolen)
|
||||
{
|
||||
Py_ssize_t ql;
|
||||
|
@ -102,7 +102,7 @@ psycopg_escape_string(connectionObject *conn, const char *from, Py_ssize_t len,
|
|||
* In case of error set a Python exception.
|
||||
*/
|
||||
char *
|
||||
psycopg_escape_identifier(connectionObject *conn, const char *str, Py_ssize_t len)
|
||||
psyco_escape_identifier(connectionObject *conn, const char *str, Py_ssize_t len)
|
||||
{
|
||||
char *rv = NULL;
|
||||
|
||||
|
@ -139,7 +139,7 @@ exit:
|
|||
* If from is null, store null into to.
|
||||
*/
|
||||
RAISES_NEG int
|
||||
psycopg_strdup(char **to, const char *from, Py_ssize_t len)
|
||||
psyco_strdup(char **to, const char *from, Py_ssize_t len)
|
||||
{
|
||||
if (!from) {
|
||||
*to = NULL;
|
||||
|
@ -165,7 +165,7 @@ psycopg_strdup(char **to, const char *from, Py_ssize_t len)
|
|||
* It is safe to call the function on NULL.
|
||||
*/
|
||||
STEALS(1) PyObject *
|
||||
psycopg_ensure_bytes(PyObject *obj)
|
||||
psyco_ensure_bytes(PyObject *obj)
|
||||
{
|
||||
PyObject *rv = NULL;
|
||||
if (!obj) { return NULL; }
|
||||
|
@ -195,7 +195,7 @@ psycopg_ensure_bytes(PyObject *obj)
|
|||
* return value. It is safe to call it on NULL.
|
||||
*/
|
||||
STEALS(1) PyObject *
|
||||
psycopg_ensure_text(PyObject *obj)
|
||||
psyco_ensure_text(PyObject *obj)
|
||||
{
|
||||
#if PY_2
|
||||
return obj;
|
||||
|
@ -217,7 +217,7 @@ psycopg_ensure_text(PyObject *obj)
|
|||
* Return 1 if it does, else 0, -1 on errors.
|
||||
*/
|
||||
int
|
||||
psycopg_is_text_file(PyObject *f)
|
||||
psyco_is_text_file(PyObject *f)
|
||||
{
|
||||
/* NULL before any call.
|
||||
* then io.TextIOBase if exists, else None. */
|
||||
|
@ -226,16 +226,16 @@ psycopg_is_text_file(PyObject *f)
|
|||
/* Try to import os.TextIOBase */
|
||||
if (NULL == base) {
|
||||
PyObject *m;
|
||||
Dprintf("psycopg_is_text_file: importing io.TextIOBase");
|
||||
Dprintf("psyco_is_text_file: importing io.TextIOBase");
|
||||
if (!(m = PyImport_ImportModule("io"))) {
|
||||
Dprintf("psycopg_is_text_file: io module not found");
|
||||
Dprintf("psyco_is_text_file: io module not found");
|
||||
PyErr_Clear();
|
||||
Py_INCREF(Py_None);
|
||||
base = Py_None;
|
||||
}
|
||||
else {
|
||||
if (!(base = PyObject_GetAttrString(m, "TextIOBase"))) {
|
||||
Dprintf("psycopg_is_text_file: io.TextIOBase not found");
|
||||
Dprintf("psyco_is_text_file: io.TextIOBase not found");
|
||||
PyErr_Clear();
|
||||
Py_INCREF(Py_None);
|
||||
base = Py_None;
|
||||
|
@ -253,7 +253,7 @@ psycopg_is_text_file(PyObject *f)
|
|||
|
||||
/* Make a dict out of PQconninfoOption array */
|
||||
PyObject *
|
||||
psycopg_dict_from_conninfo_options(PQconninfoOption *options, int include_password)
|
||||
psyco_dict_from_conninfo_options(PQconninfoOption *options, int include_password)
|
||||
{
|
||||
PyObject *dict, *res = NULL;
|
||||
PQconninfoOption *o;
|
||||
|
@ -287,7 +287,7 @@ exit:
|
|||
* Helper to call psycopg2.extensions.make_dsn()
|
||||
*/
|
||||
PyObject *
|
||||
psycopg_make_dsn(PyObject *dsn, PyObject *kwargs)
|
||||
psyco_make_dsn(PyObject *dsn, PyObject *kwargs)
|
||||
{
|
||||
PyObject *ext = NULL, *make_dsn = NULL;
|
||||
PyObject *args = NULL, *rv = NULL;
|
||||
|
@ -314,7 +314,7 @@ exit:
|
|||
* len is optional: use -1 to have it calculated by the function.
|
||||
*/
|
||||
PyObject *
|
||||
psycopg_text_from_chars_safe(const char *str, Py_ssize_t len, PyObject *decoder)
|
||||
psyco_text_from_chars_safe(const char *str, Py_ssize_t len, PyObject *decoder)
|
||||
{
|
||||
#if PY_2
|
||||
|
||||
|
@ -430,7 +430,7 @@ psyco_is_main_interp(void)
|
|||
#endif
|
||||
}
|
||||
|
||||
/* psyco_GetDecimalType
|
||||
/* psyco_get_decimal_type
|
||||
|
||||
Return a new reference to the decimal type.
|
||||
|
||||
|
@ -439,7 +439,7 @@ psyco_is_main_interp(void)
|
|||
*/
|
||||
|
||||
PyObject *
|
||||
psyco_GetDecimalType(void)
|
||||
psyco_get_decimal_type(void)
|
||||
{
|
||||
static PyObject *cachedType = NULL;
|
||||
PyObject *decimalType = NULL;
|
||||
|
|
|
@ -31,32 +31,32 @@ typedef struct cursorObject cursorObject;
|
|||
typedef struct connectionObject connectionObject;
|
||||
typedef struct replicationMessageObject replicationMessageObject;
|
||||
|
||||
HIDDEN char *psycopg_escape_string(
|
||||
HIDDEN char *psyco_escape_string(
|
||||
connectionObject *conn,
|
||||
const char *from, Py_ssize_t len, char *to, Py_ssize_t *tolen);
|
||||
|
||||
HIDDEN char *psycopg_escape_identifier(
|
||||
HIDDEN char *psyco_escape_identifier(
|
||||
connectionObject *conn, const char *str, Py_ssize_t len);
|
||||
|
||||
HIDDEN int psycopg_strdup(char **to, const char *from, Py_ssize_t len);
|
||||
HIDDEN int psyco_strdup(char **to, const char *from, Py_ssize_t len);
|
||||
|
||||
STEALS(1) HIDDEN PyObject * psycopg_ensure_bytes(PyObject *obj);
|
||||
STEALS(1) HIDDEN PyObject * psycopg_ensure_text(PyObject *obj);
|
||||
STEALS(1) HIDDEN PyObject * psyco_ensure_bytes(PyObject *obj);
|
||||
STEALS(1) HIDDEN PyObject * psyco_ensure_text(PyObject *obj);
|
||||
|
||||
HIDDEN int psycopg_is_text_file(PyObject *f);
|
||||
HIDDEN int psyco_is_text_file(PyObject *f);
|
||||
|
||||
HIDDEN PyObject *psycopg_dict_from_conninfo_options(
|
||||
HIDDEN PyObject *psyco_dict_from_conninfo_options(
|
||||
PQconninfoOption *options, int include_password);
|
||||
|
||||
HIDDEN PyObject *psycopg_make_dsn(PyObject *dsn, PyObject *kwargs);
|
||||
HIDDEN PyObject *psyco_make_dsn(PyObject *dsn, PyObject *kwargs);
|
||||
|
||||
HIDDEN PyObject *psycopg_text_from_chars_safe(
|
||||
HIDDEN PyObject *psyco_text_from_chars_safe(
|
||||
const char *str, Py_ssize_t len, PyObject *decoder);
|
||||
|
||||
HIDDEN RAISES BORROWED PyObject *psyco_set_error(
|
||||
PyObject *exc, cursorObject *curs, const char *msg);
|
||||
|
||||
HIDDEN PyObject *psyco_GetDecimalType(void);
|
||||
HIDDEN PyObject *psyco_get_decimal_type(void);
|
||||
|
||||
HIDDEN PyObject *Bytes_Format(PyObject *format, PyObject *args);
|
||||
|
||||
|
|
|
@ -343,8 +343,8 @@ _xid_base64_enc_dec(const char *funcname, PyObject *s)
|
|||
if (!(func = PyObject_GetAttrString(base64, funcname))) { goto exit; }
|
||||
|
||||
Py_INCREF(s);
|
||||
if (!(s = psycopg_ensure_bytes(s))) { goto exit; }
|
||||
rv = psycopg_ensure_text(PyObject_CallFunctionObjArgs(func, s, NULL));
|
||||
if (!(s = psyco_ensure_bytes(s))) { goto exit; }
|
||||
rv = psyco_ensure_text(PyObject_CallFunctionObjArgs(func, s, NULL));
|
||||
Py_DECREF(s);
|
||||
|
||||
exit:
|
||||
|
|
Loading…
Reference in New Issue
Block a user