nodeapi_example.install

  1. examples
    1. 6 nodeapi_example/nodeapi_example.install
    2. 7 nodeapi_example/nodeapi_example.install
    3. 8 nodeapi_example/nodeapi_example.install
  2. drupal
    1. 5 developer/examples/nodeapi_example.install

Functions & methods

NameDescription
nodeapi_example_installImplementation of hook_install().
nodeapi_example_uninstallImplementation of hook_uninstall().
nodeapi_example_update_1

File

developer/examples/nodeapi_example.install
View source
  1. <?php
  2. /**
  3. * Implementation of hook_install().
  4. */
  5. function nodeapi_example_install() {
  6. switch ($GLOBALS['db_type']) {
  7. case 'mysql':
  8. case 'mysqli':
  9. db_query("
  10. CREATE TABLE {nodeapi_example} (
  11. nid int(10) unsigned NOT NULL default '0',
  12. rating int(10) unsigned NOT NULL default '0',
  13. PRIMARY KEY (nid)
  14. ) /*!40100 DEFAULT CHARACTER SET utf8 */;
  15. ");
  16. break;
  17. case 'pgsql':
  18. db_query("
  19. CREATE TABLE {nodeapi_example} (
  20. nid int NOT NULL default '0',
  21. rating int NOT NULL default '0',
  22. PRIMARY KEY (nid));
  23. ");
  24. break;
  25. }
  26. }
  27. /**
  28. * Implementation of hook_uninstall().
  29. */
  30. function nodeapi_example_uninstall() {
  31. if (db_table_exists('nodeapi_example')) {
  32. db_query("DROP TABLE {nodeapi_example}");
  33. }
  34. }
  35. function nodeapi_example_update_1() {
  36. return _system_update_utf8(array('nodeapi_example'));
  37. }
Login or register to post comments