ADOdb

Database Abstraction Layer for PHP

User Tools

Site Tools


v5:dictionary:altercolumnsql

Differences

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

Link to this comparison view

Next revision
Previous revision
Last revisionBoth sides next revision
dictionary:altercolumnsql [2015/08/29 16:38] – created mnewnhamv5:dictionary:altercolumnsql [2016/01/13 02:06] – ↷ Page moved from dictionary:altercolumnsql to v5:dictionary:altercolumnsql mnewnham
Line 40: Line 40:
 <code php> <code php>
  
 +/*
 + * create a data dictionary object, using this connection
 + */
 +$dict = NewDataDictionary($db);
 +
 +
 +$table = 'lctable';
 +$flds = 'col6 C(50)';
 +
 +$sql = $dict->alterColumnSql($table,$flds);
 +/*
 + * Sql looks like:
 +  ALTER TABLE "lctable" ALTER COLUMN "col6" SET DATA TYPE VARCHAR(50)
 + */
 +
 +/*
 + * Complete the process by executing the statement
 +*/
 +$db->startTrans();
 +$dict->executeSqlArray($sql);
 +$db->completeTrans();
 </code> </code>
  
v5/dictionary/altercolumnsql.txt · Last modified: 2016/01/13 02:06 by mnewnham