ADOdb

Database Abstraction Layer for PHP

User Tools

Site Tools


v5:dictionary:executesqlarray

Differences

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

Link to this comparison view

Next revision
Previous revision
dictionary:executesqlarray [2015/08/26 00:47] – created mnewnhamv5:dictionary:executesqlarray [2016/01/13 02:06] (current) – ↷ Links adapted because of a move operation mnewnham
Line 8: Line 8:
 </WRAP> </WRAP>
 ===== Description ===== ===== Description =====
-The method ''executeSqlArray()'' executes an array of statements constructed by one of the data dictionary functions such as [[dictionary:createtablesql|createTableSql()]],  [[dictionary:dropindexsql|dropIndexSql()]] or  [[dictionary:addcolumnsql|addColumnSql()]]. The statements are executed within the scope of a single transaction.+The method ''executeSqlArray()'' executes an array of statements constructed by one of the data dictionary functions such as [[v5:dictionary:createtablesql|createTableSql()]],  [[v5:dictionary:dropindexsql|dropIndexSql()]] or  [[v5:dictionary:addcolumnsql|addColumnSql()]].  
 + 
 +The statements are executed within the scope of a single transaction.
 ===== Usage ===== ===== Usage =====
 +
 <code php> <code php>
 +/*
 +* create a data dictionary object, using the database connection
 +*/
 +$dict = NewDataDictionary($db);
 +
 +$tabname = "LCTABLE";
 +/*
 + * Change the length of COL1 from 32 chars to 60
 + */
 +
 +$flds = " 
 +   COL1 C(60) NOTNULL DEFAULT 'abc',
 +  ";
 +
 +/*
 +* create the SQL statement necessary to modify the column
 +*/
 +$sqlarray = $dict->changeTableSQL($tabname, $flds);
 +
 +/*
 +* This statement actually changes the table
 +*/
 +$db->startTrans();
 +$dict->executeSqlArray($sqlarray);
 +$db->completeTrans();
 </code> </code>
 +
v5/dictionary/executesqlarray.1440542864.txt.gz · Last modified: 2017/04/21 11:28 (external edit)