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


PHP ezcDbSchema::createNewTable方法代碼示例

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


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

示例1: processSchema

 /**
  * Loops over all the table names in the array and extracts schema
  * information.
  *
  * This method extracts information about a database's schema from the
  * database itself and returns this schema as an ezcDbSchema object.
  *
  * @param array(string) $tables
  * @return ezcDbSchema
  */
 protected function processSchema(array $tables)
 {
     $schemaDefinition = array();
     array_walk($tables, create_function('&$item,$key', '$item = $item[0];'));
     // strip out the prefix and only return tables with the prefix set.
     $prefix = ezcDbSchema::$options->tableNamePrefix;
     foreach ($tables as $tableName) {
         $tableNameWithoutPrefix = substr($tableName, strlen($prefix));
         // Process table if there was no prefix, or when a prefix was
         // found. In the latter case the prefix would be missing from
         // $tableNameWithoutPrefix due to the substr() above, and hence,
         // $tableName and $tableNameWithoutPrefix would be different.
         if ($prefix === '' || $tableName !== $tableNameWithoutPrefix) {
             $fields = $this->fetchTableFields($tableName);
             $indexes = $this->fetchTableIndexes($tableName);
             $schemaDefinition[$tableNameWithoutPrefix] = ezcDbSchema::createNewTable($fields, $indexes);
         }
     }
     return $schemaDefinition;
 }
開發者ID:Adeelgill,項目名稱:livehelperchat,代碼行數:30,代碼來源:common_sql_reader.php

示例2: parseTable

 /**
  * Extracts information about a table from the XML element $table
  * 
  * @param SimpleXMLElement $table
  *
  * @return ezcDbSchemaTable or an inherited class
  */
 private function parseTable(SimpleXMLElement $table)
 {
     $fields = array();
     $indexes = array();
     foreach ($table->declaration->field as $field) {
         $fieldName = (string) $field->name;
         $fields[$fieldName] = $this->parseField($field);
     }
     foreach ($table->declaration->index as $index) {
         $indexName = (string) $index->name;
         $indexes[$indexName] = $this->parseIndex($index);
     }
     return ezcDbSchema::createNewTable($fields, $indexes);
 }
開發者ID:Adeelgill,項目名稱:livehelperchat,代碼行數:21,代碼來源:reader.php


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