当前位置: 首页>>代码示例>>PHP>>正文


PHP oledrion_utils::fieldExists方法代码示例

本文整理汇总了PHP中oledrion_utils::fieldExists方法的典型用法代码示例。如果您正苦于以下问题:PHP oledrion_utils::fieldExists方法的具体用法?PHP oledrion_utils::fieldExists怎么用?PHP oledrion_utils::fieldExists使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在oledrion_utils的用法示例。


在下文中一共展示了oledrion_utils::fieldExists方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: xoops_module_update_oledrion

/**
 * oledrion
 *
 * @copyright   The XOOPS Project http://sourceforge.net/projects/xoops/
 * @license     http://www.fsf.org/copyleft/gpl.html GNU public license
 * @author      Hervé Thouzard (http://www.herve-thouzard.com/)
 * @author      Hossein Azizabadi (azizabadi@faragostaresh.com)
 * @version     $Id: functions_update.php 12290 2014-02-07 11:05:17Z beckmi $
 */
function xoops_module_update_oledrion($module, $version)
{
    global $xoopsDB;
    // Présence des nouvelles tables et nouvelles zones dans la base de données
    // Nouvelle table oledrion_gateways_options
    $tableName = $xoopsDB->prefix('oledrion_gateways_options');
    if (!oledrion_utils::tableExists($tableName)) {
        $sql = "CREATE TABLE " . $tableName . " (\n                `option_id` int(10) unsigned NOT NULL auto_increment,\n                `option_gateway` varchar(50) NOT NULL COMMENT 'nom de la passerelle de paiement',\n                `option_name` varchar(50) NOT NULL,\n                `option_value` text NOT NULL,\n                PRIMARY KEY  (`option_id`),\n                KEY `option_gateway` (`option_gateway`),\n                KEY `option_name` (`option_name`),\n                KEY `option_gateway_name` (`option_gateway`,`option_name`)\n                ) ENGINE=InnoDB";
        $xoopsDB->queryF($sql);
    }
    // Nouveau champ cmd_comment dans oledrion_commands
    $tableName = $xoopsDB->prefix('oledrion_commands');
    if (!oledrion_utils::fieldExists('cmd_comment', $tableName)) {
        oledrion_utils::addField('`cmd_comment` TEXT NOT NULL', $tableName);
    }
    if (!oledrion_utils::fieldExists('cmd_vat_number', $tableName)) {
        oledrion_utils::addField('`cmd_vat_number` VARCHAR( 255 ) NOT NULL', $tableName);
    }
    /**
     * Nouvelle table oledrion_lists
     * @since 2.2.2009.01.29
     */
    $tableName = $xoopsDB->prefix('oledrion_lists');
    if (!oledrion_utils::tableExists($tableName)) {
        $sql = "CREATE TABLE " . $tableName . " (\n                `list_id` int(10) unsigned NOT NULL auto_increment,\n                `list_uid` mediumint(8) unsigned NOT NULL,\n                `list_title` varchar(255) NOT NULL,\n                `list_date` int(10) unsigned NOT NULL,\n                `list_productscount` mediumint(8) unsigned NOT NULL,\n                `list_views` mediumint(8) unsigned NOT NULL,\n                `list_password` varchar(50) NOT NULL,\n                `list_type` tinyint(3) unsigned NOT NULL,\n                `list_description` text NOT NULL,\n                PRIMARY KEY  (`list_id`),\n                KEY `list_uid` (`list_uid`)\n                ) ENGINE=InnoDB";
        $xoopsDB->queryF($sql);
    }
    /**
     * Nouvelle table oledrion_lists
     * @since 2.2.2009.01.29
     */
    $tableName = $xoopsDB->prefix('oledrion_products_list');
    if (!oledrion_utils::tableExists($tableName)) {
        $sql = "CREATE TABLE " . $tableName . " (\n                `productlist_id` int(10) unsigned NOT NULL auto_increment,\n                `productlist_list_id` int(10) unsigned NOT NULL,\n                `productlist_product_id` int(10) unsigned NOT NULL,\n                PRIMARY KEY  (`productlist_id`),\n                KEY `productlist_list_id` (`productlist_list_id`),\n                KEY `productlist_product_id` (`productlist_product_id`)\n                ) ENGINE=InnoDB";
        $xoopsDB->queryF($sql);
    }
    if (!oledrion_utils::fieldExists('productlist_date', $tableName)) {
        oledrion_utils::addField('productlist_date DATE NOT NULL', $tableName);
    }
    /**
     * Nouvelle table oledrion_attributes
     * @since 2.3.2009.03.09
     */
    $tableName = $xoopsDB->prefix('oledrion_attributes');
    if (!oledrion_utils::tableExists($tableName)) {
        $sql = "CREATE TABLE `{$tableName}` (\n              `attribute_id` int(10) unsigned NOT NULL auto_increment,\n              `attribute_weight` mediumint(7) unsigned default NULL,\n              `attribute_title` varchar(255) default NULL,\n              `attribute_name` varchar(255) NOT NULL,\n              `attribute_type` tinyint(3) unsigned default NULL,\n              `attribute_mandatory` tinyint(1) unsigned default NULL,\n              `attribute_values` text,\n              `attribute_names` text,\n              `attribute_prices` text,\n              `attribute_stocks` text,\n              `attribute_product_id` int(11) unsigned default NULL,\n              `attribute_default_value` varchar(255) default NULL,\n              `attribute_option1` mediumint(7) unsigned default NULL,\n              `attribute_option2` mediumint(7) unsigned default NULL,\n              PRIMARY KEY  (`attribute_id`),\n              KEY `attribute_product_id` (`attribute_product_id`),\n              KEY `attribute_weight` (`attribute_weight`)\n            ) ENGINE=InnoDB;";
        $xoopsDB->queryF($sql);
    }
    /**
     * Nouvelle table oledrion_caddy_attributes
     * @since 2.3.2009.03.10
     */
    $tableName = $xoopsDB->prefix('oledrion_caddy_attributes');
    if (!oledrion_utils::tableExists($tableName)) {
        $sql = "CREATE TABLE `{$tableName}` (\n              `ca_id` int(10) unsigned NOT NULL auto_increment,\n              `ca_cmd_id` int(10) unsigned NOT NULL,\n              `ca_caddy_id` int(10) unsigned NOT NULL,\n              `ca_attribute_id` int(10) unsigned NOT NULL,\n              `ca_attribute_values` text NOT NULL,\n              `ca_attribute_names` text NOT NULL,\n              `ca_attribute_prices` text NOT NULL,\n              PRIMARY KEY  (`ca_id`),\n              KEY `ca_cmd_id` (`ca_cmd_id`),\n              KEY `ca_caddy_id` (`ca_caddy_id`),\n              KEY `ca_attribute_id` (`ca_attribute_id`)\n        ) ENGINE=InnoDB;";
        $xoopsDB->queryF($sql);
    }
    /**
     * Augmentation des types numéraires pour accepter le million
     * @since 2.3.2009.04.20
     */
    $definition = oledrion_utils::getFieldDefinition('product_price', $xoopsDB->prefix('oledrion_products'));
    if ($definition != '') {
        if (xoops_trim($definition['Type']) == 'decimal(7,2)') {
            $tablesToUpdates = array('oledrion_products' => array('product_price', 'product_shipping_price', 'product_discount_price', 'product_ecotaxe'), 'oledrion_caddy' => array('caddy_price'), 'oledrion_commands' => array('cmd_shipping'), 'oledrion_discounts' => array('disc_price_degress_l1total', 'disc_price_degress_l2total', 'disc_price_degress_l3total', 'disc_price_degress_l4total', 'disc_price_degress_l5total'));
            foreach ($tablesToUpdates as $tableName => $fields) {
                foreach ($fields as $field) {
                    $sql = 'ALTER TABLE ' . $xoopsDB->prefix($tableName) . ' CHANGE `' . $field . '` `' . $field . '` DECIMAL( 16, 2 ) NOT NULL';
                    $xoopsDB->queryF($sql);
                }
            }
        }
    }
    /**
     * Add product_property
     * @since 2.3.2012.08.03
     */
    $tableName = $xoopsDB->prefix('oledrion_products');
    if (!oledrion_utils::fieldExists('product_property1', $tableName)) {
        oledrion_utils::addField('`product_property1` varchar(255) NOT NULL', $tableName);
    }
    if (!oledrion_utils::fieldExists('product_property2', $tableName)) {
        oledrion_utils::addField('`product_property2` varchar(255) NOT NULL', $tableName);
    }
    if (!oledrion_utils::fieldExists('product_property3', $tableName)) {
        oledrion_utils::addField('`product_property3` varchar(255) NOT NULL', $tableName);
    }
    if (!oledrion_utils::fieldExists('product_property4', $tableName)) {
        oledrion_utils::addField('`product_property4` varchar(255) NOT NULL', $tableName);
    }
    if (!oledrion_utils::fieldExists('product_property5', $tableName)) {
//.........这里部分代码省略.........
开发者ID:osw17,项目名称:oledrion,代码行数:101,代码来源:functions_update.php


注:本文中的oledrion_utils::fieldExists方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。