ADOdb

Database Abstraction Layer for PHP

User Tools

Site Tools


v5:dictionary:renametablesql

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
dictionary:renametablesql [2015/08/27 02:48] mnewnhamv5:dictionary:renametablesql [2016/01/13 02:06] (current) – ↷ Links adapted because of a move operation mnewnham
Line 1: Line 1:
-====== dropTableSql ======+====== renameTableSql ======
 ~~NOTOC~~ ~~NOTOC~~
 <WRAP right box> <WRAP right box>
 == See Also == == See Also ==
-[[dictionary:executesqlarray|executeSqlArray()]]+[[v5:dictionary:executesqlarray|executeSqlArray()]]
  
 == Syntax == == Syntax ==
-  array dropTableSql +  array renameTableSql 
-      string $tableName,+      string $oldTableName, 
 +      string $newTableName
        )        )
 </WRAP> </WRAP>
 ===== Description ===== ===== Description =====
-The method ''dropTableSql()'' creates the SQL statement necessary to drop an existing table from the database. In order to drop the table, the output of the command must be executed with the [[dictionary:executesqlarray|executeSqlArray()]] method.+The method ''renameTableSql()'' creates the SQL statement necessary to rename an existing table in the database. In order to actualy rename the table, the output of the command must be executed with the [[v5:dictionary:executesqlarray|executeSqlArray()]] method.
  
 ===== Parameters ===== ===== Parameters =====
-==== $tableName ===== +==== $oldTableName ===== 
-The table name must not yet exist in the database. Names must conform to any database specific requirements such as length limitations and name casing. +The table name must already exist in the database.  
 +==== $newTableName ==== 
 +The new table name must not yet exist in the database. Names must conform to any database specific requirements such as length limitations and name casing.
 ===== Usage ===== ===== Usage =====
 <code php> <code php>
Line 24: Line 26:
 $dict = NewDataDictionary($db); $dict = NewDataDictionary($db);
  
-$tabname = "ACT";+$oldTableName = "ACT"
 +$newTableName = 'NEWACT';
  
 /* /*
 * create the SQL statement necessary to drop the table and its columns * create the SQL statement necessary to drop the table and its columns
 */ */
-$sqlarray = $dict->dropTableSql($tabname);+$sqlarray = $dict->renameTableSql($oldTableName, $newTableNae);
  
 /* /*
Line 35: Line 38:
 Array Array
 ( (
-    [0] => DROP TABLE ACT+   [0] => RENAME TABLE ACT TO NEWACT 
 ) )
 */ */
  
 /* /*
-* This statement actually drops the table+* This statement actually renames the table
 */ */
 $dict->executeSqlArray($sqlarray); $dict->executeSqlArray($sqlarray);
 </code> </code>
- 
v5/dictionary/renametablesql.1440636495.txt.gz · Last modified: 2017/04/21 11:27 (external edit)