var_dump($rr); } } // tableprivileges $rh = odbc_tableprivileges($r, '', 'test', '%'); //var_dump($rh); echo "resource? " . is_resource($rh) . "\n"; if ($rh == NULL) { echo odbc_errormsg(); } else { while ($rr = odbc_fetch_array($rh)) { var_dump($rr); } } // statistics $rh = odbc_statistics($r, '', 'test', 'my_table', '', ''); //var_dump($rh); echo "resource? " . is_resource($rh) . "\n"; if ($rh == NULL) { echo odbc_errormsg(); } else { while ($rr = odbc_fetch_array($rh)) { var_dump($rr); } } // specialcolumns /* $rh = odbc_specialcolumns($r,SQL_BEST_ROWID,'','test','my_table',0,0); var_dump($rh); if ($rh == NULL) { echo odbc_errormsg();
/** * list all indexes in a table * * @param string $table name of table that should be used in method * * @return mixed array of index names on success, a MDB2 error on failure * @access public */ function listTableIndexes($table) { $db =& $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } $key_name = 'INDEX_NAME'; $pk_name = 'PK_NAME'; if ($db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) { if ($db->options['field_case'] == CASE_LOWER) { $key_name = strtolower($key_name); $pk_name = strtolower($pk_name); } else { $key_name = strtoupper($key_name); $pk_name = strtoupper($pk_name); } } //$table = $db->quote($table, 'text'); //$query = "EXEC sp_statistics @table_name=$table"; $table = "V_PARTNERSTAMM"; $res = odbc_statistics($db->connection, $db->dsn[username], $db->dsn[username], $table, 0, 0); $indexes = array(); while ($data = odbc_fetch_array($res)) { $indexes[] = $data[$key_name]; } $res = odbc_primarykeys($db->connection, $db->dsn[username], $db->dsn[username], $table); $pk_all = array(); while ($data = odbc_fetch_array($res)) { $pk_all[] = $data[$key_name]; } $result = array(); foreach ($indexes as $index) { if (!in_array($index, $pk_all) && ($index = $this->_fixIndexName($index))) { $result[$index] = true; } } if ($db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) { $result = array_change_key_case($result, $db->options['field_case']); } return array_keys($result); }