PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » Database » MDB » Bug #1004

[MDB1] mssql feature request: listTables()

Details

Submitted2004-03-12 20:25 UTC
Fromthierrybo at freesurf dot fr
Assignedlsmith
StatusClosed
PackageMDB
PHP Version4.3.2
OSwin32XP
Roadmaps(Not assigned)

Comments

[2004-03-12 20:25 UTC] thierrybo at freesurf dot fr

Description:
------------
Here is the listTables() function for mssql.

Reproduce code:
---------------
// {{{ listTables()

/**
* list all tables in the current database
*
* @param object $db database object that is extended by this class
* @return mixed data array on success, a MDB error on failure
* @access public
**/
function listTables(&$db)
{
$table_names = $db->queryCol('EXECUTE sp_tables @table_type = "\'TABLE\'"', "", 2);
if(MDB::isError($table_names)) {
return($table_names);
}
for($i = 0, $j = count($table_names), $tables = array(); $i < $j; ++$i)
{
if (!$this->_isSequenceName($db, $table_names[$i]))
$tables[] = $table_names[$i];
}
return($tables);
}

// }}}