[Gambas-user] PictureDatabase with PostgreSQL
Pino Zollo
pinozollo at ...626...
Thu Jul 16 02:11:44 CEST 2009
Il mercoledì 15 luglio 2009 18:09:51 richard terry ha scritto:
> > By the time I was reading the PosgreSQL documentation. There it explains
> > a totally different way of handling blobs.
> >
> > They use the internal function pg_lo_import to import into the DB a large
> > object.
> > This returns a pointer OID that is actually written into the db table.
> >
> > I am going to experiments both ways...I will let you know how it goes.
>
> Please do.
Hi Richard...
I made it ! ...it took me few hours but finally I could modify the example to
work well also with PosgreSQL !
It is left just the 'Delete' function which, not only has to delete the data's
from the table but also the images from their repository.
I will polish a little bit and then put all on my site for general
downloading...
Just for your curiosity....only one SQL instruction is used for storing the
image and the thumb one:
ResultPictures = databaseConnection.Exec("INSERT INTO pictures (description,
image, thumb) VALUES ('" & Descr &
"', lo_import('" & ImagePath & "'), lo_import('" & tempFile
& "') )")
where image and thumb are of type 'oid'
...and for retrieving one per image
ResultOID = ModuleDatabase.databaseConnection.Exec("SELECT lo_export(" &
Str(oid_im) & ",'" & tempFile & "') ;")
Best regards
Pino
--
Key ID: 0xF6768208
Key fingerprint = B16D 0A7C 5B29 A334 CE6A 71F6 EAF8 3D88 F676 8208
Key server: hkp://wwwkeys.eu.pgp.net
More information about the User
mailing list