• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP getValidDBName函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中getValidDBName函数的典型用法代码示例。如果您正苦于以下问题:PHP getValidDBName函数的具体用法?PHP getValidDBName怎么用?PHP getValidDBName使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: testgetValidDBName

 public function testgetValidDBName()
 {
     $expected = '';
     $actual = getValidDBName('');
     $this->assertSame($expected, $actual);
     $expected = 'col';
     $actual = getValidDBName('Col');
     $this->assertSame($expected, $actual);
 }
开发者ID:sacredwebsite,项目名称:SuiteCRM,代码行数:9,代码来源:dbUtilsTest.php


示例2: upgradeTeamColumn

/**
 * upgradeTeamColumn
 * Helper function to create a team_set_id column and also set team_set_id column
 * to have the value of the $column_name parameter
 *
 * @param $bean SugarBean which we are adding team_set_id column to
 * @param $column_name The name of the column containing the default team_set_id value
 */
function upgradeTeamColumn($bean, $column_name)
{
    //first let's check to ensure that the team_set_id field is defined, if not it could be the case that this is an older
    //module that does not use the SugarObjects
    if (empty($bean->field_defs['team_set_id']) && $bean->module_dir != 'Trackers') {
        //at this point we could assume that since we have a team_id defined and not a team_set_id that we need to
        //add that field and the corresponding relationships
        $object = $bean->object_name;
        $module = $bean->module_dir;
        $object_name = $object;
        $_object_name = strtolower($object_name);
        if (!empty($GLOBALS['dictionary'][$object]['table'])) {
            $table_name = $GLOBALS['dictionary'][$object]['table'];
        } else {
            $table_name = strtolower($module);
        }
        $path = 'include/SugarObjects/implements/team_security/vardefs.php';
        require $path;
        //go through each entry in the vardefs from team_security and unset anything that is already set in the core module
        //this will ensure we have the proper ordering.
        $fieldDiff = array_diff_assoc($vardefs['fields'], $GLOBALS['dictionary'][$bean->object_name]['fields']);
        $file = 'custom/Extension/modules/' . $bean->module_dir . '/Ext/Vardefs/teams.php';
        $contents = "<?php\n";
        if (!empty($fieldDiff)) {
            foreach ($fieldDiff as $key => $val) {
                $contents .= "\n\$GLOBALS['dictionary']['" . $object . "']['fields']['" . $key . "']=" . var_export_helper($val) . ";";
            }
        }
        $relationshipDiff = array_diff_assoc($vardefs['relationships'], $GLOBALS['dictionary'][$bean->object_name]['relationships']);
        if (!empty($relationshipDiff)) {
            foreach ($relationshipDiff as $key => $val) {
                $contents .= "\n\$GLOBALS['dictionary']['" . $object . "']['relationships']['" . $key . "']=" . var_export_helper($val) . ";";
            }
        }
        $indexDiff = array_diff_assoc($vardefs['indices'], $GLOBALS['dictionary'][$bean->object_name]['indices']);
        if (!empty($indexDiff)) {
            foreach ($indexDiff as $key => $val) {
                $contents .= "\n\$GLOBALS['dictionary']['" . $object . "']['indices']['" . $key . "']=" . var_export_helper($val) . ";";
            }
        }
        if ($fh = @sugar_fopen($file, 'wt')) {
            fputs($fh, $contents);
            fclose($fh);
        }
        //we have written out the teams.php into custom/Extension/modules/{$module_dir}/Ext/Vardefs/teams.php'
        //now let's merge back into vardefs.ext.php
        require_once 'ModuleInstall/ModuleInstaller.php';
        $mi = new ModuleInstaller();
        $mi->merge_files('Ext/Vardefs/', 'vardefs.ext.php');
        VardefManager::loadVardef($bean->module_dir, $bean->object_name, true);
        $bean->field_defs = $GLOBALS['dictionary'][$bean->object_name]['fields'];
    }
    if (isset($bean->field_defs['team_set_id'])) {
        //Create the team_set_id column
        $FieldArray = $GLOBALS['db']->helper->get_columns($bean->table_name);
        if (!isset($FieldArray['team_set_id'])) {
            $GLOBALS['db']->addColumn($bean->table_name, $bean->field_defs['team_set_id']);
        }
        $indexArray = $GLOBALS['db']->helper->get_indices($bean->table_name);
        $indexName = getValidDBName('idx_' . strtolower($bean->table_name) . '_tmst_id', true, 34);
        $indexDef = array(array('name' => $indexName, 'type' => 'index', 'fields' => array('team_set_id')));
        if (!isset($indexArray[$indexName])) {
            $GLOBALS['db']->addIndexes($bean->table_name, $indexDef);
        }
        //Update the table's team_set_id column to have the same values as team_id
        $GLOBALS['db']->query("UPDATE {$bean->table_name} SET team_set_id = {$column_name}");
    }
}
开发者ID:omusico,项目名称:sugar_work,代码行数:76,代码来源:uw_utils.php


示例3: filter_fields

function filter_fields($value, $fields)
{
    global $invalid_contact_fields;
    $filterFields = array();
    foreach ($fields as $field) {
        if (is_array($invalid_contact_fields)) {
            if (in_array($field, $invalid_contact_fields)) {
                continue;
            }
            // if
        }
        // if
        if (isset($value->field_defs[$field])) {
            $var = $value->field_defs[$field];
            if (isset($var['source']) && ($var['source'] != 'db' && $var['source'] != 'custom_fields') && $var['name'] != 'email1' && $var['name'] != 'email2' && (!isset($var['type']) || $var['type'] != 'relate')) {
                continue;
            }
        }
        // if
        // No valid field should be caught by this quoting.
        $filterFields[] = getValidDBName($field);
    }
    // foreach
    return $filterFields;
}
开发者ID:butschster,项目名称:sugarcrm_dev,代码行数:25,代码来源:SoapHelperFunctions.php


示例4: testEnsureUnique

 public function testEnsureUnique()
 {
     $this->assertEquals(getValidDBName('idx_test_123_456_789_foo_bar_id', true), getValidDBName('idx_test_123_456_789_foo_bar_id', true));
     $this->assertNotEquals(getValidDBName('idx_test_123_456_789_foo_bar_id', true), getValidDBName('idx_test_123_446_789_foo_bar_id', true));
 }
开发者ID:rgauss,项目名称:sugarcrm_dev,代码行数:5,代码来源:ValidDBNameTest.php


示例5: testLongNameAffected

 /**
  * @dataProvider longNameProvider
  */
 public function testLongNameAffected($name_1, $name_2)
 {
     $this->assertNotEquals(getValidDBName($name_1), getValidDBName($name_2));
 }
开发者ID:thsonvt,项目名称:sugarcrm_dev,代码行数:7,代码来源:ValidDBNameTest.php


示例6: getValidDBName

 static function getValidDBName($name, $ensureUnique = true)
 {
     require_once 'modules/ModuleBuilder/parsers/constants.php';
     return getValidDBName($name, $ensureUnique, MB_MAXDBIDENTIFIERLENGTH);
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:5,代码来源:AbstractRelationship.php


示例7: testLongNameAffected

 public function testLongNameAffected()
 {
     $this->assertNotEquals(getValidDBName('eeeee_eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee_opportunities', true), getValidDBName('eeeee_eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1_opportunities', true));
 }
开发者ID:netconstructor,项目名称:sugarcrm_dev,代码行数:4,代码来源:ValidDBNameTest.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP getValue函数代码示例发布时间:2022-05-15
下一篇:
PHP getValidDBInsertDateValue函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap