Re: Image Insert Postgresql DB

From: "Premsun Choltanwanich" <Premsun(at)nsasia(dot)co(dot)th>
To: <getsreejith(at)gmail(dot)com>, <pgsql-sql(at)postgresql(dot)org>, <lawgon(at)thenilgiris(dot)com>
Subject: Re: Image Insert Postgresql DB
Date: 2004-11-23 08:19:15
Message-ID: s1a3550e.053@jupiter.nsasia.co.th
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

I use VB as develop tool and ADO for connect. My code is show below and
for vPicMember is stand ADOStream in Binary.

rs.Open "SELECT * FROM t_mbrpic WHERE mbrsysid = " & vSysId, conn,
adOpenStatic, adLockOptimistic
If rs.EOF Then rs.AddNew
rs!MbrSysId = vSysId
rs!MbrPic = vPicMember.Read
rs.Update
rs.Close

In this case, Is I must still escape the octets with \\ that is two
backslashes? Could anybody has some suggestion?

>>> Kenneth Gonsalves <lawgon(at)thenilgiris(dot)com> 23/11/2004 2:40:27 pm
>>>
On Tuesday 23 November 2004 12:48 pm, Premsun Choltanwanich wrote:
> I face this same problem when I try to insert image by lo_import to
> database with my client files. I already change the way to bytea
data
> type but it's not work. The error return like type mismatch when I
try
> to insert it from Binary variable.
>
> Why I cannot insert it? If anybody found some solution please reply
on
> this topic for me too.

you must escape the octets with \\ that is two backslashes and not one

backslash.

for example if your binary data is like this:

\x05\x00\x02

you must make it like so:

\\x05\\x00\\x02

please see chapter 8.4 of the postgresql manual.

kg

---------------------------(end of
broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Kenneth Gonsalves 2004-11-23 09:29:29 Re: Image Insert Postgresql DB
Previous Message Kenneth Gonsalves 2004-11-23 07:40:27 Re: Image Insert Postgresql DB