Exemple #1
0
static PyObject *
_xid_base64_enc_dec(const char *funcname, PyObject *s)
{
    PyObject *base64 = NULL;
    PyObject *func = NULL;
    PyObject *rv = NULL;

    if (!(base64 = PyImport_ImportModule("base64"))) { goto exit; }
    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));
    Py_DECREF(s);

exit:
    Py_XDECREF(func);
    Py_XDECREF(base64);

    return rv;
}
static PyObject *
binary_str(binaryObject *self)
{
    return psycopg_ensure_text(binary_getquoted(self, NULL));
}
Exemple #3
0
static PyObject *
pydatetime_str(pydatetimeObject *self)
{
    return psycopg_ensure_text(pydatetime_getquoted(self, NULL));
}
static PyObject *
pfloat_str(pfloatObject *self)
{
    return psycopg_ensure_text(pfloat_getquoted(self, NULL));
}
static PyObject *
pboolean_str(pbooleanObject *self)
{
    return psycopg_ensure_text(pboolean_getquoted(self, NULL));
}
static PyObject *
qstring_str(qstringObject *self)
{
    return psycopg_ensure_text(qstring_getquoted(self, NULL));
}
static PyObject *
asis_str(asisObject *self)
{
    return psycopg_ensure_text(asis_getquoted(self, NULL));
}