Re: Save and load jpg in a PostgreSQL database

From: Dmitriy Igrishin <dmitigr(at)gmail(dot)com>
To: lfmartinelli <luis(dot)fernando(dot)martinelli(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Save and load jpg in a PostgreSQL database
Date: 2010-11-04 17:39:22
Message-ID: AANLkTin+rbkbU-TTFNcSYpQobKBtW7LXzsAVpiAXEtEO@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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 <luis(dot)fernando(dot)martinelli(at)gmail(dot)com>

>
> 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
> Sent from the PostgreSQL - general mailing list archive at Nabble.com.
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>

--
// Dmitriy.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Marco Colombo 2010-11-04 18:18:23 Re: Linux
Previous Message Michael Gould 2010-11-04 17:15:27 Re: Linux