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


PHP odbc_free_result函数代码示例

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


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

示例1: query

 public function query($sql)
 {
     $rs = odbc_exec($this->dbConnection(), $sql);
     if (is_resource($rs)) {
         while ($result[] = odbc_fetch_array($rs)) {
         }
         odbc_free_result($rs);
         $this->close();
         return $result;
     } else {
         $this->halt('Database query error', $sql);
     }
 }
开发者ID:huangbinzd,项目名称:kppwGit,代码行数:13,代码来源:odbc_driver.php

示例2: query

 /**
  * Execute a query and return the results
  * @param string $query
  * @param array $params
  * @param bool $fetchResult Return a ressource or a an array
  * @return resource|array
  * @throws Exception
  */
 public function query($query, $params = null, $fetchResult = false)
 {
     $this->checkConnection(true);
     $this->log('Query: ' . $query);
     if (!empty($params)) {
         $this->log('Params: ' . print_r($params, true));
     }
     $start = microtime(true);
     if (empty($params)) {
         $res = $this->executeQuery($query);
     } else {
         $res = $this->executePreparedStatement($query, $params);
     }
     $end = microtime(true);
     $this->log("Execution time: " . ($end - $start) . " seconds");
     if ($fetchResult) {
         $this->log('Num Rows: ' . odbc_num_rows($res));
         $resutlSet = $this->getRows($res);
         odbc_free_result($res);
         $res = $resutlSet;
         $resultSet = null;
         $fetch = microtime(true);
         $this->log("Fetch time: " . ($fetch - $end) . " seconds");
     }
     return $res;
 }
开发者ID:schpill,项目名称:thin,代码行数:34,代码来源:Vertica.php

示例3: _import_db

    function _import_db()
    {
        //
        $sql = 'SELECT *
			FROM provedor
			ORDER BY nit';
        $result = $this->query($sql);
        while ($row = odbc_fetch_array($result)) {
            $this->p[] = $row;
        }
        odbc_free_result($result);
        unset($row);
        //
        $sql = 'SELECT *
			FROM constancia
			ORDER BY exencion';
        $result = $this->query($sql);
        while ($row = odbc_fetch_array($result)) {
            $this->e[] = $row;
        }
        odbc_free_result($result);
        unset($row);
        //
        $sql = 'SELECT *
			FROM factura
			ORDER BY exencion, factura';
        $result = $this->query($sql);
        while ($row = odbc_fetch_array($result)) {
            $this->f[] = $row;
        }
        odbc_free_result($result);
        //
        return;
    }
开发者ID:nopticon,项目名称:ei,代码行数:34,代码来源:class.php

示例4: free_result

 function free_result($res)
 {
     if (odbc_free_result($res)) {
         return true;
     } else {
         return false;
     }
 }
开发者ID:ricardoletelier,项目名称:conexion-mysqli-postgresql-desde-php,代码行数:8,代码来源:odbc.php

示例5: 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);
 }
开发者ID:taryono,项目名称:school,代码行数:16,代码来源:ODBCDatabaseInfo.php

示例6: index

 public function index()
 {
     //test the dynamic connection with other databases seems successfull
     $systems = System::all();
     $res = [];
     foreach ($systems as $system) {
         $query = "SELECT [states].eq_id, [states].time, [states].[state_OK],[states].[state_MaintRQ], [states].[state_InMaint], [states].[state_Fault], [equipment].eq_id, CAST(CAST([equipment].eq_name AS VARBINARY) AS VARCHAR) as eq_name FROM [states] LEFT JOIN [equipment] on states.eq_id = [equipment].eq_id";
         if ($system['dbversion'] == '2000') {
             $port = '1434';
             try {
                 $connection = odbc_connect("Driver={SQL Server Native Client 10.0};Server=" . $system['host'] . "," . $port . ";Database=" . $system['dbname'], $system['dbuser'], Crypt::decrypt($system['dbuserpass']));
             } catch (ErrorException $e) {
                 $system->status = 'default';
                 $system->save();
                 $res[$system['name']] = ['error' => $e];
             }
             if ($conn) {
                 $results = odbc_exec($connection, $query);
                 $realData = [];
                 $i = 0;
                 while ($row = json_decode(json_encode(odbc_fetch_object($results)), true)) {
                     foreach ($row as $key => $item) {
                         if ($key == "eq_name" && is_string($item)) {
                             $row[$key] = iconv('UCS-2LE', 'UTF-8', $item);
                         }
                     }
                     $realData[$i] = $row;
                     $i++;
                 }
                 $res[$system['name']] = $realData;
                 odbc_free_result($results);
                 odbc_close($connection);
             }
         } else {
             try {
                 $conn = new PDO("sqlsrv:Server=" . $system['host'] . ";Database=" . $system['dbname'], $system['dbuser'], Crypt::decrypt($system['dbuserpass']));
             } catch (PDOException $e) {
                 $system->status = 'default';
                 $system->save();
                 $res[$system['name']] = ['error' => $e];
             }
             if ($conn) {
                 $sql = $conn->prepare($query);
                 $sql->execute();
                 $res[$system['name']] = $sql->fetchAll();
                 $conn = null;
             }
         }
     }
     return $res;
 }
