Large objects - SOS
Large objects - SOS
От:
mjoseph@inautix.com
Дата:
Hi, I need to create a large object - a photograph and work with it. I would be using ODBC (application on Windows NT , db server on Linux) The doc at http://gborg.postgresql.org/project/psqlodbc/faq/faq.php?faq_id=52 suggests creating a custom type like this. create type lo ( internallength=4, externallength=10, input=int4in, output=int4out, default='', passedbyvalue ); I need to define the input & output functions (int4in and int4out). Can someone give me a clue as to how these functions should be defined? Some sample code would really help me. Regards, Manoj
Re: Large objects - SOS
От:
"Nigel J. Andrews" <nandrews@investsystems.co.uk>
Дата:
On Tue, 4 Feb 2003 mjoseph@inautix.com wrote: > Hi, > I need to create a large object - a photograph and work with it. I would be > using ODBC (application on Windows NT , db server on Linux) > The doc at > http://gborg.postgresql.org/project/psqlodbc/faq/faq.php?faq_id=52 > suggests creating a custom type like this. > create type lo ( > internallength=4, > externallength=10, > input=int4in, > output=int4out, > default='', > passedbyvalue > ); > > I need to define the input & output functions (int4in and int4out). > Can someone give me a clue as to how these functions should be defined? > Some sample code would really help me. If it were up to me I would base64 encode the data and store it in a bytea type column. Obviously retrieval involves decoding the base64. Note though, using the database functions to encode/decode the data defeats the object of the encoding, which is to avoid all possible special character interpretion by the parser (and possibly the wire protocol). As I understand it, bytea should mostly work without encoding the data if you can quote the data correctly. However, my very quick experiments didn't work first time so I advised the client to go the easy route. I hope to revisit this my self again soon (when I get the time). -- Nigel J. Andrews