706c8c2b49fcbd941c9da43c1b8a950c0c33f5ba galt Mon Feb 10 23:54:13 2014 -0800 now converting hgsid and hguid to strings. when the hgsid cart var or hguid cookie is not found it returns NULL instead of 0. diff --git src/hg/inc/cart.h src/hg/inc/cart.h index 014719a..403d4c6 100644 --- src/hg/inc/cart.h +++ src/hg/inc/cart.h @@ -17,84 +17,84 @@ // If If cgi created new and oldVars are stored, then will be CART_VAR_EMPTY in old vars #define CART_VAR_EMPTY "[]" #define IS_CART_VAR_EMPTY(var) ((var) == NULL || sameString(var,CART_VAR_EMPTY)) typedef struct sqlConnection *(*DbConnector)(); /* funtion type used to get a connection to database */ typedef void (*DbDisconnect)(struct sqlConnection **pConn); /* function type used to cleanup a connection from database */ struct cart /* A cart of settings that persist. */ { struct cart *next; /* Next in list. */ - unsigned int userId; /* User ID in database. */ - unsigned int sessionId; /* Session ID in database. */ + char *userId; /* User ID in database. */ + char *sessionId; /* Session ID in database. */ struct hash *hash; /* String valued hash. */ struct hash *exclude; /* Null valued hash of variables not to save. */ struct cartDb *userInfo; /* Info on user. */ struct cartDb *sessionInfo; /* Info on session. */ }; INLINE char *_cartVarDbName(const char *db, const char *var) /* generate cart variable name that is local to an assembly database. * Only for use inside of cart.h. WARNING: static return */ { static char buf[PATH_LEN]; // something rather big safef(buf, sizeof(buf), "%s_%s", var, db); return buf; } boolean cartTablesOk(struct sqlConnection *conn); /* Return TRUE if cart tables are accessible (otherwise, the connection * doesn't do us any good). */ -struct cart *cartNew(unsigned int userId, unsigned int sessionId, +struct cart *cartNew(char *userId, char *sessionId, char **exclude, struct hash *oldVars); /* Load up cart from user & session id's. Exclude is a null-terminated list of * strings to not include. oldVars is an optional hash to put in values * that were just overwritten by cgi-variables. */ struct cart *cartOfNothing(); /* Create a new, empty, cart with no real connection to the database. */ struct cart *cartFromHash(struct hash *hash); /* Create a cart from hash */ -struct cart *cartFromCgiOnly(unsigned int userId, unsigned int sessionId, +struct cart *cartFromCgiOnly(char *userId, char *sessionId, char **exclude, struct hash *oldVars); /* Create a new cart that contains only CGI variables, nothing from the * database, and no way to write back to database either. */ void cartCheckout(struct cart **pCart); /* Save cart to database and free it up. */ void cartEncodeState(struct cart *cart, struct dyString *dy); /* Add a CGI-encoded var=val&... string of all cart variables to dy. */ char *cartSessionVarName(); /* Return name of CGI session ID variable. */ -unsigned int cartSessionId(struct cart *cart); +char *cartSessionId(struct cart *cart); /* Return session id. */ char *cartSidUrlString(struct cart *cart); /* Return session id string as in hgsid=N . */ -unsigned int cartUserId(struct cart *cart); +char *cartUserId(struct cart *cart); /* Return session id. */ void cartRemove(struct cart *cart, char *var); /* Remove variable from cart. */ void cartRemoveExcept(struct cart *cart, char **except); /* Remove variables except those in null terminated except array * from cart. Except array may be NULL in which case all * are removed. */ struct slPair *cartVarsLike(struct cart *cart, char *wildCard); /* Return a slPair list of cart vars that match the wildcard */ struct slPair *cartVarsWithPrefix(struct cart *cart, char *prefix); /* Return a slPair list of cart vars that begin with prefix */