RE: perl problem, continued - serializing...
by Tobias Hoellrich other posts by this author
Aug 2 2004 2:18AM messages near this date
view in the new Beta List Site
RE: perl problem, continued - serializing...
|
RE: perl problem, continued - serializing...
Bruce - what you're trying to do, won't work. You can't pass a database
handle to another process (to be precise, you can use a dbh in a process you
fork() yourself) and you can't serialize a DBH and expect that on
de-serializing you have a good connection again.
You will need to connect to the database from the process that you call with
system() as well. Think of the database connection as a network connection.
Would you expect a socket connection to survive a serialize/deserialize
operation?
Hope this helps
Tobias
> -----Original Message-----
> From: perl-win32-users-bounces@[...].com
> [mailto:perl-win32-users-bounces@[...].com] On
> Behalf Of bruce
> Sent: Sunday, August 01, 2004 4:41 PM
> To: 'Burak Gürsoy'; perl-win32-users@[...].com
> Subject: RE: perl problem, continued - serializing...
>
>
> hi...
>
> ok..
>
> i've tried a couple of the serial/deserializing mods from
> cpan. i've tried to create the dbi mysql connection handle,
> and then serialize/deserialize the handle, with the
> expectation that i could then use the result in the same test
> app to perform the dbi functions... either it can't be done,
> or i'm missing something. the results i'm getting back from
> the serialize/deserialize functions is not the orginal dbi handle....
>
> test code:
> #
>
> use strict;
> use DBI;
> use YAML;
>
>
> require ('mysql.inc');
>
> my $obj = YAML->new();
>
> my ($res0, $res1, $res2, $res3, $res4);
> my ($universityID, $semesterID, $schoolID, $deptID,
> $courseID); my ($university, $semester, $school, $dept, $course);
>
> my ($filename, $err_file);
> my ($serial, $deserial);
>
> # $ARGV is a perl var.. no need to declare
> my $arg = $ARGV[0];
>
> # setup the db connection process...(global)
> # in case we need to do a rollback at some time...
> my ($sth, $rv)="";
> my $dbh = "";
>
> print "open db\n";
> $dbh = open_dbi();
>
> my @q21;
> $q21[0] = $dbh;
> # at this point, dbh should be the connection id...
> print "dbh = ".$dbh."\n";
>
> $serial = $obj->dump($dbh);
> $deserial = $obj->load($serial);
> print "serial = ".$serial."\n";
> print "deserial = ".$deserial."\n";
_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@[...].com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Thread:
bruce
Tobias Hoellrich
bruce
Bruce
Rhesa Rozendaal
|