當前位置: 首頁>>代碼示例>>PHP>>正文


PHP MDB2_Schema::arrayMergeClobber方法代碼示例

本文整理匯總了PHP中MDB2_Schema::arrayMergeClobber方法的典型用法代碼示例。如果您正苦於以下問題:PHP MDB2_Schema::arrayMergeClobber方法的具體用法?PHP MDB2_Schema::arrayMergeClobber怎麽用?PHP MDB2_Schema::arrayMergeClobber使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在MDB2_Schema的用法示例。


在下文中一共展示了MDB2_Schema::arrayMergeClobber方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: compareTableDefinitions

 /**
  * Compare a previous definition with the currently parsed definition
  *
  * @param string $table_name          name of the table
  * @param array  $current_definition  multi dimensional array that contains the current definition
  * @param array  $previous_definition multi dimensional array that contains the previous definition
  * @param array  &$defined_tables     table names in the schema
  *
  * @return array|MDB2_Error array of changes on success, or a error object
  * @access public
  */
 function compareTableDefinitions($table_name, $current_definition, $previous_definition, &$defined_tables)
 {
     $changes = array();
     if (is_array($current_definition)) {
         $was_table_name = $table_name;
         if (!empty($current_definition['was'])) {
             $was_table_name = $current_definition['was'];
         }
         if (!empty($previous_definition[$was_table_name])) {
             $changes['change'][$was_table_name] = array();
             if ($was_table_name != $table_name) {
                 $changes['change'][$was_table_name] = array('name' => $table_name);
             }
             if (!empty($defined_tables[$was_table_name])) {
                 return $this->raiseError(MDB2_SCHEMA_ERROR_INVALID, null, null, 'the table "' . $was_table_name . '" was specified for more than one table of the database');
             }
             $defined_tables[$was_table_name] = true;
             if (!empty($current_definition['fields']) && is_array($current_definition['fields'])) {
                 $previous_fields = array();
                 if (isset($previous_definition[$was_table_name]['fields']) && is_array($previous_definition[$was_table_name]['fields'])) {
                     $previous_fields = $previous_definition[$was_table_name]['fields'];
                 }
                 $change = $this->compareTableFieldsDefinitions($table_name, $current_definition['fields'], $previous_fields);
                 if (PEAR::isError($change)) {
                     return $change;
                 }
                 if (!empty($change)) {
                     $changes['change'][$was_table_name] = MDB2_Schema::arrayMergeClobber($changes['change'][$was_table_name], $change);
                 }
             }
             if (!empty($current_definition['indexes']) && is_array($current_definition['indexes'])) {
                 $previous_indexes = array();
                 if (isset($previous_definition[$was_table_name]['indexes']) && is_array($previous_definition[$was_table_name]['indexes'])) {
                     $previous_indexes = $previous_definition[$was_table_name]['indexes'];
                 }
                 $change = $this->compareTableIndexesDefinitions($table_name, $current_definition['indexes'], $previous_indexes);
                 if (PEAR::isError($change)) {
                     return $change;
                 }
                 if (!empty($change)) {
                     $changes['change'][$was_table_name]['indexes'] = $change;
                 }
             }
             if (empty($changes['change'][$was_table_name])) {
                 unset($changes['change'][$was_table_name]);
             }
             if (empty($changes['change'])) {
                 unset($changes['change']);
             }
         } else {
             if ($table_name != $was_table_name) {
                 return $this->raiseError(MDB2_SCHEMA_ERROR_INVALID, null, null, 'it was specified a previous table name ("' . $was_table_name . '") for table "' . $table_name . '" that does not exist');
             }
             $changes['add'][$table_name] = true;
         }
     }
     return $changes;
 }
開發者ID:CDN-Sparks,項目名稱:owncloud,代碼行數:69,代碼來源:Schema.php


注:本文中的MDB2_Schema::arrayMergeClobber方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。