ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> perl-DBI
perl-DBI
Re: updating blobs with DBD::Pg
by Neil Lunn other posts by this author
Oct 20 2000 10:11AM messages near this date
Ask again: Question about DBD::mysql | RE: Ask again: Question about DBD::mysql
> From: Herbert Liechti <Herbert.Liechti@[...].ch>
> To: DBI-USER GROUP <dbi-users@[...].org>
> Subject: Re: updating blobs with DBD::Pg
> Date: Fri, 20 Oct 2000 00:25:43 +0200
> 
> 
> Herbert Liechti wrote:
>  >
>  > Hello
>  >
>  > I'm trying to update blob fields with the $dbh->func interface
>  > of the Postgres driver. I'm able to create a new blob field.
>  > Content is written correctly.
>  >
>  > When I try to update an existing blob (overwriting the whole
>  > content of the blob) the content is mixed up with the previous
>  > version of the blob field. Here ist a snipped of my code:
>  >
>  > my $lobjId = $self->getOid($_); # Returns the oid
>  > die "Sorry got no oid for updating" unless ( $lobjId  );
>  >
>  > my $lobj_fd = $dbh->func($lobjId, $dbh->{pg_INV_WRITE}, 'lo_open');

Not understanding your purpose may be leading me astray here, but do you not 
want to create a new object when overwriting? This is the only way I can see 
to re-initialise the field.

>  > my $len = length($self->{data}->{$field});  # new content
>  > my $pos = $dbh->func($lobj_fd, 0, 0, 'lo_lseek'); # Seek Position 0
>  > die "Error while positioning to 0 in oid $lobjId" unless ( defined( $pos 
> ) );
>  >
>  > my $nbytes = $dbh->func($lobj_fd, $self->{data}->{$_}, $len, 
> 'lo_write');
>  > die "Error on writing to oid" unless ( defined( $nbytes ) );
>  >
>  > print "WROTE $nbytes of $len\n"; # Debug
>  >
>  > die "Error while closing oid $!" unless ( $dbh->func($lobj_fd, 
> 'lo_close'));
>  >
>  > Does anybody know what is wrong here?
>  > Thanks for helping
> 
> Sorry for insisting ;-)
> Is actually nobody out there who solved this problem?
> Thanks for helping
> 
> Regards Herbie
> 
> --
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Herbert Liechti                     E-Mail: Herbert.Liechti@[...].ch
> ThinX networked business services        Stahlrain 10, CH-5200 Brugg
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> 
> ------------------------------------------------------------------------------
> DBI HOME PAGE AND ARCHIVES: http://www.symbolstone.org/technology/perl/DBI/
> To unsubscribe from this list, please visit: 
> http://www.isc.org/dbi-lists.html
> If you are without web access, or if you are having trouble with the web 
> page,
> please send mail to dbi-users-request@[...].org with the subject line of:
> 'unsubscribe'.
> ------------------------------------------------------------------------------
> 

_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.

Share information about yourself, create your own public profile at 
http://profiles.msn.com.



------------------------------------------------------------------------------
DBI HOME PAGE AND ARCHIVES: http://www.symbolstone.org/technology/perl/DBI/
To unsubscribe from this list, please visit: http://www.isc.org/dbi-lists.html
If you are without web access, or if you are having trouble with the web page, 
please send mail to dbi-users-request@[...].org with the subject line of:
'unsubscribe'.
------------------------------------------------------------------------------ 

Privacy Policy | Email Opt-out | Feedback | Syndication
© 2004 ActiveState, a division of Sophos All rights reserved