logo       
Google Custom Search
    AddThis Social Bookmark Button

FW: CGI::Session issue: msg#00017

Subject: FW: CGI::Session issue

-----Original Message-----
From: Sean Coady [mailto:coadysean-PkbjNfxxIARBDgjK7y7TUQ@xxxxxxxxxxxxxxxx] 
Sent: Friday, June 16, 2006 4:50 AM
To: sherzodr-a09SyBuiYrA@xxxxxxxxxxxxxxxx
Subject: CGI::Session issue


Hi Sherzod,

I've been trying to set up CGI::Session to work with MySQL, but the retrieve
method always fails when fetching the session given an id. The end result is
that I keep getting a new session ID every time--not very helpful. I can see
from the DBI trace that the REPLACE is working, and it's definitely going
into the db, but the call "my $data = $dbh->selectrow_array(qq|SELECT
a_session FROM $TABLE_NAME WHERE id=?|, undef, $sid);" in
CGI::Session::MySQL.pm is returning the empty string for $data.

One thing I noticed (it may be unrelated but important nonetheless) is that
it's impossible to create the table in MySQL as follows:

CREATE TABLE sessions (
        id CHAR(32) NOT NULL PRIMARY KEY,
        a_session TEXT NOT NULL
    );

MySQL silently converts all chars to a varchar in the following
circumstance:

"If any column in a table has a variable length, the entire row becomes
variable-length as a result. Therefore, if a table contains any
variable-length columns (VARCHAR, TEXT, or BLOB), all CHAR columns longer
than three characters are changed to VARCHAR columns."

http://dev.mysql.com/doc/refman/5.0/en/silent-column-changes.html

you end up with a table like this:

mysql> desc sessions;
+-----------+-------------+------+-----+---------+-------+
| Field     | Type        | Null | Key | Default | Extra |
+-----------+-------------+------+-----+---------+-------+
| id        | varchar(32) |      | PRI |         |       |
| a_session | text        |      |     |         |       |
+-----------+-------------+------+-----+---------+-------+



Try Searching:
servers, voip, java, networking, microsoft ...
<Prev in Thread] Current Thread [Next in Thread>