ADOdb

Database Abstraction Layer for PHP

User Tools

Site Tools


v5:dictionary:executesqlarray

This is an old revision of the document!


executeSqlArray

Syntax
bool executeSqlArray (
    array $sqlStatements
    )

Description

The method executeSqlArray() executes an array of statements constructed by one of the data dictionary functions such as createTableSql(), dropIndexSql() or addColumnSql().

The statements are executed within the scope of a single transaction.

Usage

/*
* 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();
v5/dictionary/executesqlarray.1452647170.txt.gz · Last modified: 2017/04/21 11:28 (external edit)