RAISES_NEG Py_ssize_t lobject_tell(lobjectObject *self) { PGresult *pgres = NULL; char *error = NULL; Py_ssize_t where; Dprintf("lobject_tell: fd = %d", self->fd); Py_BEGIN_ALLOW_THREADS; pthread_mutex_lock(&(self->conn->lock)); #ifdef HAVE_LO64 if (self->conn->server_version < 90300) { where = (Py_ssize_t)lo_tell(self->conn->pgconn, self->fd); } else { where = (Py_ssize_t)lo_tell64(self->conn->pgconn, self->fd); } #else where = (Py_ssize_t)lo_tell(self->conn->pgconn, self->fd); #endif Dprintf("lobject_tell: where = " FORMAT_CODE_PY_SSIZE_T, where); if (where < 0) collect_error(self->conn, &error); pthread_mutex_unlock(&(self->conn->lock)); Py_END_ALLOW_THREADS; if (where < 0) pq_complete_error(self->conn, &pgres, &error); return where; }
CAMLprim value lo_tell_stub(value v_conn, value v_fd) { CAMLparam1(v_conn); PGconn *conn = get_conn(v_conn); value v_res; caml_enter_blocking_section(); v_res = Val_int(lo_tell(conn, Int_val(v_fd))); caml_leave_blocking_section(); CAMLreturn(v_res); }
/* ************************************************************************* */ int pg_lo_tell(ClipMachine* mp, SQLCONN* c, int oid_fd){ PG_CONN *conn = (PG_CONN*)c; int rt; if(!conn->at){ _clip_trap_err(mp,0,0,0,subsys,ER_START,er_start); return 1; } rt = lo_tell(conn->conn, oid_fd); if (rt < 0){ _clip_trap_err(mp,0,0,0,subsys,ER_START,er_blob_tell); return 1; } _clip_retni(mp,(unsigned int) rt); return 0; }
int lobject_tell(lobjectObject *self) { PGresult *pgres = NULL; char *error = NULL; int where; Dprintf("lobject_tell: fd = %d", self->fd); Py_BEGIN_ALLOW_THREADS; pthread_mutex_lock(&(self->conn->lock)); where = lo_tell(self->conn->pgconn, self->fd); Dprintf("lobject_tell: where = %d", where); if (where < 0) collect_error(self->conn, &error); pthread_mutex_unlock(&(self->conn->lock)); Py_END_ALLOW_THREADS; if (where < 0) pq_complete_error(self->conn, &pgres, &error); return where; }