本文整理汇总了PHP中Fisharebest\Webtrees\Database::exec方法的典型用法代码示例。如果您正苦于以下问题:PHP Database::exec方法的具体用法?PHP Database::exec怎么用?PHP Database::exec使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Fisharebest\Webtrees\Database
的用法示例。
在下文中一共展示了Database::exec方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: upgrade
/**
* Upgrade to to the next version
*/
public function upgrade()
{
// Delete old configuration setting
Database::exec("DELETE FROM `##gedcom_setting` WHERE setting_name IN ('SEARCH_FACTS_DEFAULT', 'DISPLAY_JEWISH_GERESHAYIM', 'DISPLAY_JEWISH_THOUSANDS')");
// Increase the password column from 64 to 128 characters
Database::exec("ALTER TABLE `##user` CHANGE password password VARCHAR(128) COLLATE utf8_unicode_ci NOT NULL");
}
示例2: upgrade
/**
* Upgrade to to the next version
*/
public function upgrade()
{
// New modules (charts) have been added.
Module::getInstalledModules('enabled');
// Delete old/unused settings
Database::exec("DELETE FROM `##gedcom_setting` WHERE setting_name IN ('COMMON_NAMES_ADD', 'COMMON_NAMES_REMOVE', 'COMMON_NAMES_THRESHOLD')");
}
示例3: upgrade
/**
* Upgrade to to the next version
*/
public function upgrade()
{
// Tree settings become site settings
Database::exec("INSERT IGNORE INTO `##site_setting` (setting_name, setting_value)" . " SELECT setting_name, setting_value" . " FROM `##gedcom_setting`" . " WHERE setting_name IN ('SHOW_REGISTER_CAUTION', 'WELCOME_TEXT_CUST_HEAD') OR setting_name LIKE 'WELCOME_TEXT_AUTH_MODE%'" . " GROUP BY setting_name");
Database::exec("DELETE FROM `##gedcom_setting` WHERE setting_name IN ('ALLOW_EDIT_GEDCOM', 'SHOW_REGISTER_CAUTION', 'WELCOME_TEXT_CUST_HEAD') OR setting_name LIKE 'WELCOME_TEXT_AUTH_MODE%'");
Database::exec("DELETE FROM `##site_setting` WHERE setting_name IN ('STORE_MESSAGES')");
}
示例4: upgrade
/**
* Upgrade to to the next version
*/
public function upgrade()
{
// - delete unused settings and update indexes
Database::exec("DELETE FROM `##site_setting` WHERE setting_name IN ('WELCOME_TEXT_CUST_HEAD')");
// Modern versions of Internet Explorer use a different user-agent string
Database::exec("INSERT IGNORE INTO `##site_access_rule` (user_agent_pattern, rule, comment) VALUES" . " ('Mozilla/% (Windows%; Trident%; rv:%) like Gecko', 'allow', 'Modern Internet Explorer')");
}
示例5: upgrade
/** {@inheritDoc} */
public function upgrade()
{
// Add the new columns
try {
Database::exec("ALTER TABLE `##favorites`" . " CHANGE fv_id favorite_id INTEGER AUTO_INCREMENT NOT NULL," . " CHANGE fv_gid xref VARCHAR(20) NULL," . " CHANGE fv_type favorite_type ENUM('INDI', 'FAM', 'SOUR', 'REPO', 'OBJE', 'NOTE', 'URL') NOT NULL," . " CHANGE fv_url url VARCHAR(255) NULL," . " CHANGE fv_title title VARCHAR(255) NULL," . " CHANGE fv_note note VARCHAR(1000) NULL," . " ADD user_id INTEGER NULL AFTER favorite_id," . " ADD gedcom_id INTEGER NOT NULL AFTER user_id," . " DROP KEY ix1," . " ADD KEY news_ix1 (gedcom_id, user_id)");
} catch (PDOException $ex) {
// Already updated?
}
// Migrate data from the old columns to the new ones
try {
Database::exec("UPDATE `##favorites` f" . " LEFT JOIN `##gedcom` g ON (f.fv_file =g.gedcom_name)" . " LEFT JOIN `##user` u ON (f.fv_username=u.user_name)" . " SET f.gedcom_id=g.gedcom_id, f.user_id=u.user_id");
} catch (PDOException $ex) {
// Already updated?
}
// Delete orphaned rows
try {
Database::exec("DELETE FROM `##favorites` WHERE user_id IS NULL AND gedcom_id IS NULL");
} catch (PDOException $ex) {
// Already updated?
}
// Delete the old column
try {
Database::exec("ALTER TABLE `##favorites` DROP fv_username, DROP fv_file");
} catch (PDOException $ex) {
// Already updated?
}
// Rename the table
try {
Database::exec("RENAME TABLE `##favorites` TO `##favorite`");
} catch (PDOException $ex) {
// Already updated?
}
}
示例6: upgrade
/** {@inheritDoc} */
public function upgrade()
{
// Add new columns
try {
Database::exec("ALTER TABLE `##news`" . " ADD user_id INTEGER NULL AFTER n_id," . " ADD gedcom_id INTEGER NULL AFTER user_id," . " ADD updated TIMESTAMP ON UPDATE CURRENT_TIMESTAMP DEFAULT CURRENT_TIMESTAMP," . " ADD KEY news_ix1 (user_id, updated)," . " ADD KEY news_ix2 (gedcom_id, updated)");
} catch (PDOException $ex) {
// Already updated?
}
// Migrate data from the old columns to the new ones
try {
Database::exec("UPDATE `##news` n" . " LEFT JOIN `##gedcom` g ON (n.n_username=g.gedcom_name)" . " LEFT JOIN `##user` u ON (n.n_username=u.user_name)" . " SET n.gedcom_id=g.gedcom_id, n.user_id=u.user_id, updated=FROM_UNIXTIME(n_date)");
} catch (PDOException $ex) {
// Already updated?
}
// Delete orphaned rows
try {
Database::exec("DELETE FROM `##news` WHERE user_id IS NULL AND gedcom_id IS NULL");
} catch (PDOException $ex) {
// Already updated?
}
// Delete/rename old columns
try {
Database::exec("ALTER TABLE `##news`" . " DROP n_username, DROP n_date," . " CHANGE n_id news_id INTEGER NOT NULL AUTO_INCREMENT," . " CHANGE n_title subject VARCHAR(255) COLLATE utf8_unicode_ci," . " CHANGE n_text body TEXT COLLATE utf8_unicode_ci");
} catch (PDOException $ex) {
// Already updated?
}
}
示例7: upgrade
/**
* Upgrade to to the next version
*/
public function upgrade()
{
// Update config data defining theme selection
Database::exec("UPDATE `##gedcom_setting` SET setting_value=TRIM(LEADING 'themes/' FROM TRIM(TRAILING '/' FROM setting_value)) WHERE setting_name='THEME_DIR'");
Database::exec("UPDATE `##user_setting` SET setting_value=TRIM(LEADING 'themes/' FROM TRIM(TRAILING '/' FROM setting_value)) WHERE setting_name='THEME_DIR'");
Database::exec("UPDATE `##user_gedcom_setting` SET setting_value=TRIM(LEADING 'themes/' FROM TRIM(TRAILING '/' FROM setting_value)) WHERE setting_name='THEME_DIR'");
}
示例8: upgrade
/**
* Upgrade to to the next version
*/
public function upgrade()
{
// Use LONGTEXT instead of TEXT and MEDIUMTEXT, and make NOT NULL.
Database::exec("UPDATE `##news` SET body = '' WHERE body IS NULL");
Database::exec("UPDATE `##other` SET o_gedcom = '' WHERE o_gedcom IS NULL");
Database::exec("UPDATE `##places` SET p_std_soundex = '' WHERE p_std_soundex IS NULL");
Database::exec("UPDATE `##places` SET p_dm_soundex = '' WHERE p_dm_soundex IS NULL");
Database::exec("ALTER TABLE `##block_setting` CHANGE setting_value setting_value LONGTEXT COLLATE utf8_unicode_ci NOT NULL");
Database::exec("ALTER TABLE `##change` CHANGE new_gedcom new_gedcom LONGTEXT COLLATE utf8_unicode_ci NOT NULL");
Database::exec("ALTER TABLE `##change` CHANGE old_gedcom old_gedcom LONGTEXT COLLATE utf8_unicode_ci NOT NULL");
Database::exec("ALTER TABLE `##families` CHANGE f_gedcom f_gedcom LONGTEXT COLLATE utf8_unicode_ci NOT NULL");
Database::exec("ALTER TABLE `##individuals` CHANGE i_gedcom i_gedcom LONGTEXT COLLATE utf8_unicode_ci NOT NULL");
Database::exec("ALTER TABLE `##log` CHANGE log_message log_message LONGTEXT COLLATE utf8_unicode_ci NOT NULL");
Database::exec("ALTER TABLE `##media` CHANGE m_gedcom m_gedcom LONGTEXT COLLATE utf8_unicode_ci NOT NULL");
Database::exec("ALTER TABLE `##message` CHANGE body body LONGTEXT COLLATE utf8_unicode_ci NOT NULL");
Database::exec("ALTER TABLE `##module_setting` CHANGE setting_value setting_value LONGTEXT COLLATE utf8_unicode_ci NOT NULL");
Database::exec("ALTER TABLE `##news` CHANGE body body LONGTEXT COLLATE utf8_unicode_ci NOT NULL");
Database::exec("ALTER TABLE `##other` CHANGE o_gedcom o_gedcom LONGTEXT COLLATE utf8_unicode_ci NOT NULL");
Database::exec("ALTER TABLE `##places` CHANGE p_std_soundex p_std_soundex LONGTEXT COLLATE utf8_unicode_ci NOT NULL");
Database::exec("ALTER TABLE `##places` CHANGE p_dm_soundex p_dm_soundex LONGTEXT COLLATE utf8_unicode_ci NOT NULL");
Database::exec("ALTER TABLE `##sources` CHANGE s_gedcom s_gedcom LONGTEXT COLLATE utf8_unicode_ci NOT NULL");
// Use LONGBLOB instead of MEDIUMBLOB.
Database::exec("ALTER TABLE `##gedcom_chunk` CHANGE chunk_data chunk_data LONGBLOB NOT NULL");
Database::exec("ALTER TABLE `##session` CHANGE session_data session_data LONGBLOB NOT NULL");
}
示例9: upgrade
/**
* Upgrade to to the next version
*/
public function upgrade()
{
// IPv6 addresses can be up to 45 characters.
Database::exec("ALTER TABLE `##log` CHANGE ip_address ip_address VARCHAR(45) NOT NULL");
Database::exec("ALTER TABLE `##message` CHANGE ip_address ip_address VARCHAR(45) NOT NULL");
Database::exec("ALTER TABLE `##session` CHANGE ip_address ip_address VARCHAR(45) NOT NULL");
}
示例10: upgrade
/**
* Upgrade to to the next version
*/
public function upgrade()
{
// Delete old config settings
Database::exec("DELETE FROM `##gedcom_setting` WHERE setting_name IN('GEDCOM_DEFAULT_TAB', 'LINK_ICONS', 'ZOOM_BOXES')");
Database::exec("DELETE FROM `##user_setting` WHERE setting_name='default'");
// There is no way to add a RESN tag to NOTE objects
Database::exec("UPDATE `##gedcom_setting` SET setting_value='SOUR,RESN' WHERE setting_name='NOTE_FACTS_ADD' AND setting_value='SOUR'");
}
示例11: upgrade
/**
* Upgrade to to the next version
*/
public function upgrade()
{
// Add support for the persian/jalali calendar
try {
Database::exec("ALTER TABLE `##dates` CHANGE d_type d_type ENUM('@#DGREGORIAN@', '@#DJULIAN@', '@#DHEBREW@', '@#DFRENCH R@', '@#DHIJRI@', '@#DROMAN@', '@#DJALALI@')");
} catch (PDOException $ex) {
// Already been run?
}
}
示例12: upgrade
/**
* Upgrade to to the next version
*/
public function upgrade()
{
// Update some indexes, based on analysis of slow-query-logs
try {
Database::exec("ALTER TABLE `##places`" . " DROP KEY ix1," . " DROP KEY ix2," . " DROP KEY ix3," . " DROP KEY ix4," . " DROP p_level," . " ADD KEY ix1 (p_file, p_place)," . " ADD UNIQUE KEY ux1 (p_parent_id, p_file, p_place)");
} catch (PDOException $ex) {
// Already done?
}
}
示例13: upgrade
/**
* Upgrade to to the next version
*/
public function upgrade()
{
// Remove the i_isdead column
try {
Database::exec("ALTER TABLE `##individuals` DROP i_isdead");
} catch (PDOException $ex) {
// Already done this?
}
}
示例14: upgrade
/** {@inheritDoc} */
public function upgrade()
{
// Update the tables to support streetview
try {
Database::exec("ALTER TABLE `##placelocation` ADD (" . " pl_media VARCHAR(60) NULL," . " sv_long FLOAT NOT NULL DEFAULT 0," . " sv_lati FLOAT NOT NULL DEFAULT 0," . " sv_bearing FLOAT NOT NULL DEFAULT 0," . " sv_elevation FLOAT NOT NULL DEFAULT 0," . " sv_zoom FLOAT NOT NULL DEFAULT 1" . ")");
} catch (PDOException $ex) {
// Already done this?
}
}
示例15: upgrade
/** {@inheritDoc} */
public function upgrade()
{
// An earlier update mistakenly made the fv_note column too short.
// Add the new constraints
try {
Database::exec("ALTER TABLE `##favorite` CHANGE note note VARCHAR(1000) NULL");
} catch (PDOException $ex) {
// Already updated?
}
}