ADOdb

Database Abstraction Layer for PHP

User Tools

Site Tools


v5:dictionary:comments

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
v5:dictionary:comments [2026/03/22 23:25] mnewnhamv5:dictionary:comments [2026/03/22 23:45] (current) mnewnham
Line 100: Line 100:
  
 $datadict = newDataDictionary($db); $datadict = newDataDictionary($db);
-$tableCommentSql = $datadict->getTableCommentSql($table, $comment);+$tableCommentSql = $datadict->setTableCommentSql($table, $comment);
  
 /* /*
Line 138: Line 138:
  
 --------------------------------------- ---------------------------------------
 +===== Reading Comments ===== 
 +All databases use the same methods to retrieve comments set in the database.
 +==== Table ==== 
 +<WRAP right box>
 +== Syntax ==
 +
 +    ?string getTableCommentSql(
 +        string $tableName
 +    )
 +
 +</WRAP>
 +**ADODataDictionary::getTableCommentSql()** returns an SQL Statement that can be executed to retrieve a table comment from the currently connected database. If the database does not support retrieving a comment this way, the method returns NULL.
 +
 +---------------------------------------
 +<code php>
 +/*
 +* Assume connection to a PostgresQL database
 +*/
 +
 +$table = 'some_table';
 +
 +
 +$datadict = newDataDictionary($db);
 +$tableCommentSql = $datadict->getTableCommentSql($table);
 +
 +/*
 +* Returns  "SELECT obj_description('public.some_table'::regclass, 'pg_class')"
 +*/
 +
 +$comment = $db->getOne($tableCommentSql);
 +</code>
 +==== Column ==== 
 +<WRAP right box>
 +== Syntax ==
 +
 +    ?string getColumnCommentSql(
 +        string $tableName,
 +        string $columnName
 +    )
 +
 +</WRAP>
 +**ADODataDictionary::getColumnCommentSql()** returns an SQL Statement that can be executed to retrieve a column comment in the currently connected database. If the database does not support retrieving a comment this way, the method returns NULL.
 +
 +---------------------------------------
 +
 +==== Index ==== 
 +<WRAP right box>
 +== Syntax ==
 +
 +    ?string getIndexCommentSql(
 +        string $tableName,
 +        string $indexName
 +    )
 +
 +</WRAP>
 +**ADODataDictionary::getIndexCommentSql()** returns an SQL Statement that can be executed to retrieve an index comment from the currently connected database. If the database does not support retrieving a comment this way, the method returns NULL.
 +
 +----------------------------------
 +
 +===== Deprecated Functions ===== 
 +The functions **getCommentSql()** and **setCommentSql()** which get/set table comments in the oci8 driver are deprecated and will be removed in a later release. They currently alias **getTableCommentSql()** and **setTableCommentSql()**
v5/dictionary/comments.1774218313.txt.gz · Last modified: by mnewnham