ADOdb

Database Abstraction Layer for PHP

User Tools

Site Tools


v5:dictionary:comments

This is an old revision of the document!


Adding Comments To Tables

Database support for adding comments varies from full support (IBM DB2, PostgreSQL) to none (SQLite) with differing implementation methods. Databases that support it do it via 1 of 2 methods, Either be adding the comment as part of the table creation and modification process, or by adding a comment to a previously created table. In addition, databases have varying levels of support for adding comments to tables, columns and indexes. The following matrix shows available methods across supported databases.

db2 mssqlnative mysql oci8 postgres9 sqlite3
Table On Creation YES
Column On Creation YES
Index On Creation YES
Table After Creation YES YES YES YES
Column After Creation YES YES YES YES
Index After Creation YES YES YES

Creating Comments During Table Creation

Creation during data dictionary functions such as createTableSql(), addColumnSql() are built as follows:

Table

$datadict = newDataDictionary($db);
 
$flds = 'an ADOdb fields definition...';
$tableOpts = ['COMMENT' => 'This is a table Comment' ];
 
$sqlarray = $datadict->createTableSql('some_table',$flds, $tableopts);
 
$datadict->executeSqlArray($sqlArray);

Column

$datadict = newDataDictionary($db);
 
$flds = "SOME_FIELD C(60) NOTNULL COMMENT 'THIS IS A COLUMN COMMENT'";
 
$sqlarray = $datadit->alterColumnSql('some_table',$flds);
 
$datadict->executeSqlArray($sqlArray);
v5/dictionary/comments.1774211355.txt.gz · Last modified: by mnewnham