• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP odbc_free_result函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: free

 /**
  * Free the memory used by the result resource
  *
  * @return void
  */
 public function free()
 {
     switch ($this->mode) {
         case "mysql":
             $this->result->free();
             break;
         case "postgres":
         case "redshift":
             pg_free_result($this->result);
             break;
         case "odbc":
             odbc_free_result($this->result);
             break;
         case "sqlite":
             $this->result->finalize();
             break;
         case "mssql":
             mssql_free_result($this->result);
             break;
     }
 }
开发者ID:ian-Tr,项目名称:le-huard,代码行数:26,代码来源:Result.php


示例17: FreeResult

 /**
  * @return	bool
  */
 function FreeResult()
 {
     if ($this->_resultId) {
         if (!@odbc_free_result($this->_resultId)) {
             $this->_setSqlError();
             return false;
         } else {
             $this->_resultId = null;
         }
         return true;
     } else {
         return true;
     }
 }
开发者ID:JDevelopers,项目名称:Mail,代码行数:17,代码来源:class_dbodbc.php


示例18: sql_free_result

function sql_free_result($res)
{
    global $dbtype;
    switch ($dbtype) {
        case "MySQL":
            $row = mysql_free_result($res);
            return $row;
            break;
        case "mSQL":
            $row = msql_free_result($res);
            return $row;
            break;
        case "postgres":
        case "postgres_local":
            $rows = pg_FreeResult($res->get_result());
            return $rows;
            break;
        case "ODBC":
        case "ODBC_Adabas":
            $rows = odbc_free_result($res);
            return $rows;
            break;
        case "Interbase":
            echo "<BR>Error! PHP dosen't support ibase_numrows!<BR>";
            return $rows;
            break;
        case "Sybase":
            $rows = sybase_free_result($res);
            return $rows;
            break;
    }
}
开发者ID:BackupTheBerlios,项目名称:domsmod-svn,代码行数:32,代码来源:sql_layer.php


示例19: sql_freeresult

 function sql_freeresult($query_id = 0)
 {
     if (!$query_id) {
         $query_id = $this->query_result;
     }
     if ($query_id) {
         $result = @odbc_free_result($query_id);
         return $result;
     } else {
         return false;
     }
 }
开发者ID:nmpetkov,项目名称:ZphpBB2,代码行数:12,代码来源:db2.php


示例20: _sql_report

 /**
  * Build db-specific report
  * @access private
  */
 function _sql_report($mode, $query = '')
 {
     switch ($mode) {
         case 'start':
             break;
         case 'fromcache':
             $endtime = explode(' ', microtime());
             $endtime = $endtime[0] + $endtime[1];
             $result = @odbc_exec($this->db_connect_id, $query);
             while ($void = @odbc_fetch_array($result)) {
                 // Take the time spent on parsing rows into account
             }
             @odbc_free_result($result);
             $splittime = explode(' ', microtime());
             $splittime = $splittime[0] + $splittime[1];
             $this->sql_report('record_fromcache', $query, $endtime, $splittime);
             break;
     }
 }
开发者ID:Grprashanthkumar,项目名称:ColfusionWeb,代码行数:23,代码来源:mssql_odbc.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP odbc_longreadlen函数代码示例发布时间:2022-05-15
下一篇:
PHP odbc_field_len函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap