Esempio n. 1
0
static PyObject *
psyco_lobj_get_closed(lobjectObject *self, void *closure)
{
    PyObject *closed;

    closed = lobject_is_closed(self) ? Py_True : Py_False;
    Py_INCREF(closed);
    return closed;
}
Esempio n. 2
0
static PyObject *
psyco_lobj_close(lobjectObject *self, PyObject *args)
{
    /* file-like objects can be closed multiple times and remember that
       closing the current transaction is equivalent to close all the
       opened large objects */
    if (!lobject_is_closed(self)
        && !self->conn->autocommit
        && self->conn->mark == self->mark)
    {
        Dprintf("psyco_lobj_close: closing lobject at %p", self);
        if (lobject_close(self) < 0)
            return NULL;
    }

    Py_RETURN_NONE;
}
Esempio n. 3
0
static PyObject *
psyco_lobj_close(lobjectObject *self, PyObject *args)
{
    /* file-like objects can be closed multiple times and remember that
       closing the current transaction is equivalent to close all the
       opened large objects */
    if (!lobject_is_closed(self)
        && self->conn->isolation_level != ISOLATION_LEVEL_AUTOCOMMIT
	&& self->conn->mark == self->mark)
    {
        Dprintf("psyco_lobj_close: closing lobject at %p", self);
        if (lobject_close(self) < 0)
            return NULL;
    }

    Py_INCREF(Py_None);
    return Py_None;
}
Esempio n. 4
0
static PyObject *
lobject_repr(lobjectObject *self)
{
    return PyString_FromFormat(
        "<lobject object at %p; closed: %d>", self, lobject_is_closed(self));
}