function adsense_install in Google AdSense integration 5
Same name and namespace in other branches
- 5.3 adsense.install \adsense_install()
- 5.2 adsense.install \adsense_install()
- 6 adsense.install \adsense_install()
- 7 adsense.install \adsense_install()
1 call to adsense_install()
File
- ./
adsense.install, line 3
Code
function adsense_install() {
switch ($GLOBALS['db_type']) {
case 'mysql':
case 'mysqli':
$success = db_query("CREATE TABLE IF NOT EXISTS {adsense_clicks} (\n aid INT(10) NOT NULL AUTO_INCREMENT,\n ip VARCHAR(15) DEFAULT '0',\n timestamp INT(11) unsigned NOT NULL DEFAULT '0',\n path VARCHAR(255) NOT NULL DEFAULT '',\n PRIMARY KEY (aid),\n KEY (timestamp)\n ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
break;
case 'pgsql':
$success = db_query("CREATE TABLE {adsense_clicks} (\n aid SERIAL,\n ip VARCHAR(15) DEFAULT '0',\n timestamp INTEGER NOT NULL DEFAULT '0',\n path VARCHAR(255) DEFAULT '',\n PRIMARY KEY (aid));");
$success = db_query("CREATE INDEX {timestamp} ON {adsense_clicks} (timestamp);");
break;
}
if ($success) {
drupal_set_message(t('Adsense module table creation successful.'));
}
else {
drupal_set_message(t('Adsense module table creation was unsuccessful.'), 'error');
}
}