开发者ID:rvmladenov,项目名称:monitoring_system,代码行数:51,代码来源:TestController.php

示例7: odbc_fila

function odbc_fila($sql, $fila)
{
    $cnn_odbc = odbc_connect("ctw", "", "");
    $rs = odbc_exec($cnn_odbc, $sql);
    $value = "NO_EXISTE";
    $value = odbc_fetch_array($rs, 1);
    odbc_free_result($rs);
    odbc_close($cnn_odbc);
    //if(!$rs){
    //	return odbc_error($rs);
    //} else {
    return $value[$fila];
    //}
}
开发者ID:Cywaithaka,项目名称:S.A.F.E.-Open-Source-Microfinance-Suite,代码行数:14,代码来源:compacw.inc.php

示例8: _execute

 /**
  * Internal function to call native ODBC prepare/execute functions.
  */
 protected function _execute($sql, $params, $fetchmode, $isupdate)
 {
     // Set any params passed directly
     if ($params) {
         for ($i = 0, $cnt = count($params); $i < $cnt; $i++) {
             $this->set($i + 1, $params[$i]);
         }
     }
     // Trim surrounding quotes added from default set methods.
     // Exception: for LOB-based parameters, odbc_execute() will
     // accept a filename surrounded by single-quotes.
     foreach ($this->boundInVars as $idx => $var) {
         if ($var instanceof Lob) {
             $file = $isupdate ? $var->getInputFile() : $var->getOutputFile();
             $this->boundInVars[$idx] = "'{$file}'";
         } else {
             if (is_string($var)) {
                 $this->boundInVars[$idx] = trim($var, "\"\\'");
             }
         }
     }
     if ($this->resultSet) {
         $this->resultSet->close();
         $this->resultSet = null;
     }
     $this->updateCount = null;
     $stmt = @odbc_prepare($this->conn->getResource(), $sql);
     if ($stmt === FALSE) {
         throw new SQLException('Could not prepare query', $this->conn->nativeError(), $sql);
     }
     $ret = @odbc_execute($stmt, $this->boundInVars);
     if ($ret === FALSE) {
         @odbc_free_result($stmt);
         throw new SQLException('Could not execute query', $this->conn->nativeError(), $sql);
     }
     return $this->conn->createResultSet(new ODBCResultResource($stmt), $fetchmode);
 }
开发者ID:BackupTheBerlios,项目名称:nodin-svn,代码行数:40,代码来源:ODBCPreparedStatement.php

