4 * Store sessions data in Pear DB / ADODB / dba / PDO, ....
8 * Originally by Stanislav Shramko <stanis@movingmail.com>
9 * Minor rewrite by Reini Urban <rurban@x-ray.at> for Phpwiki.
10 * Quasi-major rewrite/decruft/fix by Jeff Dairiki <dairiki@dairiki.org>.
11 * ADODB, dba and PDO classes by Reini Urban.
13 * Warning: Enable USE_SAFE_DBSESSION if you get INSERT duplicate id warnings.
21 * DB handle, or WikiDB object (from which the DB handle will
24 * @param string $table
25 * @return bool|DbSession
26 * Name of SQL table containing session data.
28 function DbSession(&$dbh, $table = 'session')
30 // Check for existing DbSession handler
31 $db_type = $dbh->getParam('dbtype');
32 if (isa($dbh, 'WikiDB')) {
33 @include_once("lib/DbSession/" . $db_type . ".php");
35 $class = "DbSession_" . $db_type;
36 if (class_exists($class)) {
37 // dba has no ->_dbh, so this is used for the session link
38 $this->_backend = new $class($dbh->_backend->_dbh, $table);
42 //Fixme: E_USER_WARNING ignored!
43 trigger_error(sprintf(_("Your WikiDB DB backend ā%sā cannot be used for DbSession.") . " " .
44 _("Set USE_DB_SESSION to false."),
45 $db_type), E_USER_WARNING);
49 function currentSessions()
51 return $this->_backend->currentSessions();
56 return $this->_backend->query($sql);
59 function quote($string)
69 // c-hanging-comment-ender-p: nil
70 // indent-tabs-mode: nil