For Programmers: Free Programming Magazines  


Home > Archive > PHP SQL > January 2005 > PHP and PostgreSQL large object









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author PHP and PostgreSQL large object
Jorch

2005-01-23, 8:57 pm

Hi,

Read code from above...

Do I have to use pg_lo_unlink() to remove imported blob
if "INSERT..." query fails or is it enouhg to make ROLLBACK??

I noticed that db does not loose any size after ROLLBACK
(yes, I have tried to VACUUM it also, size stays same)

Regards
-jori luoto

// CODE

//... openging connection etc...
pg_query($dao,"BEGIN");

$loid = pg_lo_import($dao,"/path/to/file");

if(pg_query($dao,"INSERT INTO lot(loid,name) VALUES ($loid,"name)") ===
false){
pg_query($dao,"ROLLBACK");
}else{
pg_query($dao,"COMMIT);
}

//..closing etc...
Jorch

2005-01-23, 8:57 pm


SORRY!!

I was too fast, things works as they should be!!!

VACUUM works when I vacuum whole db (like it have to do when removing blobs)

-jori

Jorch wrote:

> Hi,
>
> Read code from above...
>
> Do I have to use pg_lo_unlink() to remove imported blob
> if "INSERT..." query fails or is it enouhg to make ROLLBACK??
>
> I noticed that db does not loose any size after ROLLBACK
> (yes, I have tried to VACUUM it also, size stays same)
>
> Regards
> -jori luoto
>
> // CODE
>
> //... openging connection etc...
> pg_query($dao,"BEGIN");
>
> $loid = pg_lo_import($dao,"/path/to/file");
>
> if(pg_query($dao,"INSERT INTO lot(loid,name) VALUES ($loid,"name)") ===
> false){
> pg_query($dao,"ROLLBACK");
> }else{
> pg_query($dao,"COMMIT);
> }
>
> //..closing etc...

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com