You are here

function cas_install in CAS 5.3

Same name and namespace in other branches
  1. 5.4 cas.install \cas_install()
  2. 6.3 cas.install \cas_install()
  3. 6.2 cas.install \cas_install()

Inastall db tables.

File

./cas.install, line 13
CAS Install

Code

function cas_install() {
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':

      // the {tablename} syntax is so multisite installs can add a
      // prefix to the table name as set in the settings.php file
      db_query("CREATE TABLE {cas_login_data} (\n\t\t  cas_session_id varchar(256) NOT NULL default '',\n\t\t  uid int unsigned NOT NULL,\n          PRIMARY KEY  (cas_session_id)\n        ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
      break;
    case 'pgsql':
      db_query("CREATE TABLE {cas_login_data} (\n      \t  cas_session_id varchar(256) NOT NULL default '',\n      \t  uid integer NOT NULL CHECK (uid >= 0),\n          PRIMARY KEY  (cas_session_id)\n        )");

      // Pgsql requires keys and indexes to be defined separately.
      // It's important to name the index as {tablename}_fieldname_idx
      // (the trailing _idx!) so update scripts can be written easily
      db_query("CREATE INDEX {cas_login_data}_uid_idx\n                ON {cas_login_data} (uid)");
      break;
  }
}