Home » Database » MDB » Bug #1003
[MDB1] mssql feature request: listTableFields()
Details
| Submitted | 2004-03-12 20:22 UTC |
|---|---|
| From | thierrybo at freesurf dot fr |
| Assigned | lsmith |
| Status | Closed |
| Package | MDB |
| PHP Version | 4.3.2 |
| OS | win32XP |
| Roadmaps | (Not assigned) |
Comments
[2004-03-12 20:22 UTC] thierrybo at freesurf dot fr
Description:
------------
Here is the listTableFields() function for mssql.
Reproduce code:
---------------
// {{{ listTableFields()
/**
* list all fields in a tables in the current database
*
* @param object $db database object that is extended by this class
* @param string $table name of table that should be used in method
* @return mixed data array on success, a MDB error on failure
* @access public
*/
function listTableFields(&$db, $table)
{
$result = $db->query("SELECT * FROM $table");
if(MDB::isError($result)) {
return($result);
}
$columns = $db->getColumnNames($result);
if(MDB::isError($columns)) {
$db->freeResult($columns);
}
return(array_flip($columns));
}
// }}}