[Cgi-session-user] FW: CGI::Session issue
Brought to you by:
sherzodr
From: Sherzod R. <she...@ha...> - 2006-06-17 03:12:13
|
-----Original Message----- From: Sean Coady [mailto:coa...@ho...]=20 Sent: Friday, June 16, 2006 4:50 AM To: she...@cp... 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 =3D $dbh->selectrow_array(qq|SELECT a_session FROM $TABLE_NAME WHERE id=3D?|, 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 | | | | | +-----------+-------------+------+-----+---------+-------+ |