You are here

function node_import_install in Node import 5

Same name and namespace in other branches
  1. 6 node_import.install \node_import_install()

File

./node_import.install, line 4

Code

function node_import_install() {
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      $ret = db_query("CREATE TABLE {node_import_mappings} ( " . "type VARCHAR(16) NOT NULL DEFAULT '', " . "csv_headers TEXT NOT NULL, " . "mapping TEXT NOT NULL, " . "KEY type (type) " . ") /*!40100 DEFAULT CHARACTER SET utf8 */;");
      break;
    case 'pgsql':
      $ret = db_query("CREATE TABLE {node_import_mappings} ( " . "\"type\" VARCHAR(16) NOT NULL DEFAULT '', " . "csv_headers TEXT NOT NULL, " . "mapping TEXT NOT NULL, " . "KEY \"type\" (\"type\") " . ");");
      break;
  }
  if ($ret) {
    drupal_set_message(t('The node_import database tables have been created. You can import a CSV file with <a href="@node_import-url">the node import wizard</a>.', array(
      '@node_import-url' => url('admin/content/node_import'),
    )));
  }
  else {
    drupal_set_message(t('The creation of node_import database tables has failed. Check the README.txt file in the modules/node_import directory on instructions to create the table manually.'), 'error');
  }
}