Re: How to code lo_creat & lo_write & lo_read in non-blocking mode

From: Dmitriy Igrishin <dmitigr(at)gmail(dot)com>
To: ChoonSoo Park <luispark(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: How to code lo_creat & lo_write & lo_read in non-blocking mode
Date: 2012-01-07 10:05:24
Message-ID: CAAfz9KOWvCy+D9LdDjgZQ4KRy15oDa8b8Ust4S9_qOAS51b79g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hey ChoonSoo,

2012/1/6 ChoonSoo Park <luispark(at)gmail(dot)com>

> I just wonder if there is a way to program lo client interfaces (lo_creat,
> lo_write, lo_read) in non-blocking mode.
> PQsendQueryParams works perfect for executing a sql command in
> non-blocking mode. But I couldn't find a way for handling large objects.
>
These functions uses obsolete fast-path interface to call
these functions on the backend:
dmitigr=> select oid, proname from pg_proc where proname ~ E'^lo_' or
proname in ('loread', 'lowrite');
oid | proname
------+-------------
764 | lo_import
767 | lo_import
765 | lo_export
952 | lo_open
953 | lo_close
954 | loread
955 | lowrite
956 | lo_lseek
957 | lo_creat
715 | lo_create
958 | lo_tell
1004 | lo_truncate
964 | lo_unlink
(13 rows)

So, you can call these functions using regular SQL
(prepared statements may be used for improving
performance in this case).

>
> Do you have any example?
>
I can't imagine how (and why) to work with LOs
in asynchronous mode because LOs stored as a
sequence of chunks (the size is usually 4kb)
of the type bytea in the special table. As consequence all
operations on the LOs must be inside an explicitly opened
transaction block.

>
> Thank you,
> Choon Park
>

--
// Dmitriy.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jason Buberel 2012-01-07 14:52:13 Time to move table to new tablespace
Previous Message John R Pierce 2012-01-07 03:38:30 Re: URGENT: temporary table not recognized?