示例9: db_get_query_rows

 /**
  * Get the rows returned from a SELECT query.
  *
  * @param  resource		The query result pointer
  * @param  ?integer		Whether to start reading from (NULL: irrelevant for this forum driver)
  * @return array			A list of row maps
  */
 function db_get_query_rows($results, $start = NULL)
 {
     $out = array();
     $i = 0;
     $num_fields = odbc_num_fields($results);
     $types = array();
     $names = array();
     for ($x = 1; $x <= $num_fields; $x++) {
         $types[$x] = odbc_field_type($results, $x);
         $names[$x] = odbc_field_name($results, $x);
     }
     while (odbc_fetch_row($results)) {
         if (is_null($start) || $i >= $start) {
             $newrow = array();
             for ($j = 1; $j <= $num_fields; $j++) {
                 $v = odbc_result($results, $j);
                 $type = $types[$j];
                 $name = strtolower($names[$j]);
                 if ($type == 'INTEGER' || $type == 'SMALLINT' || $type == 'UINTEGER') {
                     if (!is_null($v)) {
                         $newrow[$name] = intval($v);
                     } else {
                         $newrow[$name] = NULL;
                     }
                 } else {
                     $newrow[$name] = $v;
                 }
             }
             $out[] = $newrow;
         }
         $i++;
     }
     odbc_free_result($results);
     //	echo '<p>End '.microtime(false);
     return $out;
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:43,代码来源:ibm.php

示例10: freeResult

 function freeResult($result)
 {
     if (is_resource($result)) {
         // Always return true
         return odbc_free_result($result);
     }
     if (!isset($this->prepare_tokens[(int) $result])) {
         return false;
     }
     unset($this->prepare_tokens[(int) $result]);
     unset($this->prepare_types[(int) $result]);
     return true;
 }
开发者ID:noikiy,项目名称:owaspbwa,代码行数:13,代码来源:odbc.php

示例11: db_free

 function db_free($oStmt)
 {
     return odbc_free_result($oStmt);
 }
开发者ID:brustj,项目名称:tracmor,代码行数:4,代码来源:db_odbc.php

示例12: freeResult

 function freeResult($result)
 {
     unset($this->row[(int) $result]);
     return @odbc_free_result($result);
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:5,代码来源:odbc.php

示例13: free_result

 /**
  * Free the result
  *
  * @return	void
  */
 public function free_result()
 {
     if (is_resource($this->result_id)) {
         odbc_free_result($this->result_id);
         $this->result_id = FALSE;
     }
 }
开发者ID:marketcoinfork,项目名称:BitWasp-Fork,代码行数:12,代码来源:odbc_result.php

示例14: execute

 /**
  * This will not return anything, and will free resources correctly.
  */
 function execute($sql, $ignore_message = null)
 {
     $query = @odbc_exec($this->con, $sql);
     if ($query === false) {
         if (odbc_errormsg() !== $ignore_message) {
             throw new Exception("Query error: " . odbc_error() . ": " . odbc_errormsg() . "\nSQL:\n" . $sql);
         }
     } else {
         odbc_free_result($query);
     }
 }
开发者ID:wistoft,项目名称:BST,代码行数:14,代码来源:gybala.php

示例15: handleAutoIncrementedValue

 /**
  * Will grab the auto incremented value from the last query (if one exists)
  * 
  * @param  fResult $result  The result object for the query
  * @return void
  */
 private function handleAutoIncrementedValue($result)
 {
     if (!preg_match('#^\\s*INSERT\\s+INTO\\s+(?:`|"|\\[)?(\\w+)(?:`|"|\\])?#i', $result->getSQL(), $table_match)) {
         $result->setAutoIncrementedValue(NULL);
         return;
     }
     $table = strtolower($table_match[1]);
     $insert_id = NULL;
     if ($this->type == 'oracle') {
         if (!isset($this->schema_info['sequences'])) {
             $sql = "SELECT\r\n\t\t\t\t\t\t\t\tTABLE_NAME,\r\n\t\t\t\t\t\t\t\tTRIGGER_BODY\r\n\t\t\t\t\t\t\tFROM\r\n\t\t\t\t\t\t\t\tUSER_TRIGGERS\r\n\t\t\t\t\t\t\tWHERE\r\n\t\t\t\t\t\t\t\tTRIGGERING_EVENT = 'INSERT' AND\r\n\t\t\t\t\t\t\t\tSTATUS = 'ENABLED' AND\r\n\t\t\t\t\t\t\t\tTRIGGER_NAME NOT LIKE 'BIN\$%'";
             $this->schema_info['sequences'] = array();
             foreach ($this->query($sql) as $row) {
                 if (preg_match('#SELECT\\s+(\\w+).nextval\\s+INTO\\s+:new\\.(\\w+)\\s+FROM\\s+dual#i', $row['trigger_body'], $matches)) {
                     $this->schema_info['sequences'][strtolower($row['table_name'])] = array('sequence' => $matches[1], 'column' => $matches[2]);
                 }
             }
             if ($this->cache) {
                 $this->cache->set($this->makeCachePrefix() . 'schema_info', $this->schema_info);
             }
         }
         if (!isset($this->schema_info['sequences'][$table]) || preg_match('#INSERT\\s+INTO\\s+' . preg_quote($table, '#') . '\\s+\\([^\\)]*?\\b' . preg_quote($this->schema_info['sequences'][$table]['column'], '#') . '\\b#i', $result->getSQL())) {
             return;
         }
         $insert_id_sql = "SELECT " . $this->schema_info['sequences'][$table]['sequence'] . ".currval AS INSERT_ID FROM dual";
     }
     if ($this->type == 'postgresql') {
         if (!isset($this->schema_info['sequences'])) {
             $sql = "SELECT\r\n\t\t\t\t\t\t\t\tpg_class.relname AS table_name,\r\n\t\t\t\t\t\t\t\tpg_attribute.attname AS column\r\n\t\t\t\t\t\t\tFROM\r\n\t\t\t\t\t\t\t\tpg_attribute INNER JOIN\r\n\t\t\t\t\t\t\t\tpg_class ON pg_attribute.attrelid = pg_class.oid INNER JOIN\r\n\t\t\t\t\t\t\t\tpg_attrdef ON pg_class.oid = pg_attrdef.adrelid AND pg_attribute.attnum = pg_attrdef.adnum\r\n\t\t\t\t\t\t\tWHERE\r\n\t\t\t\t\t\t\t\tNOT pg_attribute.attisdropped AND\r\n\t\t\t\t\t\t\t\tpg_attrdef.adsrc LIKE 'nextval(%'";
             $this->schema_info['sequences'] = array();
             foreach ($this->query($sql) as $row) {
                 $this->schema_info['sequences'][strtolower($row['table_name'])] = $row['column'];
             }
             if ($this->cache) {
                 $this->cache->set($this->makeCachePrefix() . 'schema_info', $this->schema_info);
             }
         }
         if (!isset($this->schema_info['sequences'][$table]) || preg_match('#INSERT\\s+INTO\\s+' . preg_quote($table, '#') . '\\s+\\([^\\)]*?\\b' . preg_quote($this->schema_info['sequences'][$table], '#') . '\\b#i', $result->getSQL())) {
             return;
         }
     }
     if ($this->extension == 'mssql') {
         $insert_id_res = mssql_query("SELECT @@IDENTITY AS insert_id", $this->connection);
         $insert_id = mssql_result($insert_id_res, 0, 'insert_id');
         mssql_free_result($insert_id_res);
     } elseif ($this->extension == 'mysql') {
         $insert_id = mysql_insert_id($this->connection);
     } elseif ($this->extension == 'mysqli') {
         $insert_id = mysqli_insert_id($this->connection);
     } elseif ($this->extension == 'oci8') {
         $oci_statement = oci_parse($this->connection, $insert_id_sql);
         oci_execute($oci_statement);
         $insert_id_row = oci_fetch_array($oci_statement, OCI_ASSOC);
         $insert_id = $insert_id_row['INSERT_ID'];
         oci_free_statement($oci_statement);
     } elseif ($this->extension == 'odbc' && $this->type == 'mssql') {
         $insert_id_res = odbc_exec($this->connection, "SELECT @@IDENTITY AS insert_id");
         $insert_id = odbc_result($insert_id_res, 'insert_id');
         odbc_free_result($insert_id_res);
     } elseif ($this->extension == 'odbc' && $this->type == 'oracle') {
         $insert_id_res = odbc_exec($this->connection, $insert_id_sql);
         $insert_id = odbc_result($insert_id_res, 'insert_id');
         odbc_free_result($insert_id_res);
     } elseif ($this->extension == 'pgsql') {
         $insert_id_res = pg_query($this->connection, "SELECT lastval()");
         $insert_id_row = pg_fetch_assoc($insert_id_res);
         $insert_id = array_shift($insert_id_row);
         pg_free_result($insert_id_res);
     } elseif ($this->extension == 'sqlite') {
         $insert_id = sqlite_last_insert_rowid($this->connection);
     } elseif ($this->extension == 'sqlsrv') {
         $insert_id_res = sqlsrv_query($this->connection, "SELECT @@IDENTITY AS insert_id");
         $insert_id_row = sqlsrv_fetch_array($insert_id_res, SQLSRV_FETCH_ASSOC);
         $insert_id = $insert_id_row['insert_id'];
         sqlsrv_free_stmt($insert_id_res);
     } elseif ($this->extension == 'pdo') {
         switch ($this->type) {
             case 'mssql':
                 try {
                     $insert_id_statement = $this->connection->query("SELECT @@IDENTITY AS insert_id");
                     if (!$insert_id_statement) {
                         throw new Exception();
                     }
                     $insert_id_row = $insert_id_statement->fetch(PDO::FETCH_ASSOC);
                     $insert_id = array_shift($insert_id_row);
                 } catch (Exception $e) {
                     // If there was an error we don't have an insert id
                 }
                 break;
             case 'oracle':
                 try {
                     $insert_id_statement = $this->connection->query($insert_id_sql);
                     if (!$insert_id_statement) {
                         throw new Exception();
//.........这里部分代码省略.........
开发者ID:jsuarez,项目名称:MyDesign,代码行数:101,代码来源:fDatabase.php


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