* lo_tell64 * returns the current seek location of the large object */
| 552 | * returns the current seek location of the large object |
| 553 | */ |
| 554 | pg_int64 |
| 555 | lo_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 |