| 1 |
<?php
|
| 2 |
// $Id$
|
| 3 |
|
| 4 |
/**
|
| 5 |
* Implementation of hook_install().
|
| 6 |
*/
|
| 7 |
function collect_nodes_install() {
|
| 8 |
switch ($GLOBALS['db_type']) {
|
| 9 |
case 'mysql':
|
| 10 |
case 'mysqli':
|
| 11 |
$result = db_query("CREATE TABLE collect_nodes (
|
| 12 |
nid INT NOT NULL,
|
| 13 |
uid INT NOT NULL,
|
| 14 |
last INT,
|
| 15 |
PRIMARY KEY (nid, uid)
|
| 16 |
) Type=MyISAM /*!40100 DEFAULT CHARACTER SET utf8 */;
|
| 17 |
");
|
| 18 |
break;
|
| 19 |
case 'pgsql':
|
| 20 |
// TODO: need this
|
| 21 |
break;
|
| 22 |
}
|
| 23 |
|
| 24 |
if ($result) {
|
| 25 |
drupal_set_message(t('collect_nodes module database table created successfully.'));
|
| 26 |
}
|
| 27 |
else {
|
| 28 |
drupal_set_message(t('collect_nodes module database table creation failure. '), 'error');
|
| 29 |
}
|
| 30 |
}
|
| 31 |
|
| 32 |
/**
|
| 33 |
* Implementation of hook_uninstall().
|
| 34 |
*/
|
| 35 |
function collect_nodes_uninstall() {
|
| 36 |
db_query('DROP TABLE {collect_nodes}');
|
| 37 |
}
|