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


PHP CRM_Logging_Schema::createTriggersFor方法代码示例

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


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

示例1: alterFieldSQL

 static function alterFieldSQL(&$params, $indexExist = false)
 {
     $sql = str_repeat(' ', 8);
     $sql .= "ALTER TABLE {$params['table_name']}";
     // lets suppress the required flag, since that can cause sql issue
     $params['required'] = false;
     switch ($params['operation']) {
         case 'add':
             $separator = "\n";
             $prefix = "ADD ";
             $sql .= self::buildFieldSQL($params, $separator, "ADD COLUMN ");
             $separator = ",\n";
             $sql .= self::buildPrimaryKeySQL($params, $separator, "ADD PRIMARY KEY ");
             $sql .= self::buildSearchIndexSQL($params, $separator, "ADD INDEX ");
             $sql .= self::buildForeignKeySQL($params, $separator, "ADD ", $params['table_name']);
             break;
         case 'modify':
             $separator = "\n";
             $prefix = "MODIFY ";
             $sql .= self::buildFieldSQL($params, $separator, $prefix);
             $separator = ",\n";
             $sql .= self::buildSearchIndexSQL($params, $separator, "ADD INDEX ", $indexExist);
             break;
         case 'delete':
             $sql .= " DROP COLUMN `{$params['name']}`";
             if (CRM_Utils_Array::value('primary', $params)) {
                 $sql .= ", DROP PRIMARY KEY";
             }
             if (CRM_Utils_Array::value('fk_table_name', $params)) {
                 $sql .= ", DROP FOREIGN KEY FK_{$params['fkName']}";
             }
             break;
     }
     // CRM-7007: do not i18n-rewrite this query
     $dao =& CRM_Core_DAO::executeQuery($sql, array(), true, null, false, false);
     $dao->free();
     // logging support: if we’re adding a column (but only then!) make sure the potential relevant log table gets a column as well
     if ($params['operation'] == 'add') {
         require_once 'CRM/Logging/Schema.php';
         $logging = new CRM_Logging_Schema();
         $logging->fixSchemaDifferencesFor($params['table_name'], array($params['name']));
         // CRM-7293: if we’re dropping a column – rebuild triggers
     } elseif ($params['operation'] == 'delete') {
         require_once 'CRM/Logging/Schema.php';
         $logging = new CRM_Logging_Schema();
         $logging->createTriggersFor($params['table_name']);
     }
     return true;
 }
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:49,代码来源:SchemaHandler.php


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