Record

Started by BNT SOFTover 24 years ago9 messagesgeneral
Jump to latest
#1BNT SOFT
julio@bntsoft.com.br

Hi, I am developing an application in delphi using the postgresql, I am not getting to record an image, I am using the type OID, but I didn't have success ties now.
It would like you to help me, therefore I don't know how to use those commands.

Thank you for the attention,

Almeida Julio, São Paulo - Brazil

Attachments:

logop.gifimage/gif; name=logop.gifDownload
#2Aasmund Midttun Godal
postgresql@envisity.com
In reply to: BNT SOFT (#1)
Re: Record

I am not sure I understand what you mean. However if you are wanting to store an image in a table you have 2 options:

1. bytea fields.
2. large objects.

Bytea is probably the way to go... look it up in the docs...

Regards,

Aasmund.

On Sun, 21 Oct 2001 00:14:23 -0300, "BNT SOFT" <julio@bntsoft.com.br> wrote:

Hi, I am developing an application in delphi using the postgresql, I am not getting to record an image, I am using the type OID, but I didn't have success ties now.
It would like you to help me, therefore I don't know how to use those commands.

Thank you for the attention,

Almeida Julio, S�o Paulo - Brazil

Aasmund Midttun Godal

aasmund@godal.com - http://www.godal.com/
+47 40 45 20 46

#3Alvaro Herrera
alvherre@atentus.com
In reply to: Aasmund Midttun Godal (#2)
Re: Record

On Tue, 23 Oct 2001, Aasmund Midttun Godal wrote:

I am not sure I understand what you mean. However if you are wanting to store an image in a table you have 2 options:

1. bytea fields.
2. large objects.

Third option is to encode the image (base64?) and then store as text.
It's probably slower (since you have to decode it everytime), uses much
more space, but you don't have to worry about escaping the byte
sequence.

--
Alvaro Herrera (<alvherre[@]atentus.com>)
Jajaja! Solo hablaba en serio!

#4Aasmund Midttun Godal
postgresql@envisity.com
In reply to: Alvaro Herrera (#3)
Re: Record

Escaping the byte sequence is quite simple:

s/([^\w])/sprintf("\\%03o", ord($1))/eg;
(in perl).

On Wed, 24 Oct 2001 11:22:39 -0300 (CLST), Alvaro Herrera <alvherre@atentus.com> wrote:

On Tue, 23 Oct 2001, Aasmund Midttun Godal wrote:

Third option is to encode the image (base64?) and then store as text.
It's probably slower (since you have to decode it everytime), uses much
more space, but you don't have to worry about escaping the byte
sequence.

--
Alvaro Herrera (<alvherre[@]atentus.com>)
Jajaja! Solo hablaba en serio!

Aasmund Midttun Godal

aasmund@godal.com - http://www.godal.com/
+47 40 45 20 46

#5Noname
wsheldah@lexmark.com
In reply to: Aasmund Midttun Godal (#4)
Re: Record

If you're using Perl and the DBD::Pg driver, then you can use bytea without
worrying about escaping anything, since the driver takes care of it.

Alvaro Herrera <alvherre%atentus.com@interlock.lexmark.com> on 10/24/2001
10:22:39 AM

To: Aasmund Midttun Godal <postgresql%envisity.com@interlock.lexmark.com>
cc: julio%bntsoft.com.br@interlock.lexmark.com,
pgsql-general%postgresql.org@interlock.lexmark.com (bcc: Wesley
Sheldahl/Lex/Lexmark)
Subject: Re: [GENERAL] Record

On Tue, 23 Oct 2001, Aasmund Midttun Godal wrote:

I am not sure I understand what you mean. However if you are wanting to store

an image in a table you have 2 options:

1. bytea fields.
2. large objects.

Third option is to encode the image (base64?) and then store as text.
It's probably slower (since you have to decode it everytime), uses much
more space, but you don't have to worry about escaping the byte
sequence.

--
Alvaro Herrera (<alvherre[@]atentus.com>)
Jajaja! Solo hablaba en serio!

#6Aasmund Midttun Godal
postgresql@envisity.com
In reply to: Noname (#5)
Re: Record

It handles the unescaping, but you have to escape to update/insert, I use:

s/([^\w])/sprintf("\\%03o", ord($1))/eg;

On Wed, 24 Oct 2001 11:42:31 -0400, wsheldah@lexmark.com wrote:

If you're using Perl and the DBD::Pg driver, then you can use bytea without
worrying about escaping anything, since the driver takes care of it.

Alvaro Herrera <alvherre%atentus.com@interlock.lexmark.com> on 10/24/2001
10:22:39 AM

To: Aasmund Midttun Godal <postgresql%envisity.com@interlock.lexmark.com>
cc: julio%bntsoft.com.br@interlock.lexmark.com,
pgsql-general%postgresql.org@interlock.lexmark.com (bcc: Wesley
Sheldahl/Lex/Lexmark)
Subject: Re: [GENERAL] Record

On Tue, 23 Oct 2001, Aasmund Midttun Godal wrote:

an image in a table you have 2 options:

Third option is to encode the image (base64?) and then store as text.
It's probably slower (since you have to decode it everytime), uses much
more space, but you don't have to worry about escaping the byte
sequence.

--
Alvaro Herrera (<alvherre[@]atentus.com>)
Jajaja! Solo hablaba en serio!

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Aasmund Midttun Godal

aasmund@godal.com - http://www.godal.com/
+47 40 45 20 46

#7Aasmund Midttun Godal
postgresql@envisity.com
In reply to: Noname (#5)
Re: Record

It handles the unescaping, but you have to escape to update/insert, I use:

s/([^\w])/sprintf("\\%03o", ord($1))/eg;

On Wed, 24 Oct 2001 11:42:31 -0400, wsheldah@lexmark.com wrote:

If you're using Perl and the DBD::Pg driver, then you can use bytea without
worrying about escaping anything, since the driver takes care of it.

Alvaro Herrera <alvherre%atentus.com@interlock.lexmark.com> on 10/24/2001
10:22:39 AM

To: Aasmund Midttun Godal <postgresql%envisity.com@interlock.lexmark.com>
cc: julio%bntsoft.com.br@interlock.lexmark.com,
pgsql-general%postgresql.org@interlock.lexmark.com (bcc: Wesley
Sheldahl/Lex/Lexmark)
Subject: Re: [GENERAL] Record

On Tue, 23 Oct 2001, Aasmund Midttun Godal wrote:

an image in a table you have 2 options:

Third option is to encode the image (base64?) and then store as text.
It's probably slower (since you have to decode it everytime), uses much
more space, but you don't have to worry about escaping the byte
sequence.

--
Alvaro Herrera (<alvherre[@]atentus.com>)
Jajaja! Solo hablaba en serio!

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Aasmund Midttun Godal

aasmund@godal.com - http://www.godal.com/
+47 40 45 20 46

#8Alex Pilosov
alex@pilosoft.com
In reply to: Aasmund Midttun Godal (#6)
Re: Record

No, you don't, just bind variable as SQL_BINARY, and it'll do the escaping
on its own. Search archives. :)

-alex
On Wed, 24 Oct 2001, Aasmund Midttun Godal wrote:

Show quoted text

It handles the unescaping, but you have to escape to update/insert, I use:

s/([^\w])/sprintf("\\%03o", ord($1))/eg;

On Wed, 24 Oct 2001 11:42:31 -0400, wsheldah@lexmark.com wrote:

If you're using Perl and the DBD::Pg driver, then you can use bytea without
worrying about escaping anything, since the driver takes care of it.

Alvaro Herrera <alvherre%atentus.com@interlock.lexmark.com> on 10/24/2001
10:22:39 AM

To: Aasmund Midttun Godal <postgresql%envisity.com@interlock.lexmark.com>
cc: julio%bntsoft.com.br@interlock.lexmark.com,
pgsql-general%postgresql.org@interlock.lexmark.com (bcc: Wesley
Sheldahl/Lex/Lexmark)
Subject: Re: [GENERAL] Record

On Tue, 23 Oct 2001, Aasmund Midttun Godal wrote:

an image in a table you have 2 options:

Third option is to encode the image (base64?) and then store as text.
It's probably slower (since you have to decode it everytime), uses much
more space, but you don't have to worry about escaping the byte
sequence.

--
Alvaro Herrera (<alvherre[@]atentus.com>)
Jajaja! Solo hablaba en serio!

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Aasmund Midttun Godal

aasmund@godal.com - http://www.godal.com/
+47 40 45 20 46

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

#9Noname
wsheldah@lexmark.com
In reply to: Alex Pilosov (#8)
Re: Record

[Checking memory... can't remember ... checking code...]

Looks like I'm using DBI's bind_param instead, after the prepare and before the
execute statement. TMTOWTDI. :-)

$sth->bind_param(1, $my_binary_data, SQL_BINARY);

--Wes

"Aasmund Midttun Godal" <postgresql%envisity.com@interlock.lexmark.com> on
10/24/2001 06:41:11 PM

To: "Wesley_Sheldahl/Lex/Lexmark.LEXMARK"@sweeper.lex.lexmark.com
cc: julio%bntsoft.com.br@interlock.lexmark.com,
pgsql-general%postgresql.org@interlock.lexmark.com,
alvherre%atentus.com@interlock.lexmark.com (bcc: Wesley
Sheldahl/Lex/Lexmark)
Subject: Re: [GENERAL] Record

It handles the unescaping, but you have to escape to update/insert, I use:

s/([^\w])/sprintf("\\%03o", ord($1))/eg;

Show quoted text

On Wed, 24 Oct 2001 11:42:31 -0400, wsheldah@lexmark.com wrote:

If you're using Perl and the DBD::Pg driver, then you can use bytea without
worrying about escaping anything, since the driver takes care of it.