/*
* call-seq:
* conn.lo_create( [mode] ) -> PGlarge
*
* Returns a PGlarge instance on success. On failure, it raises PGError exception.
* <i>(See #lo_open for information on _mode_.)</i>
*/
static VALUE
pgconn_locreate(argc, argv, obj)
int argc;
VALUE *argv;
VALUE obj;
{
Oid lo_oid;
int mode;
VALUE nmode;
PGconn *conn;
if (rb_scan_args(argc, argv, "01", &nmode) == 0) {
mode = INV_READ;
}
else {
mode = FIX2INT(nmode);
}
conn = get_pgconn(obj);
lo_oid = lo_creat(conn, mode);
if (lo_oid == 0){
rb_raise(rb_ePGError, "can't creat large object");
}
return pglarge_new(conn, lo_oid, -1);
}