Re: Save and load jpg in a PostgreSQL database

From: lfmartinelli <luis(dot)fernando(dot)martinelli(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Save and load jpg in a PostgreSQL database
Date: 2010-11-05 18:46:08
Message-ID: 4CD450DF.6000904@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


Hey Dmitriy,

I'm using Visual Studio 2010 system.data.odbc becouse this worked good
and i tested psqlodbc lib to .Net, but i don't find any advantage to use
this.
In a Brazilian forum, i read a post and it was written:

-" Just use this line: INSERT INTO table (image) VALUES
(pg_escape_bytea(image.jpg))".

Changing "image.jpg" to my image file, the PostgreSQL already convert
this and save in a database.
Is this true? And how can i load this to imageBox in my system? Which
type must be declared my variable?

Thanks to your help.

Em 04/11/2010 15:40, Dmitriy Igrishin [via PostgreSQL] escreveu:
> Hey Fernando,
>
> If you need to store binary data in a table you should use bytea data
> type.
> Than, in case of libpq:
> If you want to transmit binary data from client to server in text
> format you
> must prepare (escape) it for including into you SQL command (e.g.,
> INSERT).
> If you can transmit the data from client to server in binary format
> you don't
> need escape you binary data, but you must tell libpq (or the library
> you use)
> that you transmission will be in a binary format.
>
> What library do you use to work with PostgreSQL ?
>
> 2010/11/4 lfmartinelli <[hidden email]
> </user/SendEmail.jtp?type=node&node=3250498&i=0>>
>
>
> Hi,
>
> My name is Fernando, i work with C# and PostgreSQL. I need save a
> jpg in a
> PostgreSQL table.
> How do i this? I read in a forum to use this to save in database:
>
> INSERT INTO table (image) VALUES (pg_escape_bytea(image.jpg))
>
> Don't i need convert image file to binary before save in a database?
> How get i this image to a variable using c#?
>
> Please help me!
>
> Thanks.
> --
> View this message in context:
> http://postgresql.1045698.n5.nabble.com/Save-and-load-jpg-in-a-PostgreSQL-database-tp3249969p3249969.html
> <http://postgresql.1045698.n5.nabble.com/Save-and-load-jpg-in-a-PostgreSQL-database-tp3249969p3249969.html?by-user=t>
> Sent from the PostgreSQL - general mailing list archive at Nabble.com.
>
> --
> Sent via pgsql-general mailing list ([hidden email]
> </user/SendEmail.jtp?type=node&node=3250498&i=1>)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>
>
>
>
> --
> // Dmitriy.
>
>
>
>
> ------------------------------------------------------------------------
> View message @
> http://postgresql.1045698.n5.nabble.com/Save-and-load-jpg-in-a-PostgreSQL-database-tp3249969p3250498.html
>
> To unsubscribe from Save and load jpg in a PostgreSQL database, click
> here
> <http://postgresql.1045698.n5.nabble.com/template/TplServlet.jtp?tpl=unsubscribe_by_code&node=3249969&code=bHVpcy5mZXJuYW5kby5tYXJ0aW5lbGxpQGdtYWlsLmNvbXwzMjQ5OTY5fDE5NTY2MjIzNDg=>.
>
>

--
View this message in context: http://postgresql.1045698.n5.nabble.com/Save-and-load-jpg-in-a-PostgreSQL-database-tp3249969p3252295.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Vick Khera 2010-11-05 18:48:59 Re: PITR on different machine/architecture?
Previous Message Andreas Brandl 2010-11-05 17:54:50 PITR on different machine/architecture?