dstar has asked for the wisdom of the Perl Monks concerning the following question:

I was having trouble with my Apache::Sessions code recently. The problem turned out to be a typo when setting up the DB connection. Fixed that, started getting an error on line 143 of Apache::Session::DBIStore.

So I added some code before the offending line:

### SDW DEBUG $self->{insert_sth}->trace(9, "/tmp/sessioncheck"); open(SDW_DEBUG_OUT, ">/tmp/serial"); print SDW_DEBUG_OUT "FOO".$serialized."BAR\n"; close(SDW_DEBUG_OUT);
And I get:

FOO bc6f80d5a358ae0f_session_idBAR
Note the linefeed between FOO and the start of the sessionid. The serialized data seems to start with a linefeed! Needless to say, this foobars the sql statement.

This can't be right, can it?

Replies are listed 'Best First'.
Re: Storable Problems
by perrin (Chancellor) on Aug 17, 2001 at 04:29 UTC
    There's nothing wrong with a line feed in a value being used in an SQL statement. The code probably uses DBI placeholders.
      Yup, it uses placeholders. The error message I get is
      DBD::Pg::st execute failed: ERROR: Unterminated quoted string at /usr +/local/share/perl/5.6.1/Apache/Session/DBIStore.pm line 150. DBD::Pg::st execute failed: ERROR: Unterminated quoted string at /usr +/local/share/perl/5.6.1/Apache/Session/DBIStore.pm line 150. [Wed Aug 15 21:50:09 2001] [error] Error! DBD::Pg::st execute failed: +ERROR: Unterminated quoted string at /usr/local/share/perl/5.6.1/Apa +che/Session/DBIStore.pm line 150. (in cleanup) DBD::Pg::st execute failed: ERROR: Unterminated quot +ed string at /usr/local/share/perl/5.6.1/Apache/Session/DBIStore.pm l +ine 150.
        You are using an older version of Apache::Session. The new version doesn't have a file called DBIStore.pm. Can you try upgrading to 1.53?