- examples
- drupal
Functions & methods
| Name | Description |
|---|---|
| nodeapi_example_install | Implementation of hook_install(). |
| nodeapi_example_uninstall | Implementation of hook_uninstall(). |
| nodeapi_example_update_1 |
File
developer/examples/nodeapi_example.installView source
- <?php
-
-
- /**
- * Implementation of hook_install().
- */
- function nodeapi_example_install() {
- switch ($GLOBALS['db_type']) {
- case 'mysql':
- case 'mysqli':
- db_query("
- CREATE TABLE {nodeapi_example} (
- nid int(10) unsigned NOT NULL default '0',
- rating int(10) unsigned NOT NULL default '0',
- PRIMARY KEY (nid)
- ) /*!40100 DEFAULT CHARACTER SET utf8 */;
- ");
- break;
- case 'pgsql':
- db_query("
- CREATE TABLE {nodeapi_example} (
- nid int NOT NULL default '0',
- rating int NOT NULL default '0',
- PRIMARY KEY (nid));
- ");
- break;
- }
- }
-
- /**
- * Implementation of hook_uninstall().
- */
- function nodeapi_example_uninstall() {
- if (db_table_exists('nodeapi_example')) {
- db_query("DROP TABLE {nodeapi_example}");
- }
- }
-
- function nodeapi_example_update_1() {
- return _system_update_utf8(array('nodeapi_example'));
- }
-