本文整理汇总了PHP中db2_tables函数的典型用法代码示例。如果您正苦于以下问题:PHP db2_tables函数的具体用法?PHP db2_tables怎么用?PHP db2_tables使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了db2_tables函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _i5listTables
/**
* Db2 On I5 specific method
*
* Returns a list of the tables in the database .
* Used only for DB2/400.
*
* @return array
*/
protected function _i5listTables($schema = null)
{
//list of i5 libraries.
$tables = array();
if ($schema) {
$tablesStatement = db2_tables($this->_connection, null, $schema);
while ($rowTables = db2_fetch_assoc($tablesStatement)) {
if ($rowTables['TABLE_NAME'] !== null) {
$tables[] = $rowTables['TABLE_NAME'];
}
}
} else {
$schemaStatement = db2_tables($this->_connection);
while ($schema = db2_fetch_assoc($schemaStatement)) {
if ($schema['TABLE_SCHEM'] !== null) {
// list of the tables which belongs to the selected library
$tablesStatement = db2_tables($this->_connection, NULL, $schema['TABLE_SCHEM']);
if (is_resource($tablesStatement)) {
while ($rowTables = db2_fetch_assoc($tablesStatement)) {
if ($rowTables['TABLE_NAME'] !== null) {
$tables[] = $rowTables['TABLE_NAME'];
}
}
}
}
}
}
return $tables;
}
示例2: listTables
/**
* Returns a list of the tables in the database.
*
* @return array
*/
public function listTables()
{
$this->_connect();
// take the most general case and assume no z/OS
// since listTables() takes no parameters
$stmt = db2_tables($this->_connection);
$tables = array();
while ($row = db2_fetch_assoc($stmt)) {
$tables[] = $row['TABLE_NAME'];
}
return $tables;
}
示例3: listSources
/**
* Returns an array of all the tables in the database.
* Should call parent::listSources twice in the method:
* once to see if the list is cached, and once to cache
* the list if not.
*
* @return array Array of tablenames in the database
*/
function listSources()
{
$cache = parent::listSources();
if ($cache != null) {
return $cache;
}
$result = db2_tables($this->connection);
$tables = array();
while (db2_fetch_row($result)) {
$tables[] = strtolower(db2_result($result, 'TABLE_NAME'));
}
parent::listSources($tables);
return $tables;
}
示例4: MetaTables
function MetaTables($ttype = false, $schema = false)
{
global $ADODB_FETCH_MODE;
$savem = $ADODB_FETCH_MODE;
$ADODB_FETCH_MODE = ADODB_FETCH_NUM;
$qid = db2_tables($this->_connectionID);
$rs = new ADORecordSet_db2($qid);
$ADODB_FETCH_MODE = $savem;
if (!$rs) {
$false = false;
return $false;
}
$arr = $rs->GetArray();
$rs->Close();
$arr2 = array();
// adodb_pr($arr);
if ($ttype) {
$isview = strncmp($ttype, 'V', 1) === 0;
}
for ($i = 0; $i < sizeof($arr); $i++) {
if (!$arr[$i][2]) {
continue;
}
$type = $arr[$i][3];
$schemaval = $schema ? $arr[$i][1] . '.' : '';
$name = $schemaval . $arr[$i][2];
$owner = $arr[$i][1];
if (substr($name, 0, 8) == 'EXPLAIN_') {
continue;
}
if ($ttype) {
if ($isview) {
if (strncmp($type, 'V', 1) === 0) {
$arr2[] = $name;
}
} else {
if (strncmp($type, 'T', 1) === 0 && strncmp($owner, 'SYS', 3) !== 0) {
$arr2[] = $name;
}
}
} else {
if (strncmp($type, 'T', 1) === 0 && strncmp($owner, 'SYS', 3) !== 0) {
$arr2[] = $name;
}
}
}
return $arr2;
}
示例5: db2_tables
function &MetaTables($ttype = false)
{
global $ADODB_FETCH_MODE;
$savem = $ADODB_FETCH_MODE;
$ADODB_FETCH_MODE = ADODB_FETCH_NUM;
$qid = db2_tables($this->_connectionID);
$rs = new ADORecordSet_db2($qid);
$ADODB_FETCH_MODE = $savem;
if (!$rs) {
$false = false;
return $false;
}
$arr =& $rs->GetArray();
$rs->Close();
$arr2 = array();
if ($ttype) {
$isview = strncmp($ttype, 'V', 1) === 0;
}
for ($i = 0; $i < sizeof($arr); $i++) {
if (!$arr[$i][2]) {
continue;
}
$type = $arr[$i][3];
if ($ttype) {
if ($isview) {
if (strncmp($type, 'V', 1) === 0) {
$arr2[] = $arr[$i][2];
}
} else {
if (strncmp($type, 'SYS', 3) !== 0) {
$arr2[] = $arr[$i][2];
}
}
} else {
if (strncmp($type, 'SYS', 3) !== 0) {
$arr2[] = $arr[$i][2];
}
}
}
return $arr2;
}
示例6: MetaTables
function MetaTables($ttype = false, $showSchema = false, $qtable = "%", $qschema = "%")
{
global $ADODB_FETCH_MODE;
$savem = $ADODB_FETCH_MODE;
$ADODB_FETCH_MODE = ADODB_FETCH_NUM;
// @@@ original: $qid = db2_tables($this->_connectionID);
$qid = db2_tables($this->_connectionID, null, $qschema, $qtable);
$rs = new ADORecordSet_db2($qid);
$ADODB_FETCH_MODE = $savem;
if (!$rs) {
$false = false;
return $false;
}
$arr =& $rs->GetArray();
$rs->Close();
$arr2 = array();
if ($ttype) {
$isview = strncmp($ttype, 'V', 1) === 0;
}
for ($i = 0; $i < sizeof($arr); $i++) {
if (!$arr[$i][2]) {
continue;
}
$type = $arr[$i][3];
// @@@ original: DB2/400 $schemaval = ($schema) ? $arr[$i][1].'.' : '';
// use $showSchema instead of $schema, for consistency with odbc_db2.inc.php
$schemaval = $showSchema ? $arr[$i][1] . '.' : '';
if ($ttype) {
if ($isview) {
if (strncmp($type, 'V', 1) === 0) {
$arr2[] = $schemaval . $arr[$i][2];
}
} else {
if (strncmp($type, 'SYS', 3) !== 0) {
$arr2[] = $schemaval . $arr[$i][2];
}
}
} else {
if (strncmp($type, 'SYS', 3) !== 0) {
$arr2[] = $schemaval . $arr[$i][2];
}
}
}
return $arr2;
}
示例7: tableExistsExtended
/**
* @param string $table
* @param string $schema
* @param string $type
* @return bool
*/
protected function tableExistsExtended($table, $schema = '%', $type = 'TABLE')
{
$table = db2_tables($this->database, null, $schema, $table, $type);
$table = $this->fetchByAssoc($table);
return !empty($table);
}
示例8: getTableNames
/**
* Creates an array with all table names
*
* @return void
* @access public
* @author Matteo Scaramuccia <matteo@scaramuccia.com>
* @author Thorsten Rinne <thorsten@phpmyfaq.de>
* @since 2006-08-26
*/
function getTableNames($prefix = '')
{
$stmt = db2_tables($this->conn);
while ($table = db2_fetch_assoc($stmt)) {
if ($table['TABLE_TYPE'] == 'TABLE' && strstr($table['TABLE_NAME'], $prefix . 'FAQ')) {
$this->tableNames[] = $table['TABLE_NAME'];
}
}
}
示例9: MetaTables
function MetaTables($ttype=false,$schema=false)
{
global $ADODB_FETCH_MODE;
$savem = $ADODB_FETCH_MODE;
$ADODB_FETCH_MODE = ADODB_FETCH_NUM;
$qid = db2_tables($this->_connectionID);
$rs = new ADORecordSet_db2($qid);
$ADODB_FETCH_MODE = $savem;
if (!$rs) {
$false = false;
return $false;
}
$arr = $rs->GetArray();
$rs->Close();
$arr2 = array();
if ($ttype) {
$isview = strncmp($ttype,'V',1) === 0;
}
for ($i=0; $i < sizeof($arr); $i++) {
if (!$arr[$i][2]) continue;
$type = $arr[$i][3];
$owner = $arr[$i][1];
$schemaval = ($schema) ? $arr[$i][1].'.' : '';
if ($ttype) {
if ($isview) {
if (strncmp($type,'V',1) === 0) $arr2[] = $schemaval.$arr[$i][2];
} else if (strncmp($owner,'SYS',3) !== 0) $arr2[] = $schemaval.$arr[$i][2];
} else if (strncmp($owner,'SYS',3) !== 0) $arr2[] = $schemaval.$arr[$i][2];
}
return $arr2;
}