本文整理汇总了PHP中odbc_tables函数的典型用法代码示例。如果您正苦于以下问题:PHP odbc_tables函数的具体用法?PHP odbc_tables怎么用?PHP odbc_tables使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了odbc_tables函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getTables
/** Returns a full list of tables in an array. */
function getTables(){
if ($this->getConn()){
$return = array();
if ($this->getType() == "mysql"){
$f_gt = $this->query("SHOW TABLE STATUS", $this->conn);
while($d_gt = $this->query_fetch_assoc($f_gt)){
$return[] = array(
"name" => $d_gt[Name],
"engine" => $d_gt[Engine],
"collation" => $d_gt[Collation],
"rows" => $d_gt[Rows]
);
}
return $return;
}elseif($this->getType() == "pgsql"){
$f_gt = $this->query("SELECT relname FROM pg_stat_user_tables ORDER BY relname");
while($d_gt = $this->query_fetch_assoc($f_gt)){
$return[] = array(
"name" => $d_gt[relname],
"engine" => "pgsql",
"collation" => "pgsql"
);
}
return $return;
}elseif($this->getType() == "sqlite" || $this->getType() == "sqlite3"){
$f_gt = $this->query("SELECT name FROM sqlite_master WHERE type = 'table' ORDER BY name");
while($d_gt = $this->query_fetch_assoc($f_gt)){
if ($d_gt["name"] != "sqlite_sequence"){
$return[] = array(
"name" => $d_gt[name],
"engine" => "sqlite",
"collation" => "sqlite"
);
}
}
return $return;
}elseif($this->getType() == "access"){
$f_gt = odbc_tables($this->conn);
while($d_gt = odbc_fetch_array($f_gt)){
if ($d_gt[TABLE_TYPE] == "TABLE"){
$return[] = array(
"name" => $d_gt[TABLE_NAME],
"engine" => "access",
"collation" => "access"
);
}
}
return $return;
}else{
throw new Exception("Not a valid type: " . $this->getType());
}
}
}
示例2: db_gettablelist
function db_gettablelist()
{
global $conn;
$ret=array();
$rs = odbc_tables($conn);
while(odbc_fetch_row($rs))
if(odbc_result($rs,"TABLE_TYPE")=="TABLE" || odbc_result($rs,"TABLE_TYPE")=="VIEW")
$ret[]=odbc_result($rs,"TABLE_NAME");
return $ret;
}
示例3: db_gettablelist
/**
* @return Array
*/
public function db_gettablelist()
{
$ret = array();
$rs = odbc_tables($this->connectionObj->conn);
while (odbc_fetch_row($rs)) {
if (odbc_result($rs, "TABLE_TYPE") == "TABLE" || odbc_result($rs, "TABLE_TYPE") == "VIEW") {
$ret[] = odbc_result($rs, "TABLE_NAME");
}
}
return $ret;
}
示例4: initTables
/**
* @see DatabaseInfo::initTables()
*/
protected function initTables()
{
include_once 'creole/drivers/odbc/metadata/ODBCTableInfo.php';
$result = @odbc_tables($this->conn->getResource());
if (!$result) {
throw new SQLException('Could not list tables', $this->conn->nativeError());
}
while (odbc_fetch_row($result)) {
$tablename = strtoupper(odbc_result($result, 'TABLE_NAME'));
$this->tables[$tablename] = new ODBCTableInfo($this, $tablename);
}
@odbc_free_result($result);
}
示例5: odbc_tables
function &MetaTables()
{
$qid = odbc_tables($this->_connectionID);
$rs = new ADORecordSet_odbc($qid);
//print_r($rs);
$arr =& $rs->GetArray();
$arr2 = array();
for ($i = 0; $i < sizeof($arr); $i++) {
if ($arr[$i][2] && substr($arr[$i][2], 0, 4) != 'MSys') {
$arr2[] = $arr[$i][2];
}
}
return $arr2;
}
示例6: afficheTables
function afficheTables($pFichAction)
{
//remplissage de la liste
$tablelist = odbc_tables($this->connexion);
echo '<form name="choixTables" method="get" action="' . $pFichAction . '">';
echo '<select name="lesTables">';
while (odbc_fetch_row($tablelist)) {
if (odbc_result($tablelist, 4) == "TABLE") {
// Si l'objet en cours a pour indicateur TABLE //test à ajouter dans la condition pour ne pas afficher les tables système en Access && !(substr(odbc_result($tablelist,3),0,4)=="MSys")
echo '<option value="' . odbc_result($tablelist, 3) . '">' . odbc_result($tablelist, 3) . '</option>';
}
// Affiche nom de la TABLE
}
echo '</select><input type="submit" value="Afficher"></input></form>';
}
示例7: getTables
/**
* Retorna un array con las tablas accesibles por el ODBC. Cada array tiene los encabezados
* KEY => VALUE y los key son las constantes TABLE_*
*/
public function getTables()
{
$tables = array();
if ($this->_isConnected()) {
$result = odbc_tables($this->conn);
if (!$result) {
$this->_error = "No fue posible consultar las respuestas";
return null;
}
while ($row = odbc_fetch_array($result)) {
$tables[] = $row;
}
} else {
$this->_error = "No se encuentra conectado a ningun ODBC";
return null;
}
return $tables;
}
示例8: odbc_tables
function &MetaTables()
{
global $ADODB_FETCH_MODE;
$savem = $ADODB_FETCH_MODE;
$ADODB_FETCH_MODE = ADODB_FETCH_NUM;
$qid = odbc_tables($this->_connectionID);
$rs = new ADORecordSet_odbc($qid);
$ADODB_FETCH_MODE = $savem;
if (!$rs) {
return false;
}
$rs->_has_stupid_odbc_fetch_api_change = $this->_has_stupid_odbc_fetch_api_change;
$arr =& $rs->GetArray();
$arr2 = array();
for ($i = 0; $i < sizeof($arr); $i++) {
if ($arr[$i][2] && substr($arr[$i][2], 0, 4) != 'MSys') {
$arr2[] = $arr[$i][2];
}
}
return $arr2;
}
示例9: odbc_errormsg
print "<p>Uh-oh! Failure to connect to DSN [{$DSN}]: <br />";
odbc_errormsg();
} else {
print "done</p>\n";
$resultset = odbc_exec($handle, "{$query}");
odbc_result_all($resultset, "border=2");
odbc_close($handle);
}
} else {
print "<p>Sorry, that query has been disabled for security reasons</p>\n";
}
}
if ($listtables != NULL) {
print "<h2>List of tables</h2>";
print "<p>Connecting... ";
$handle = odbc_connect("{$DSN}", "{$uid}", "{$passwd}");
print "done</p>\n";
if (!$handle) {
print "<p>Uh-oh! Failure to connect to DSN [{$DSN}]: <br />";
odbc_errormsg();
} else {
$resultset = odbc_tables($handle);
odbc_result_all($resultset, "border=2");
odbc_close($handle);
}
}
?>
</body>
</html>
示例10: odbc_tables
<?php
$result = odbc_tables($connection);
$first = isset($_POST['first']) ? $_POST['first'] : 0;
if (isset($_POST['rows'])) {
$max = $_POST['rows'];
}
if ($result) {
echo "\"data\":[";
$j = 0;
// For some reason odbc_fetch_array ignores the second parameter
while ($first >= 0) {
$data = odbc_fetch_array($result);
$first--;
}
while ($data) {
echo json_encode($data);
$j++;
if (!(isset($max) && $j >= $max)) {
$data = odbc_fetch_array($result);
} else {
$data = false;
}
if ($data) {
echo ",";
}
}
echo "],";
}
echo "\"totalRecords\":" . $j . ",";
$status = "ok";
示例11: listSources
/**
* Returns an array of sources (tables) in the database.
*
* @return array Array of tablenames in the database
*/
function listSources()
{
$cache = parent::listSources();
if ($cache != null) {
return $cache;
}
/*$result = odbc_tables($this->connection);
if (function_exists('odbc_fetch_row')) {
echo 'GOOD';
} else {
echo 'BAD';
}*/
$result = odbc_tables($this->connection);
$tables = array();
while (odbc_fetch_row($result)) {
array_push($tables, odbc_result($result, "TABLE_NAME"));
}
parent::listSources($tables);
return $tables;
}
示例12: getTableList
/**
* Description
*
* @access public
* @return array A list of all the tables in the database
*/
function getTableList()
{
return odbc_tables($this->_resource);
}
示例13: cmp
}
function cmp($arr1, $arr2)
{
$a = $arr1[1];
/* count of cols in 1st array */
$b = $arr2[1];
/* count of cols in 2nd array */
if ($a == $b) {
return 0;
}
return $a < $b ? -1 : 1;
}
prepare_conversion();
$table_names = array();
$tables = array();
$r = odbc_tables($conn);
while ($t = odbc_fetch_array($r)) {
// print_r($t);
$type = $t['TABLE_TYPE'] == 'TABLE';
$owner = true;
if (isset($t['TABLE_OWNER'])) {
$owner = strtolower($t['TABLE_OWNER']) != 'information_schema';
}
if ($type && $owner) {
$table_names[] = $t['TABLE_NAME'];
}
}
for ($i = 0; $i < count($table_names); $i++) {
$cols = get_cols($conn, $table_names[$i]);
$cnt = count($cols);
$tables[] = array($cols, $cnt, $table_names[$i]);
示例14: odbc_connect
*/
$odbc['dsn'] = "SageLine50v19";
// pointing to C:\Documents and Settings\All Users\Application Data\Sage\Accounts\2013\Demodata\ACCDATA
//$odbc['dsn'] = "sagedemo";
$odbc['user'] = "manager";
$odbc['pass'] = "";
// Step 1: Connect to the source ODBC database
if ($debug) {
echo "Connect to " . $odbc['dsn'] . ' as ' . $odbc['user'] . "\n";
}
$conn = odbc_connect($odbc['dsn'], $odbc['user'], $odbc['pass']);
if (!$conn) {
die("Error connecting to the ODBC database: " . odbc_errormsg());
}
// loop through each table
$allTables = odbc_tables($conn);
$tablesArray = array();
while (odbc_fetch_row($allTables)) {
if (odbc_result($allTables, "TABLE_TYPE") == "TABLE") {
$tablesArray[] = odbc_result($allTables, "TABLE_NAME");
}
}
//print_r($tablesArray); // to list all tables
if (!empty($tablesArray)) {
// loop though each table
foreach ($tablesArray as $currentTable) {
echo "Table " . $currentTable;
// get first, or all entries in the table.
if ($debug) {
echo $currentTable;
}
示例15: odbc_connect
<html>
<head>
<title>ezRETS Metadata Viewer with PHP</title>
</head>
<body>
About to make a connection.<br/>
<?php
$dsn = "retstest";
$user = "Joe";
$pwd = "Schmoe";
$conn = odbc_connect($dsn, $user, $pwd);
?>
Connection made.<br/>
<?php
// lookup tables
$tableexec = odbc_tables($conn);
$table_count = odbc_num_fields($tableexec);
echo "There are {$table_count} tables on the server</br>";
?>
<table border="0" width="100%" cellpadding="10" cellspacing="0">
<?php
// loop through tables
while (odbc_fetch_row($tableexec)) {
?>
<tr>
<td>
<table border=\"1\">
<tr bgcolor="yellow">
<th>Table Name</th><th>Description</th><th>Columns</th>
</tr>
<tr>