本文整理汇总了PHP中CI_DB_pdo_forge类的典型用法代码示例。如果您正苦于以下问题:PHP CI_DB_pdo_forge类的具体用法?PHP CI_DB_pdo_forge怎么用?PHP CI_DB_pdo_forge使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CI_DB_pdo_forge类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: _alter_table
/**
* ALTER TABLE.
*
* @param string $alter_type ALTER type
* @param string $table Table name
* @param mixed $field Column definition
*
* @return string|string[]
*/
protected function _alter_table($alter_type, $table, $field)
{
if ($alter_type === 'CHANGE') {
$alter_type = 'MODIFY';
}
return parent::_alter_table($alter_type, $table, $field);
}
开发者ID:recca0120,项目名称:laraigniter,代码行数:16,代码来源:pdo_informix_forge.php
示例2: _alter_table
/**
* ALTER TABLE
*
* @param string $alter_type ALTER type
* @param string $table Table name
* @param mixed $field Column definition
* @return string|string[]
*/
protected function _alter_table($alter_type, $table, $field)
{
if (in_array($alter_type, array('DROP', 'ADD'), TRUE)) {
return parent::_alter_table($alter_type, $table, $field);
}
$sql = 'ALTER TABLE ' . $this->db->escape_identifiers($table);
$sqls = array();
for ($i = 0, $c = count($field); $i < $c; $i++) {
if ($field[$i]['_literal'] !== FALSE) {
return FALSE;
}
if (version_compare($this->db->version(), '8', '>=') && isset($field[$i]['type'])) {
$sqls[] = $sql . ' ALTER COLUMN ' . $this->db->escape_identifiers($field[$i]['name']) . ' TYPE ' . $field[$i]['type'] . $field[$i]['length'];
}
if (!empty($field[$i]['default'])) {
$sqls[] = $sql . ' ALTER COLUMN ' . $this->db->escape_identifiers($field[$i]['name']) . ' SET DEFAULT ' . $field[$i]['default'];
}
if (isset($field[$i]['null'])) {
$sqls[] = $sql . ' ALTER COLUMN ' . $this->db->escape_identifiers($field[$i]['name']) . ($field[$i]['null'] === TRUE ? ' DROP NOT NULL' : ' SET NOT NULL');
}
if (!empty($field[$i]['new_name'])) {
$sqls[] = $sql . ' RENAME COLUMN ' . $this->db->escape_identifiers($field[$i]['name']) . ' TO ' . $this->db->escape_identifiers($field[$i]['new_name']);
}
}
return $sqls;
}
开发者ID:zky001,项目名称:phpHiveAdmin,代码行数:34,代码来源:pdo_pgsql_forge.php
示例3: _alter_table
/**
* ALTER TABLE
*
* @param string $alter_type ALTER type
* @param string $table Table name
* @param mixed $field Column definition
* @return string|string[]
*/
protected function _alter_table($alter_type, $table, $field)
{
if ($alter_type === 'DROP') {
return parent::_alter_table($alter_type, $table, $field);
} elseif ($alter_type === 'CHANGE') {
$alter_type = 'MODIFY';
}
$sql = 'ALTER TABLE ' . $this->db->escape_identifiers($table);
$sqls = array();
for ($i = 0, $c = count($field); $i < $c; $i++) {
if ($field[$i]['_literal'] !== FALSE) {
$field[$i] = "\n\t" . $field[$i]['_literal'];
} else {
$field[$i]['_literal'] = "\n\t" . $this->_process_column($field[$i]);
if (!empty($field[$i]['comment'])) {
$sqls[] = 'COMMENT ON COLUMN ' . $this->db->escape_identifiers($table) . '.' . $this->db->escape_identifiers($field[$i]['name']) . ' IS ' . $field[$i]['comment'];
}
if ($alter_type === 'MODIFY' && !empty($field[$i]['new_name'])) {
$sqls[] = $sql . ' RENAME COLUMN ' . $this->db->escape_identifiers($field[$i]['name']) . ' ' . $this->db->escape_identifiers($field[$i]['new_name']);
}
}
}
$sql .= ' ' . $alter_type . ' ';
$sql .= count($field) === 1 ? $field[0] : '(' . implode(',', $field) . ')';
// RENAME COLUMN must be executed after MODIFY
array_unshift($sqls, $sql);
return $sql;
}
开发者ID:akaiz,项目名称:swapeazyfinal,代码行数:36,代码来源:pdo_oci_forge.php
示例4: _alter_table
/**
* ALTER TABLE
*
* @param string $alter_type ALTER type
* @param string $table Table name
* @param mixed $field Column definition
* @return string|string[]
*/
protected function _alter_table($alter_type, $table, $field)
{
if (in_array($alter_type, array('ADD', 'DROP'), TRUE)) {
return parent::_alter_table($alter_type, $table, $field);
}
$sql = 'ALTER TABLE ' . $this->db->escape_identifiers($table) . ' ALTER COLUMN ';
$sqls = array();
for ($i = 0, $c = count($field); $i < $c; $i++) {
$sqls[] = $sql . $this->_process_column($field[$i]);
}
return $sqls;
}
开发者ID:NaszvadiG,项目名称:boilerplate,代码行数:20,代码来源:pdo_sqlsrv_forge.php
示例5: _alter_table
/**
* ALTER TABLE
*
* @param string $alter_type ALTER type
* @param string $table Table name
* @param mixed $field Column definition
* @return string|string[]
*/
protected function _alter_table($alter_type, $table, $field)
{
if (in_array($alter_type, array('DROP', 'ADD'), TRUE)) {
return parent::_alter_table($alter_type, $table, $field);
}
$sql = 'ALTER TABLE ' . $this->db->escape_identifiers($table);
$sqls = array();
for ($i = 0, $c = count($field); $i < $c; $i++) {
if ($field[$i]['_literal'] !== FALSE) {
$sqls[] = $sql . ' CHANGE ' . $field[$i]['_literal'];
} else {
$alter_type = empty($field[$i]['new_name']) ? ' MODIFY ' : ' CHANGE ';
$sqls[] = $sql . $alter_type . $this->_process_column($field[$i]);
}
}
return $sqls;
}
开发者ID:BryceHappy,项目名称:Oauth2-SocialAuth-for-CodeIgniter,代码行数:25,代码来源:pdo_cubrid_forge.php
示例6: _alter_table
/**
* ALTER TABLE
*
* @param string $alter_type ALTER type
* @param string $table Table name
* @param mixed $field Column definition
* @return string|string[]
*/
protected function _alter_table($alter_type, $table, $field)
{
if (in_array($alter_type, array('ADD', 'DROP'), TRUE)) {
return parent::_alter_table($alter_type, $table, $field);
}
// No method of modifying columns is supported
return FALSE;
}
开发者ID:hagar72,项目名称:topics,代码行数:16,代码来源:pdo_4d_forge.php
示例7: _alter_table
/**
* ALTER TABLE
*
* @param string $alter_type ALTER type
* @param string $table Table name
* @param mixed $field Column definition
* @return string|string[]
*/
protected function _alter_table($alter_type, $table, $field)
{
if ($alter_type === 'DROP' or $alter_type === 'CHANGE') {
// drop_column():
// BEGIN TRANSACTION;
// CREATE TEMPORARY TABLE t1_backup(a,b);
// INSERT INTO t1_backup SELECT a,b FROM t1;
// DROP TABLE t1;
// CREATE TABLE t1(a,b);
// INSERT INTO t1 SELECT a,b FROM t1_backup;
// DROP TABLE t1_backup;
// COMMIT;
return FALSE;
}
return parent::_alter_table($alter_type, $table, $field);
}
开发者ID:marketcoinfork,项目名称:BitWasp-Fork,代码行数:24,代码来源:pdo_sqlite_forge.php
示例8: _alter_table
/**
* ALTER TABLE
*
* @param string $alter_type ALTER type
* @param string $table Table name
* @param mixed $field Column definition
* @return string|string[]
*/
protected function _alter_table($alter_type, $table, $field)
{
if (in_array($alter_type, array('DROP', 'ADD'), TRUE)) {
return parent::_alter_table($alter_type, $table, $field);
}
$sql = 'ALTER TABLE ' . $this->db->escape_identifiers($table);
$sqls = array();
for ($i = 0, $c = count($field); $i < $c; $i++) {
if ($field[$i]['_literal'] !== FALSE) {
return FALSE;
}
if (isset($field[$i]['type'])) {
$sqls[] = $sql . ' ALTER COLUMN ' . $this->db->escape_identifiers($field[$i]['name']) . ' TYPE ' . $field[$i]['type'] . $field[$i]['length'];
}
if (!empty($field[$i]['default'])) {
$sqls[] = $sql . ' ALTER COLUMN ' . $this->db->escape_identifiers($field[$i]['name']) . ' SET DEFAULT ' . $field[$i]['default'];
}
if (isset($field[$i]['null'])) {
$sqls[] = 'UPDATE "RDB$RELATION_FIELDS" SET "RDB$NULL_FLAG" = ' . ($field[$i]['null'] === TRUE ? 'NULL' : '1') . ' WHERE "RDB$FIELD_NAME" = ' . $this->db->escape($field[$i]['name']) . ' AND "RDB$RELATION_NAME" = ' . $this->db->escape($table);
}
if (!empty($field[$i]['new_name'])) {
$sqls[] = $sql . ' ALTER COLUMN ' . $this->db->escape_identifiers($field[$i]['name']) . ' TO ' . $this->db->escape_identifiers($field[$i]['new_name']);
}
}
return $sqls;
}
开发者ID:segaz2002,项目名称:Codeigniter,代码行数:34,代码来源:pdo_firebird_forge.php
示例9: _alter_table
/**
* ALTER TABLE
*
* @param string $alter_type ALTER type
* @param string $table Table name
* @param mixed $field Column definition
* @return string|string[]
*/
protected function _alter_table($alter_type, $table, $field)
{
if ($alter_type === 'DROP') {
return parent::_alter_table($alter_type, $table, $field);
}
$sql = 'ALTER TABLE ' . $this->db->escape_identifiers($table);
for ($i = 0, $c = count($field); $i < $c; $i++) {
if ($field[$i]['_literal'] !== FALSE) {
$field[$i] = $alter_type === 'ADD' ? "\n\tADD " . $field[$i]['_literal'] : "\n\tMODIFY " . $field[$i]['_literal'];
} else {
if ($alter_type === 'ADD') {
$field[$i]['_literal'] = "\n\tADD ";
} else {
$field[$i]['_literal'] = empty($field[$i]['new_name']) ? "\n\tMODIFY " : "\n\tCHANGE ";
}
$field[$i] = $field[$i]['_literal'] . $this->_process_column($field[$i]);
}
}
return array($sql . implode(',', $field));
}
开发者ID:hagar72,项目名称:topics,代码行数:28,代码来源:pdo_mysql_forge.php
示例10: _alter_table
/**
* ALTER TABLE.
*
* @param string $alter_type ALTER type
* @param string $table Table name
* @param mixed $field Column definition
*
* @return string|string[]
*/
protected function _alter_table($alter_type, $table, $field)
{
if (in_array($alter_type, ['ADD', 'DROP'], true)) {
return parent::_alter_table($alter_type, $table, $field);
}
// No method of modifying columns is supported
return false;
}
开发者ID:recca0120,项目名称:laraigniter,代码行数:17,代码来源:pdo_4d_forge.php
注:本文中的CI_DB_pdo_forge类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论