# cartDb.sql was originally generated by the autoSql program, which also 
# generated cartDb.c and cartDb.h.  This creates the database representation of
# an object which can be loaded and saved from RAM in a fairly 
# automatic way.

#A simple id/contents pair for persistent storing of cart variables
CREATE TABLE userDb (
    id integer unsigned not null auto_increment,	# Cart ID
    contents longblob not null,	# Contents - encoded variables
    reserved tinyint not null,	# True if a user (rather than session) cart
    firstUse DATETIME not null,	# First time this was used
    lastUse DATETIME not null,	# Last time this was used
    useCount int not null,	# Number of times used
    sessionKey varchar(255) NOT NULL DEFAULT '', # Random key to protect session ids
              #Indices
    PRIMARY KEY(id)
);

CREATE TABLE sessionDb (
    id integer unsigned not null auto_increment,	# Cart ID
    contents longblob not null,	# Contents - encoded variables
    reserved tinyint not null,	# True if a user (rather than session) cart
    firstUse DATETIME not null,	# First time this was used
    lastUse DATETIME not null,	# Last time this was used
    useCount int not null,	# Number of times used
    sessionKey varchar(255) NOT NULL DEFAULT '', # Random key to protect session ids
              #Indices
    PRIMARY KEY(id)
);
