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


PHP Table::name方法代码示例

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


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

示例1: truncateTableSql

 public function truncateTableSql(Table $table)
 {
     $tableName = $table->name();
     if ($this->_driver->autoQuoting()) {
         $tableName = $this->_driver->quoteIdentifier($tableName);
     }
     return [sprintf("TRUNCATE TABLE %s", $tableName)];
 }
开发者ID:hevertonfreitas,项目名称:cakephp-3-oracle,代码行数:8,代码来源:OracleSchema.php

示例2: dropTableSql

 /**
  * Generate the SQL to drop a table.
  *
  * @param \Cake\Database\Schema\Table $table Table instance
  * @return array SQL statements to drop a table.
  */
 public function dropTableSql(Table $table)
 {
     $sql = sprintf('DROP TABLE %s CASCADE', $this->_driver->quoteIdentifier($table->name()));
     return [$sql];
 }
开发者ID:juanshot,项目名称:cakephp,代码行数:11,代码来源:PostgresSchema.php

示例3: truncateTableSql

 /**
  * {@inheritDoc}
  */
 public function truncateTableSql(Table $table)
 {
     $name = $table->name();
     $sql = [];
     if ($this->hasSequences()) {
         $sql[] = sprintf('DELETE FROM sqlite_sequence WHERE name="%s"', $name);
     }
     $sql[] = sprintf('DELETE FROM "%s"', $name);
     return $sql;
 }
开发者ID:maitrepylos,项目名称:nazeweb,代码行数:13,代码来源:SqliteSchema.php

示例4: column

 /**
  * Returns an array of column data for a single column
  *
  * @param \Cake\Database\Schema\Table $tableSchema Name of the table to retrieve columns for
  * @param string $column A column to retrieve data for
  * @return array
  */
 public function column($tableSchema, $column)
 {
     return ['columnType' => $tableSchema->columnType($column), 'options' => $this->attributes($tableSchema->name(), $column)];
 }
开发者ID:josegonzalez,项目名称:migrations,代码行数:11,代码来源:MigrationHelper.php

示例5: createTableSql

 /**
  * {@inheritDoc}
  */
 public function createTableSql(Table $table, $columns, $constraints, $indexes)
 {
     $content = implode(",\n", array_merge($columns, $constraints, $indexes));
     $temporary = $table->temporary() ? ' TEMPORARY ' : ' ';
     $content = sprintf("CREATE%sTABLE `%s` (\n%s\n)", $temporary, $table->name(), $content);
     $options = $table->options();
     if (isset($options['engine'])) {
         $content .= sprintf(' ENGINE=%s', $options['engine']);
     }
     if (isset($options['charset'])) {
         $content .= sprintf(' DEFAULT CHARSET=%s', $options['charset']);
     }
     if (isset($options['collate'])) {
         $content .= sprintf(' COLLATE=%s', $options['collate']);
     }
     return [$content];
 }
开发者ID:ansidev,项目名称:cakephp_blog,代码行数:20,代码来源:MysqlSchema.php

示例6: dropConstraintSql

 /**
  * {@inheritDoc}
  */
 public function dropConstraintSql(Table $table)
 {
     $sqlPattern = 'ALTER TABLE %s DROP FOREIGN KEY %s;';
     $sql = [];
     foreach ($table->constraints() as $name) {
         $constraint = $table->constraint($name);
         if ($constraint['type'] === Table::CONSTRAINT_FOREIGN) {
             $tableName = $this->_driver->quoteIdentifier($table->name());
             $constraintName = $this->_driver->quoteIdentifier($name);
             $sql[] = sprintf($sqlPattern, $tableName, $constraintName);
         }
     }
     return $sql;
 }
开发者ID:tgr0ss,项目名称:cakephp,代码行数:17,代码来源:MysqlSchema.php

示例7: truncateTableSql

 /**
  * {@inheritDoc}
  */
 public function truncateTableSql(Table $table)
 {
     $name = $this->_driver->quoteIdentifier($table->name());
     return [sprintf('TRUNCATE TABLE %s', $name)];
 }
开发者ID:ripzappa0924,项目名称:carte0.0.1,代码行数:8,代码来源:SqlserverSchema.php

示例8: truncateTableSql

 /**
  * {@inheritDoc}
  */
 public function truncateTableSql(Table $table)
 {
     $name = $this->_driver->quoteIdentifier($table->name());
     $queries = [sprintf('DELETE FROM %s', $name)];
     // Restart identity sequences
     $pk = $table->primaryKey();
     if (count($pk) === 1) {
         $column = $table->column($pk[0]);
         if (in_array($column['type'], ['integer', 'biginteger'])) {
             $queries[] = sprintf('DBCC CHECKIDENT(%s, RESEED, 0)', $name);
         }
     }
     return $queries;
 }
开发者ID:ansidev,项目名称:cakephp_blog,代码行数:17,代码来源:SqlserverSchema.php

示例9: dropTableSql

 /**
  * Generate the SQL to drop a table.
  *
  * @param \Cake\Database\Schema\Table $table Table instance
  * @return array SQL statements to drop a table.
  */
 public function dropTableSql(Table $table)
 {
     $sql = sprintf('DROP TABLE %s CASCADE CONSTRAINTS', $this->_driver->quoteIfAutoQuote($table->name()));
     return [$sql];
 }
开发者ID:cakedc,项目名称:cakephp-oracle-driver,代码行数:11,代码来源:OracleSchema.php

示例10: _generateDropForeignKeys

 /**
  * Generates SQL statements dropping foreign keys for the table.
  *
  * @param \Cake\Database\Connection $db Connection to run the SQL queries on.
  * @param  \Cake\Database\Schema\Table $table Drop foreign keys for this table.
  * @return array List of SQL statements dropping foreign keys.
  */
 protected function _generateDropForeignKeys($db, Schema $table)
 {
     $type = 'other';
     if ($db->driver() instanceof Mysql) {
         $type = 'mysql';
     }
     $queries = [];
     foreach ($table->constraints() as $constraintName) {
         $constraint = $table->constraint($constraintName);
         if ($constraint['type'] === Schema::CONSTRAINT_FOREIGN) {
             // TODO: Move this into the driver
             if ($type === 'mysql') {
                 $template = 'ALTER TABLE %s DROP FOREIGN KEY %s';
             } else {
                 $template = 'ALTER TABLE %s DROP CONSTRAINT %s';
             }
             $queries[] = sprintf($template, $table->name(), $constraintName);
         }
     }
     return $queries;
 }
开发者ID:scherersoftware,项目名称:cakephp-schema,代码行数:28,代码来源:SchemaLoadTask.php


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