View source
<?php
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');
}
}
function node_import_uninstall() {
db_query("DROP TABLE {node_import_mappings}");
}
function node_import_update_1() {
$items = array();
switch ($GLOBALS['db_type']) {
case 'mysql':
case 'mysqli':
$items[] = update_sql("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':
$items[] = update_sql("CREATE TABLE {node_import_mappings} ( " . "\"type\" VARCHAR(16) NOT NULL DEFAULT '', " . "csv_headers TEXT NOT NULL, " . "mapping TEXT NOT NULL, " . "KEY \"type\" (\"type\") " . ");");
break;
}
return $items;
}