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 » DB » Bug #2331

code for function getSpecialQuery($type)

Details

Request #2331code for function getSpecialQuery($type)
Submitted2004-09-14 19:16 UTC
Fromraseesink at hotpop dot com
Assigneddanielc
StatusClosed
PackageDB
PHP Version4.3.8
OSdebian
Roadmaps(Not assigned)

Comments

[2004-09-14 19:16 UTC] raseesink at hotpop dot com

Description:
------------
Here is some code which implements function getSpecialQuery($type) for ibase.php. Use it at any license of choice.

/**
* Returns the query needed to get some backend info
* @param string $type What kind of info you want to retrieve
* @return string The SQL query string
*/
function getSpecialQuery($type)
{
switch ($type) {
case 'tables':
// Is this correct?
$sql="SELECT DISTINCT R.RDB\$RELATION_NAME FROM RDB\$RELATION_FIELDS R WHERE R.RDB\$SYSTEM_FLAG=0";
break;
default:
case 'views':
// Is this correct?
$sql="SELECT DISTINCT RDB\$VIEW_NAME from RDB\$VIEW_RELATIONS";
break;
default:
case 'users':
// Is this correct?
$sql="SELECT DISTINCT RDB\$USER FROM RDB\$USER_PRIVILEGES";
break;
case 'databases':
// Database not capable?
return $this->raiseError(DB_ERROR_UNSUPPORTED);
break;
default:
return $this->raiseError(DB_ERROR_UNSUPPORTED);
}
return $sql;
}