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


PHP CI_DB_forge類代碼示例

本文整理匯總了PHP中CI_DB_forge的典型用法代碼示例。如果您正苦於以下問題:PHP CI_DB_forge類的具體用法?PHP CI_DB_forge怎麽用?PHP CI_DB_forge使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: create_database

 /**
  * Create database
  *
  * @param	string	the database name
  * @return	string
  */
 public function create_database($db_name)
 {
     // Firebird databases are flat files, so a path is required
     // Hostname is needed for remote access
     empty($this->db->hostname) or $db_name = $this->hostname . ':' . $db_name;
     return parent::create_database('"' . $db_name . '"');
 }
開發者ID:colonia,項目名稱:tomatocart-v2,代碼行數:13,代碼來源:interbase_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 ($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 ($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:at15,項目名稱:codeignitordb,代碼行數:33,代碼來源:oci8_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 (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:at15,項目名稱:codeignitordb,代碼行數:34,代碼來源:postgre_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,項目名稱:codeigniter-database-standalone,代碼行數:20,代碼來源:mssql_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:marketcoinfork,項目名稱:BitWasp-Fork,代碼行數:25,代碼來源: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('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), $sql .= $alter_type . ' '; $i < $c; $i++) {
         if ($field[$i]['_literal'] !== FALSE) {
             return FALSE;
         }
         if (isset($field[$i]['type'])) {
             $sqls[] = $sql . ' TYPE ' . $field[$i]['type'] . $field[$i]['length'];
         }
         if (!empty($field[$i]['default'])) {
             $sqls[] = $sql . ' ALTER ' . $this->db->escape_identifiers($field[$i]['name']) . ' SET ' . $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 ' . $this->db->escape_identifiers($field[$i]['name']) . ' TO ' . $this->db->escape_identifiers($field[$i]['new_name']);
         }
     }
     return $sqls;
 }
開發者ID:rud0lph,項目名稱:ci-guestbook,代碼行數:34,代碼來源:ibase_forge.php

示例7: _alter_table

 /**
  * ALTER TABLE
  *
  * @todo	implement drop_column(), modify_column()
  * @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:alyayazilim,項目名稱:E-Ticaret-2015,代碼行數:25,代碼來源:sqlite3_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 ($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:SaiAshirwadInformatia,項目名稱:TaskTracker,代碼行數:28,代碼來源:mysql_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 (in_array($alter_type, ['DROP', 'ADD'], true)) {
         return parent::_alter_table($alter_type, $table, $field);
     }
     $sql = 'ALTER TABLE ' . $this->db->escape_identifiers($table);
     $sqls = [];
     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_identififers($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:recca0120,項目名稱:laraigniter,代碼行數:35,代碼來源:ibase_forge.php


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