/** * Gets the Last Insert ID * @access public * @return mixed Returns either the ID of the last inserted AUTO_INCREMENT record, or -1 if the * last query was not an insert, or false if the driver does not support this feature. * @example insert_id.php GetInsertID example. */ function GetInsertID() { $this->ClearError(); if (isset($this->Support["InsertID"]) && $this->Support["InsertID"]) { $result = $this->_driver->InsertID(); } else { $result = false; } $this->GetDriverError(); return $result; }
/** * This function installs the database settings * @author Bobby Easland * @version 1.0 */ function install_settings() { $this->uninstall_settings(); $QpdColumns = $this->DB->Query('show columns from ' . TABLE_PRODUCTS_DESCRIPTION); $addPcol = false; while ($pdCol = $this->DB->FetchArray($QpdColumns)) { if ($pdCol['field'] == 'products_seo_url') { $addPcol = true; } } $QcdColumns = $this->DB->Query('show columns from ' . TABLE_CATEGORIES_DESCRIPTION); $addCcol = false; while ($cdCol = $this->DB->FetchArray($QcdColumns)) { if ($cdCol['field'] == 'categories_seo_url') { $addCcol = true; } } if ($addPcol === true) { $this->DB->Query('alter table ' . TABLE_PRODUCTS_DESCRIPTION . ' add products_seo_url varchar( 100 ) not null'); } if ($addCcol === true) { $this->DB->Query('alter table ' . TABLE_CATEGORIES_DESCRIPTION . ' add categories_seo_url varchar( 100 ) not null'); } $sort_order_query = "SELECT MAX(sort_order) as max_sort FROM `" . TABLE_CONFIGURATION_GROUP . "`"; $sort = $this->DB->FetchArray($this->DB->Query($sort_order_query)); $next_sort = $sort['max_sort'] + 1; $insert_group = "INSERT INTO `" . TABLE_CONFIGURATION_GROUP . "` VALUES ('', 'store', 'SEO URLs', 'Options for Ultimate SEO URLs by Chemo', '" . $next_sort . "', '1')"; $this->DB->Query($insert_group); $group_id = $this->DB->InsertID(); foreach ($this->default_config as $key => $value) { $sql = str_replace('GROUP_INSERT_ID', $group_id, $value['QUERY']); $this->DB->Query($sql); } $insert_cache_table = "CREATE TABLE `cache` (\n\t\t `cache_id` varchar(32) NOT NULL default '',\n\t\t `cache_language_id` tinyint(1) NOT NULL default '0',\n\t\t `cache_name` varchar(255) NOT NULL default '',\n\t\t `cache_data` mediumtext NOT NULL,\n\t\t `cache_global` tinyint(1) NOT NULL default '1',\n\t\t `cache_gzip` tinyint(1) NOT NULL default '1',\n\t\t `cache_method` varchar(20) NOT NULL default 'RETURN',\n\t\t `cache_date` datetime NOT NULL default '0000-00-00 00:00:00',\n\t\t `cache_expires` datetime NOT NULL default '0000-00-00 00:00:00',\n\t\t PRIMARY KEY (`cache_id`,`cache_language_id`),\n\t\t KEY `cache_id` (`cache_id`),\n\t\t KEY `cache_language_id` (`cache_language_id`),\n\t\t KEY `cache_global` (`cache_global`)\n\t\t) TYPE=MyISAM;"; $this->DB->Query($insert_cache_table); }
/** * This function installs the database settings * @author Bobby Easland * @version 1.0 */ function install_settings() { $this->uninstall_settings(); $sort_order_query = "SELECT MAX(sort_order) as max_sort FROM `" . TABLE_CONFIGURATION_GROUP . "`"; $sort = $this->DB->FetchArray($this->DB->Query($sort_order_query)); $next_sort = $sort['max_sort'] + 1; $insert_group = "INSERT INTO `" . TABLE_CONFIGURATION_GROUP . "` VALUES ('', 'SEO URLs', 'Options for Ultimate SEO URLs by Chemo', '" . $next_sort . "', '1')"; $this->DB->Query($insert_group); $group_id = $this->DB->InsertID(); foreach ($this->default_config as $key => $value) { $sql = str_replace('GROUP_INSERT_ID', $group_id, $value['QUERY']); $this->DB->Query($sql); } $insert_cache_table = "CREATE TABLE `cache` (\r\n\t\t `cache_id` varchar(32) NOT NULL default '',\r\n\t\t `cache_language_id` tinyint(1) NOT NULL default '0',\r\n\t\t `cache_name` varchar(255) NOT NULL default '',\r\n\t\t `cache_data` mediumtext NOT NULL,\r\n\t\t `cache_global` tinyint(1) NOT NULL default '1',\r\n\t\t `cache_gzip` tinyint(1) NOT NULL default '1',\r\n\t\t `cache_method` varchar(20) NOT NULL default 'RETURN',\r\n\t\t `cache_date` datetime NOT NULL default '0000-00-00 00:00:00',\r\n\t\t `cache_expires` datetime NOT NULL default '0000-00-00 00:00:00',\r\n\t\t PRIMARY KEY (`cache_id`,`cache_language_id`),\r\n\t\t KEY `cache_id` (`cache_id`),\r\n\t\t KEY `cache_language_id` (`cache_language_id`),\r\n\t\t KEY `cache_global` (`cache_global`)\r\n\t\t) TYPE=MyISAM;"; $this->DB->Query($insert_cache_table); }