示例#1
0
 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;
 }
 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;
 }
示例#3
0
 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;
 }
	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;
	}