Re: [Cgi-session-user] MySQL driver doc bug (was: how load works)
Brought to you by:
sherzodr
From: Justin S. <ju...@sk...> - 2006-07-31 03:17:38
|
> Your test excluded creating the session table itself. Notice in the > docs for REPLACE INTO where it says that if there is no UNIQUE or > PRIMARY KEY constraint, then it will always INSERT, never update. Ah ha. Indeed, here is the table I've been using: CREATE TABLE sessions ( id CHAR(32) NOT NULL, a_session TEXT NOT NULL ); The docs do sort of complicate matters, as it's stated what the minimum table is for "most" SQL backends are here: http://search.cpan.org/~markstos/CGI-Session-4.14/lib/CGI/Session/ Driver/DBI.pm#STORAGE But, the docs specifically for MySQL: http://search.cpan.org/~markstos/CGI-Session-4.14/lib/CGI/Session/ Driver/mysql.pm Don't have any mention of how to create the table (so I have to guess?), but there are docs from the 3.x series: http://search.cpan.org/~sherzodr/CGI-Session-3.95/Session/MySQL.pm (which I found just searching on CPAN for, easy to forget to look at the version numbers) That do have directions for MySQL. Going through all that, I'm assuming the MySQL can use the generic table stated in the DBI.pm docs, and Postgres uses what is listed here: http://search.cpan.org/~markstos/CGI-Session-4.14/lib/CGI/Session/ Driver/postgresql.pm OK, I can apply that change to my docs as well :) Thanks for helping out with this; Justin Simoni -- :: is an eccentric artist, living and working in Denver, Colorado :: URL: http://justinsimoni.com :: PHO: 720.436.7701 :: Mailing List - http://justinsimoni.com/mailing_list.html On Jul 30, 2006, at 9:48 PM, Mark Stosberg wrote: > Justin Simoni wrote: >>> There's probably a bug here. Could you boil this down to a >>> Test::More >>> style test case? It looks like you are nearly there. >> Done! Be gentle - this is my first real Test::More test - I know >> these are supposed to be pretty simple, but setting up all the DBI >> parameters seems a bit verbose, but I've attached it to this >> message, as well as attempted to place it inline (notes to follow >> code): > > Thanks Justin. > > I adapted this test for the SQLite driver... and it passed when it > fails for MySQL. So that points to something MySQL-specific. > Looking at the code for the MySQL driver, it does do something a > little different. It use the non-standard "REPLACE INTO" function. > It's documented here: > > http://sunsite.mff.cuni.cz/MIRRORS/ftp.mysql.com/doc/en/REPLACE.html > > Your test excluded creating the session table itself. Notice in the > docs for REPLACE INTO where it says that if there is no UNIQUE or > PRIMARY KEY constraint, then it will always INSERT, never update. > > That sounds a lot like your case. If that's the issue. we should > add a big note to the MySQL driver about that. > > Mark > > -- > http://mark.stosberg.com/ > > |