PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Database » MDB » Bug #1003

[MDB1] mssql feature request: listTableFields()

Details

Submitted2004-03-12 20:22 UTC
Fromthierrybo at freesurf dot fr
Assignedlsmith
StatusClosed
PackageMDB
PHP Version4.3.2
OSwin32XP
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));
}

// }}}