123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- <?php
- /**
- * QBF module - installer
- *
- * @copyright 2008 Ouest Systèmes Informatiques SARL
- * @author FG Marand
- * @license GPL2 or later
- * @package QBF
- */
- // $Id: qbf.install,v 1.1 2008-09-02 08:39:07 marand Exp $
- /**
- * Implement hook_install().
- *
- * - Create the QBF tables
- * - qbf_queries
- * - Assign initial settings
- * - none
- *
- * @todo support PGSQL
- * @return void
- */
- function qbf_install()
- {
- switch ($GLOBALS['db_type'])
- {
- case 'mysql':
- case 'mysqli':
- $sq = 'CREATE TABLE {qbf_queries} '
- . ' ( '
- . " `qid` INT(10) NOT NULL DEFAULT '0' COMMENT 'Query ID', "
- . " `uid` INT(10) NOT NULL DEFAULT '0' COMMENT 'User ID', "
- . " `name` VARCHAR(40) NOT NULL DEFAULT '' COMMENT 'Query name', "
- . " `query` TEXT NOT NULL COMMENT 'Query array', "
- . ' PRIMARY KEY (`qid`) , '
- . ' INDEX (`uid`) '
- . ' ) '
- . 'ENGINE = MyISAM '
- . 'CHARACTER SET = utf8 '
- . "COMMENT = 'QBF Query store' ";
- db_query($sq);
- break;
- case pgsql:
- default:
- drupal_set_message(t('Unsupported database backend for QBF module: @db',
- array('@db' => $GLOBALS['db_type'])), 'error');
- break;
- }
- }
- /**
- * Implement hook_uninstall().
- *
- * - Drop all the tables maintained by the module
- * - qbf_queries
- * - Remove nodes of all the types maintained by the module
- * - none
- * - Remove module settings
- * - none
- * - Do NOT remove module schema version from {system}
- *
- * @return void
- */
- function qbf_uninstall()
- {
- switch ($GLOBALS['db_type'])
- {
- case 'mysql':
- case 'mysqli':
- case 'pgsql':
- db_query("DROP TABLE {qbf_queries}");
- break;
- default:
- drupal_set_message(t('Unsupported database backend for QBF module: @db',
- array('@db' => $GLOBALS['db_type'])), 'error');
- break;
- }
- }
- /**
- * Implement hook_update_N().
- *
- * For now, just define a proper initial schema version.
- *
- * @return array
- */
- function qbf_update_5000()
- {
- return array();
- }
|