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


PHP Connection::getTablePrefix方法代碼示例

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


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

示例1: generateTableFromMetadata

 /**
  * Generate a table from metadata.
  *
  * @param table \Doctrine\DBAL\Schema\Schema
  * @param \ProAI\Datamapper\Metadata\Definitions\Table $tableMetadata
  * @return void
  */
 protected function generateTableFromMetadata($schema, TableDefinition $tableMetadata)
 {
     $primaryKeys = [];
     $uniqueIndexes = [];
     $indexes = [];
     $table = $schema->createTable($this->connection->getTablePrefix() . $tableMetadata['name']);
     foreach ($tableMetadata['columns'] as $columnMetadata) {
         $columnMetadata = $this->getDoctrineColumnAliases($columnMetadata);
         // add column
         $options = $this->getDoctrineColumnOptions($columnMetadata);
         $table->addColumn($columnMetadata['name'], $columnMetadata['type'], $options);
         // add primary keys, unique indexes and indexes
         if (!empty($columnMetadata['primary'])) {
             $primaryKeys[] = $columnMetadata['name'];
         }
         if (!empty($columnMetadata['unique'])) {
             $uniqueIndexes[] = $columnMetadata['name'];
         }
         if (!empty($columnMetadata['index'])) {
             $indexes[] = $columnMetadata['name'];
         }
     }
     // add primary keys, unique indexes and indexes
     if (!empty($primaryKeys)) {
         $table->setPrimaryKey($primaryKeys);
     }
     if (!empty($uniqueIndexes)) {
         $table->addUniqueIndex($uniqueIndexes);
     }
     if (!empty($indexes)) {
         $table->addIndex($indexes);
     }
 }
開發者ID:proai,項目名稱:laravel-datamapper,代碼行數:40,代碼來源:Builder.php

示例2: dropAutoIncrementObjects

 /**
  * drop sequence and triggers if exists, autoincrement objects
  *
  * @param  string $table
  * @return null
  */
 public function dropAutoIncrementObjects($table)
 {
     // drop sequence and trigger object
     $prefix = $this->connection->getTablePrefix();
     // get the actual primary column name from table
     $col = $this->getPrimaryKey($prefix . $table);
     // if primary key col is set, drop auto increment objects
     if (isset($col) and !empty($col)) {
         // drop sequence for auto increment
         $sequenceName = $this->createObjectName($prefix, $table, $col, 'seq');
         $this->sequence->drop($sequenceName);
         // drop trigger for auto increment work around
         $triggerName = $this->createObjectName($prefix, $table, $col, 'trg');
         $this->trigger->drop($triggerName);
     }
 }
開發者ID:djob,項目名稱:laravel-oci8,代碼行數:22,代碼來源:OracleAutoIncrementHelper.php

示例3: getColumnListing

 /**
  * Get the column listing for a given table.
  *
  * @param  string  $table
  * @return array
  */
 public function getColumnListing($table)
 {
     $table = $this->connection->getTablePrefix() . $table;
     $results = $this->connection->select($this->grammar->compileColumnExists($table));
     return $this->connection->getPostProcessor()->processColumnListing($results);
 }
開發者ID:davidhemphill,項目名稱:framework,代碼行數:12,代碼來源:Builder.php

示例4: hasTable

 /**
  * Determine if the given table exists.
  *
  * @param  string  $table
  * @return bool
  */
 public function hasTable($table)
 {
     $sql = $this->grammar->compileTableExists();
     $table = $this->connection->getTablePrefix() . $table;
     return count($this->connection->select($sql, array($table))) > 0;
 }
開發者ID:defra91,項目名稱:levecchiecredenze.it,代碼行數:12,代碼來源:Builder.php


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