MCPcopy Create free account
hub / github.com/apache/cloudberry / lo_create

Function lo_create

src/interfaces/libpq/fe-lobj.c:479–514  ·  view source on GitHub ↗

* lo_create * create a new large object * if lobjId isn't InvalidOid, it specifies the OID to (attempt to) create * * returns the oid of the large object created or * InvalidOid upon failure */

Source from the content-addressed store, hash-verified

477 * InvalidOid upon failure
478 */
479Oid
480lo_create(PGconn *conn, Oid lobjId)
481{
482 PQArgBlock argv[1];
483 PGresult *res;
484 int retval;
485 int result_len;
486
487 if (lo_initialize(conn) < 0)
488 return InvalidOid;
489
490 /* Must check this on-the-fly because it's not there pre-8.1 */
491 if (conn->lobjfuncs->fn_lo_create == 0)
492 {
493 appendPQExpBuffer(&conn->errorMessage,
494 libpq_gettext("cannot determine OID of function %s\n"),
495 "lo_create");
496 return InvalidOid;
497 }
498
499 argv[0].isint = 1;
500 argv[0].len = 4;
501 argv[0].u.integer = lobjId;
502 res = PQfn(conn, conn->lobjfuncs->fn_lo_create,
503 &retval, &result_len, 1, argv, 1);
504 if (PQresultStatus(res) == PGRES_COMMAND_OK)
505 {
506 PQclear(res);
507 return (Oid) retval;
508 }
509 else
510 {
511 PQclear(res);
512 return InvalidOid;
513 }
514}
515
516
517/*

Callers 2

lo_import_internalFunction · 0.85
StartRestoreBlobFunction · 0.85

Calls 6

lo_initializeFunction · 0.85
appendPQExpBufferFunction · 0.85
libpq_gettextFunction · 0.85
PQfnFunction · 0.85
PQresultStatusFunction · 0.85
PQclearFunction · 0.85

Tested by

no test coverage detected