当前位置: 首页>>代码示例>>PHP>>正文


PHP odbc_primarykeys函数代码示例

本文整理汇总了PHP中odbc_primarykeys函数的典型用法代码示例。如果您正苦于以下问题:PHP odbc_primarykeys函数的具体用法?PHP odbc_primarykeys怎么用?PHP odbc_primarykeys使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了odbc_primarykeys函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: initPrimaryKey

 /**
  * @see TableInfo::initPrimaryKey()
  */
 protected function initPrimaryKey()
 {
     include_once 'creole/metadata/PrimaryKeyInfo.php';
     // columns have to be loaded first
     if (!$this->colsLoaded) {
         $this->initColumns();
     }
     $result = @odbc_primarykeys($this->dblink, $this->dbname, '', $this->name);
     while (odbc_fetch_row($result)) {
         $name = odbc_result($result, 'COLUMN_NAME');
         if (!isset($this->primaryKey)) {
             $this->primaryKey = new PrimaryKeyInfo($name);
         }
         $this->primaryKey->addColumn($this->columns[$name]);
     }
     @odbc_free_result($result);
     $this->pkLoaded = true;
 }
开发者ID:BackupTheBerlios,项目名称:nodin-svn,代码行数:21,代码来源:ODBCTableInfo.php

示例2: MetaPrimaryKeys

 function MetaPrimaryKeys($table)
 {
     global $ADODB_FETCH_MODE;
     if ($this->uCaseTables) {
         $table = strtoupper($table);
     }
     $schema = '';
     $this->_findschema($table, $schema);
     $savem = $ADODB_FETCH_MODE;
     $ADODB_FETCH_MODE = ADODB_FETCH_NUM;
     $qid = @odbc_primarykeys($this->_connectionID, '', $schema, $table);
     if (!$qid) {
         $ADODB_FETCH_MODE = $savem;
         return false;
     }
     $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();
     $rs->Close();
     //print_r($arr);
     $arr2 = array();
     for ($i = 0; $i < sizeof($arr); $i++) {
         if ($arr[$i][3]) {
             $arr2[] = $arr[$i][3];
         }
     }
     return $arr2;
 }
开发者ID:joeymetal,项目名称:v1,代码行数:32,代码来源:adodb-odbc.inc.php

示例3: get_cols

function get_cols(&$conn, $table)
{
    global $dbname;
    $cols = array();
    $keys = array();
    //    $table = 'dbo.'.$table;
    $r = odbc_primarykeys($conn, $dnname, '%', $table);
    while ($row = odbc_fetch_array($r)) {
        $keys[] = $row['COLUMN_NAME'];
    }
    $r = odbc_columns($conn, $dbname, '%', $table, '%');
    while ($row = odbc_fetch_array($r)) {
        //      print_r($row);
        $c = array();
        $c['name'] = htmlentities($row['COLUMN_NAME']);
        $c['type'] = $row['TYPE_NAME'];
        $c['special'] = '';
        if (isset($row['COLUMN_SIZE'])) {
            $c['special'] = $row['COLUMN_SIZE'];
        }
        if (isset($row['LENGTH'])) {
            $c['special'] = $row['LENGTH'];
        }
        $c['nn'] = $row['NULLABLE'] == 0;
        $c['default'] = str_replace("'", '', $row['COLUMN_DEF']);
        $c['pk'] = in_array($row['COLUMN_NAME'], $keys);
        $cols[] = $c;
    }
    return $cols;
}
开发者ID:keyur-rathod,项目名称:web2py-appliances,代码行数:30,代码来源:import.php

示例4: GetColumnInfo

 function GetColumnInfo($TableName)
 {
     switch ($this->dbc->Dialect) {
         case "TSQL":
             $qualifier = $this->dbc->dbDefault;
             $schema = "%";
             break;
         case "Access":
             $qualifier = $this->dbc->dsn;
             $schema = "";
             break;
         default:
             return null;
     }
     echo "<p>GetColumnInfo: " . $qualifier . "." . $schema . "." . $TableName . "</p>";
     $rsMain = odbc_columns($this->dbc->dbMain, $qualifier, $schema, $TableName);
     //odbc_result_all($rsMain);
     if (!$rsMain) {
         return null;
     }
     $arColumns = array();
     while ($this->FetchAssoc($rsMain, $row)) {
         if ($row["TABLE_NAME"] != $TableName) {
             continue;
         }
         $colinfo = new dbColumn();
         //echo "<p>GetColumnInfo: ".$row["COLUMN_NAME"].':'.$row["TYPE_NAME"]."</p>";
         $colinfo->ColName = $row["COLUMN_NAME"];
         $colinfo->ColType = $row["TYPE_NAME"];
         if (array_key_exists("PRECISION", $row)) {
             $colinfo->ColLength = $row["PRECISION"];
         } else {
             if (array_key_exists("COLUMN_SIZE", $row)) {
                 $colinfo->ColLength = $row["COLUMN_SIZE"];
             }
         }
         $colinfo->Nullable = $row["NULLABLE"] == "YES";
         $colinfo->IsPKey = false;
         $colinfo->Writeable = $row["TYPE_NAME"] != 'int identity';
         array_push($arColumns, $colinfo);
     }
     $this->FreeResult($rsMain);
     //$rsMain=odbc_columnprivileges($this->dbc->dbMain, $qualifier, $schema, $TableName,"%");
     //odbc_result_all($rsMain);
     //$this->FreeResult($rsMain);
     $rsMain = odbc_primarykeys($this->dbc->dbMain, $qualifier, $schema, $TableName);
     if ($rsMain) {
         while ($this->FetchAssoc($rsMain, $row)) {
             $colname = $row["COLUMN_NAME"];
             //echo "<p>GetColumnInfo pk: ".$colname."</p>";
             for ($i = 0; $i < count($arColumns); $i++) {
                 if ($arColumns[$i]->ColName == $colname) {
                     $arColumns[$i]->IsPKey = true;
                     break;
                 }
             }
         }
         $this->FreeResult($rsMain);
     }
     return $arColumns;
 }
开发者ID:modulexcite,项目名称:frameworks,代码行数:61,代码来源:dbClass2.php

示例5: var_dump

    }
    var_dump($rr);
}
// foreignkeys
$rh = odbc_foreignkeys($r, '', '', '', '', '', '');
//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);
    }
}
// primarykeys
$rh = odbc_primarykeys($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);
    }
}
// tables
$rh = odbc_tables($r);
//var_dump($rh);
echo "resource? " . is_resource($rh) . "\n";
if ($rh == NULL) {
    echo odbc_errormsg();
开发者ID:jenalgit,项目名称:roadsend-php,代码行数:31,代码来源:link-info-functions.php

示例6: listTableIndexes

 /**
  * 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);
 }
开发者ID:MusicalAPP,项目名称:gfk-api-spotify-itunes,代码行数:49,代码来源:odbc.php


注:本文中的odbc_primarykeys函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。