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

Function lo_tell64

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

* lo_tell64 * returns the current seek location of the large object */

Source from the content-addressed store, hash-verified

552 * returns the current seek location of the large object
553 */
554pg_int64
555lo_tell64(PGconn *conn, int fd)
556{
557 pg_int64 retval;
558 PQArgBlock argv[1];
559 PGresult *res;
560 int result_len;
561
562 if (lo_initialize(conn) < 0)
563 return -1;
564
565 if (conn->lobjfuncs->fn_lo_tell64 == 0)
566 {
567 appendPQExpBuffer(&conn->errorMessage,
568 libpq_gettext("cannot determine OID of function %s\n"),
569 "lo_tell64");
570 return -1;
571 }
572
573 argv[0].isint = 1;
574 argv[0].len = 4;
575 argv[0].u.integer = fd;
576
577 res = PQfn(conn, conn->lobjfuncs->fn_lo_tell64,
578 (void *) &retval, &result_len, 0, argv, 1);
579 if (PQresultStatus(res) == PGRES_COMMAND_OK && result_len == 8)
580 {
581 PQclear(res);
582 return lo_ntoh64(retval);
583 }
584 else
585 {
586 PQclear(res);
587 return -1;
588 }
589}
590
591/*
592 * lo_unlink

Callers 1

pickoutFunction · 0.85

Calls 7

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

Tested by 1

pickoutFunction · 0.68