Re: [Cgi-session-user] Trouble with C::S::SQLite
Brought to you by:
sherzodr
From: Puneet K. <pu...@ei...> - 2006-03-07 03:56:01
|
Ok, making progress. I modified the CGI/Session/Driver/sqlite.pm like so -- sub store { my $self = shift; my ($sid, $datastr) = @_; return $self->set_error("store(): usage error") unless $sid && $datastr; #my $dbh = $self->{Handle}; my $dbh = DBI->connect("dbi:SQLite:dbname=/path/to/my.db") or die "Db connect failed: $DBI::errstr"; my $sth = $dbh->prepare("SELECT id FROM " . $self->table_name . " WHERE id=?"); And it works just fine. My session value is stored in the sessions table, and reused properly. So, the error is in the way $dbh is being passed. I am using the following syntax in my calling script -- new CGI::Session("driver:sqlite", $sid, {Handle=>$dbh}) and that is not working... the db handle is getting messed up. Any ideas from this little experiment, anyone? On Mar 6, 2006, at 9:30 PM, Ron Savage wrote: > On Mon, 6 Mar 2006 21:18:09 -0600, Puneet Kishor wrote: > > Hi Puneet > >> 34= sub store { >> 35= my $self = shift; >> 36= my ($sid, $datastr) = @_; >> 37= return $self->set_error("store(): usage error") unless $sid >> && $datastr; >> 38= >> 39= my $dbh = $self->{Handle}; 40= >> 41= my $sth = $dbh->prepare("SELECT id FROM " . $self- >>> table_name . " WHERE id=?"); > > At this point I would write the value returned by $self -> table_name() > to the web server's log, or to a disk file. That will tell you > /exactly/ what > the program thinks the table's name is. > >> 42= unless ( defined $sth ) { >> 43= return $self->set_error( "store(): \$sth->prepare >> failed with message " . $dbh->errstr ); >> 44= } . > -- Puneet Kishor |