当前位置: 首页>>代码示例>>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;未经允许,请勿转载。