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

I'm taking the big jump to HTTP Sessions instead of trying to pass along values via hidden values on forms and have decided to use the Apache::Session package to interface with my MySQL server rather than start from scratch and code my own functions (which I may fall back on shortly). Anyway, my question is this: I believe I have the syntax for the tie function correct because I've followed the docs thus far but what fields/sizes should I create for my MySQL sessions table? I've looked trough the DBI.pm and the MySQL.pm and cannot figure it out. I appreciate any help. -Adam Stanley Nethosters, Inc.

Replies are listed 'Best First'.
Re: Apache::Session::MySQL
by btrott (Parson) on Jan 18, 2001 at 02:28 UTC
      A slight modification to your CREATE TABLE query, I have used, is something similar to this:
      CREATE TABLE sessions ( id CHAR(32) NOT NULL PRIMARY KEY , length SMALLINT UNSIGNED NOT NULL , a_session BLOB , time TIMESTAMP )

      One common problem with using the Apache::Session::* modules is that the storage medium for session information can become quite large.

      The addition of the TIMESTAMP field, to the table, tells the database to set the "modified" column to the current date upon an INSERT or UPDATE. This change allows you to reap old session data without having to guess, or use Storable::thaw() to peek at each record in the database, which could be very time consuming.

      Update:Changed the SQL query to work with the newest version of Apache::Session::MySQL.