本文整理汇总了PHP中ocifreestatement函数的典型用法代码示例。如果您正苦于以下问题:PHP ocifreestatement函数的具体用法?PHP ocifreestatement怎么用?PHP ocifreestatement使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ocifreestatement函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: db_closequery
function db_closequery($qhandle)
{
if(function_exists("oci_free_statement"))
oci_free_statement($qhandle);
else
ocifreestatement($qhandle);
}
示例2: free_result
function free_result()
{
@ocifreestatement($this->Query_ID);
$this->Query_ID = 0;
}
示例3: _free
function _free()
{
return ocifreestatement($this->_idResult);
}
示例4: array
function &metaColumns($table, $normalize = true)
{
static $typeMap = array('VARCHAR' => 'C', 'VARCHAR2' => 'C', 'CHAR' => 'C', 'VARBINARY' => 'C', 'BINARY' => 'C', 'NCHAR' => 'C', 'NVARCHAR' => 'C', 'NVARCHAR2' => 'C', 'NCLOB' => 'X', 'LONG' => 'X', 'LONG VARCHAR' => 'X', 'CLOB' => 'X', 'LONG RAW' => 'B', 'LONG VARBINARY' => 'B', 'BLOB' => 'B', 'DATE' => 'D', 'TIMESTAMP' => 'T', 'INT' => 'I', 'SMALLINT' => 'I', 'INTEGER' => 'I');
$arr = explode('.', $table);
$table = $this->qstr(strtoupper($arr[count($arr) - 1]));
$stmt = $this->execute(sprintf($this->META_COLUMNS_SQL, $table));
if (!$stmt) {
return false;
}
$retarr = array();
$row = array();
while (ocifetchinto($stmt, $row, OCI_NUM)) {
$field = array();
if ($this->RESULT_FIELD_NAME_LOWER) {
$field['name'] = strtolower($row[0]);
} else {
$field['name'] = $row[0];
}
$field['type'] = preg_replace('/\\([0-9]+\\)/', '', $row[1]);
$field['maxLength'] = $row[2];
$field['scale'] = isset($row[3]) ? $row[3] : null;
if ($field['type'] == 'NUMBER') {
if ($field['scale'] == 0) {
$field['type'] = 'INT';
}
$field['maxLength'] = isset($row[4]) ? $row[4] : null;
}
$field['notNull'] = strncmp($row[5], 'NOT', 3) === 0;
$field['binary'] = strpos($field['type'], 'BLOB') !== false;
$field['hasDefault'] = isset($row[6]);
$field['defaultValue'] = isset($row[6]) ? $row[6] : null;
$t = strtoupper($field['type']);
if (isset($typeMap[$t])) {
$field['simpleType'] = $typeMap[$t];
} else {
$field['simpleType'] = 'N';
}
$field['autoIncrement'] = false;
$field['primaryKey'] = false;
if ($normalize) {
$retarr[strtoupper($field['name'])] = $field;
} else {
$retarr[$field['name']] = $field;
}
}
ocifreestatement($stmt);
// 确定主键字段
$ptab = 'USER_';
$sql = "SELECT /*+ RULE */ distinct b.column_name FROM {$ptab}CONSTRAINTS a, {$ptab}CONS_COLUMNS b WHERE ( UPPER(b.table_name) = ({$table})) AND (UPPER(a.table_name) = ({$table}) and a.constraint_type = 'P') AND (a.constraint_name = b.constraint_name)";
$stmt = $this->execute($sql);
if ($stmt) {
$row = array();
while (ocifetchinto($stmt, $row, OCI_NUM)) {
$pkname = strtoupper($row[0]);
if (isset($retarr[$pkname])) {
$retarr[$pkname]['primaryKey'] = true;
if ($retarr[$pkname]['type'] == 'INT') {
$retarr[$pkname]['simpleType'] = 'R';
}
}
}
ocifreestatement($stmt);
}
return $retarr;
}
示例5: addLogService
function addLogService($log, $idTrans = NULL)
{
$isNew = FALSE;
if (empty($idTrans)) {
$isNew = TRUE;
$idTrans = $this->ora_get_sequence('SC_TRANS_KOMUNIKASI_DATA_WS');
}
// Create connection to Oracle
$userDb = $this->db->username;
$passDb = $this->db->password;
$hostname = $this->db->hostname;
$conn = oci_connect($userDb, $passDb, $hostname);
if ($conn) {
if ($isNew == FALSE) {
/*
* update
*/
$query = "UPDATE TRANS_KOMUNIKASI_DATA_WS\n SET \n TKDW_PARAMETER = '" . $log['TKDW_PARAMETER'] . "',\n TKDW_STATUS = '" . $log['TKDW_STATUS'] . "',\n TKDW_LASTUPDATE = SYSDATE,\n TKDW_DATA = :TKDW_DATA,\n TKDW_RESULT = :TKDW_RESULT\n WHERE TKDW_ID = {$idTrans}\n ";
$stmt = OCIParse($conn, $query);
OCIBindByName($stmt, ':TKDW_DATA', $log['TKDW_DATA']);
OCIBindByName($stmt, ':TKDW_RESULT', $log['TKDW_RESULT']);
OCIExecute($stmt);
ocifreestatement($stmt);
} else {
/*
* insert baru
*/
$query = "INSERT INTO TRANS_KOMUNIKASI_DATA_WS \n (\n TKDW_ID, \n TKDW_NAMA_WS, \n TKDW_ALAMAT_SERVER, \n TKDW_PARAMETER, \n TKDW_STATUS, \n TKDW_TANGGAL, \n TKDW_LASTUPDATE, \n TKDW_USERUPDATE, \n TKDW_DATA, \n TKDW_RESULT\n )\n VALUES (\n {$idTrans}, \n '" . $log['TKDW_NAMA_WS'] . "', \n '" . $log['TKDW_ALAMAT_SERVER'] . "', \n '" . $log['TKDW_PARAMETER'] . "', \n '" . $log['TKDW_STATUS'] . "', \n SYSDATE, \n SYSDATE, \n '" . $log['TKDW_USERUPDATE'] . "', \n :TKDW_DATA, \n :TKDW_RESULT\n )";
$stmt = OCIParse($conn, $query);
OCIBindByName($stmt, ':TKDW_DATA', $log['TKDW_DATA']);
OCIBindByName($stmt, ':TKDW_RESULT', $log['TKDW_RESULT']);
OCIExecute($stmt);
ocifreestatement($stmt);
}
oci_close($conn);
return $idTrans;
} else {
// $m = oci_error();
// echo $m['message'], "\n";
return NULL;
}
}
示例6: _sql_report
/**
* Build db-specific report
* @access private
*/
function _sql_report($mode, $query = '')
{
switch ($mode) {
case 'start':
$html_table = false;
// Grab a plan table, any will do
$sql = "SELECT table_name\n\t\t\t\t\tFROM USER_TABLES\n\t\t\t\t\tWHERE table_name LIKE '%PLAN_TABLE%'";
$stmt = ociparse($this->db_connect_id, $sql);
ociexecute($stmt);
$result = array();
if (ocifetchinto($stmt, $result, OCI_ASSOC + OCI_RETURN_NULLS)) {
$table = $result['TABLE_NAME'];
// This is the statement_id that will allow us to track the plan
$statement_id = substr(md5($query), 0, 30);
// Remove any stale plans
$stmt2 = ociparse($this->db_connect_id, "DELETE FROM {$table} WHERE statement_id='{$statement_id}'");
ociexecute($stmt2);
ocifreestatement($stmt2);
// Explain the plan
$sql = "EXPLAIN PLAN\n\t\t\t\t\t\tSET STATEMENT_ID = '{$statement_id}'\n\t\t\t\t\t\tFOR {$query}";
$stmt2 = ociparse($this->db_connect_id, $sql);
ociexecute($stmt2);
ocifreestatement($stmt2);
// Get the data from the plan
$sql = "SELECT operation, options, object_name, object_type, cardinality, cost\n\t\t\t\t\t\tFROM plan_table\n\t\t\t\t\t\tSTART WITH id = 0 AND statement_id = '{$statement_id}'\n\t\t\t\t\t\tCONNECT BY PRIOR id = parent_id\n\t\t\t\t\t\t\tAND statement_id = '{$statement_id}'";
$stmt2 = ociparse($this->db_connect_id, $sql);
ociexecute($stmt2);
$row = array();
while (ocifetchinto($stmt2, $row, OCI_ASSOC + OCI_RETURN_NULLS)) {
$html_table = $this->sql_report('add_select_row', $query, $html_table, $row);
}
ocifreestatement($stmt2);
// Remove the plan we just made, we delete them on request anyway
$stmt2 = ociparse($this->db_connect_id, "DELETE FROM {$table} WHERE statement_id='{$statement_id}'");
ociexecute($stmt2);
ocifreestatement($stmt2);
}
ocifreestatement($stmt);
if ($html_table) {
$this->html_hold .= '</table>';
}
break;
case 'fromcache':
$endtime = explode(' ', microtime());
$endtime = $endtime[0] + $endtime[1];
$result = @ociparse($this->db_connect_id, $query);
$success = @ociexecute($result, OCI_DEFAULT);
$row = array();
while (@ocifetchinto($result, $row, OCI_ASSOC + OCI_RETURN_NULLS)) {
// Take the time spent on parsing rows into account
}
@ocifreestatement($result);
$splittime = explode(' ', microtime());
$splittime = $splittime[0] + $splittime[1];
$this->sql_report('record_fromcache', $query, $endtime, $splittime);
break;
}
}
示例7: fetchRow
/**
* Enter description here...
*
* @return unknown
* @access public
*/
function fetchRow()
{
if ($this->_currentRow >= $this->_numRows) {
ocifreestatement($this->_statementId);
$this->_map = null;
$this->_results = null;
$this->_currentRow = null;
$this->_numRows = null;
return false;
}
$resultRow = array();
foreach ($this->_results[$this->_currentRow] as $index => $field) {
list($table, $column) = $this->_map[$index];
if (strpos($column, ' count')) {
$resultRow[0]['count'] = $field;
} else {
$resultRow[$table][$column] = $this->_results[$this->_currentRow][$index];
}
}
$this->_currentRow++;
return $resultRow;
}
示例8: get_result
function get_result()
{
$this->rows = array();
$this->columns = array();
$this->num_rows = $this->num_fields = 0;
switch ($this->db) {
case 'MySQL':
$this->num_rows = @mysql_num_rows($this->res);
$this->num_fields = @mysql_num_fields($this->res);
while (false !== ($this->rows[] = @mysql_fetch_assoc($this->res))) {
}
@mysql_free_result($this->res);
if ($this->num_rows) {
$this->columns = @array_keys($this->rows[0]);
return 1;
}
break;
case 'MSSQL':
$this->num_rows = @mssql_num_rows($this->res);
$this->num_fields = @mssql_num_fields($this->res);
while (false !== ($this->rows[] = @mssql_fetch_assoc($this->res))) {
}
@mssql_free_result($this->res);
if ($this->num_rows) {
$this->columns = @array_keys($this->rows[0]);
return 1;
}
break;
case 'PostgreSQL':
$this->num_rows = @pg_num_rows($this->res);
$this->num_fields = @pg_num_fields($this->res);
while (false !== ($this->rows[] = @pg_fetch_assoc($this->res))) {
}
@pg_free_result($this->res);
if ($this->num_rows) {
$this->columns = @array_keys($this->rows[0]);
return 1;
}
break;
case 'Oracle':
$this->num_fields = @ocinumcols($this->res);
while (false !== ($this->rows[] = @oci_fetch_assoc($this->res))) {
$this->num_rows++;
}
@ocifreestatement($this->res);
if ($this->num_rows) {
$this->columns = @array_keys($this->rows[0]);
return 1;
}
break;
}
return 0;
}
示例9: FreeResult
function FreeResult($rsLookUp)
{
return ocifreestatement($rsLookUp);
}
示例10: _closeOutputBindCursors
/**
* @desc Close all output binds cursor that remain opened
*
* @author Eric TINOCO <e.tinoco@fotovista.com>
*
* @date 2009/04/23
* @version 1.0
*
* @return void
*
*/
function _closeOutputBindCursors()
{
if (count($this->aOutputBinds) > 0) {
foreach ($this->aOutputBinds as &$aBind) {
if ($aBind['TYPE'] === $this->_iCursorType && is_resource($aBind['VALUE'])) {
@ocifreestatement($aBind['VALUE']);
}
}
}
}
示例11: currentid
function currentid($seqname)
{
$this->connect();
$Query_ID = @ociparse($this->Link_ID, "SELECT {$seqname}.CURRVAL FROM DUAL");
@ociexecute($Query_ID);
if (@ocifetch($Query_ID)) {
$current_id = ociresult($Query_ID, "CURRVAL");
} else {
$current_id = 0;
}
ocifreestatement($Query_ID);
return $current_id;
}
示例12: sqlReport
public function sqlReport($query)
{
$sHtml = '';
$html_table = false;
// Grab a plan table, any will do
$sql = "SELECT table_name\n\t\t\t\t\tFROM USER_TABLES\n\t\t\t\t\tWHERE table_name LIKE '%PLAN_TABLE%'";
$stmt = ociparse($this->_hMaster, $sql);
ociexecute($stmt);
$result = array();
if (ocifetchinto($stmt, $result, OCI_ASSOC + OCI_RETURN_NULLS)) {
$table = $result['TABLE_NAME'];
// This is the statement_id that will allow us to track the plan
$statement_id = substr(md5($query), 0, 30);
// Remove any stale plans
$stmt2 = ociparse($this->_hMaster, "DELETE FROM {$table} WHERE statement_id='{$statement_id}'");
ociexecute($stmt2);
ocifreestatement($stmt2);
// Explain the plan
$sql = "EXPLAIN PLAN\n\t\t\t\t\t\tSET STATEMENT_ID = '{$statement_id}'\n\t\t\t\t\t\tFOR {$query}";
$stmt2 = ociparse($this->_hMaster, $sql);
ociexecute($stmt2);
ocifreestatement($stmt2);
// Get the data from the plan
$sql = "SELECT operation, options, object_name, object_type, cardinality, cost\n\t\t\t\t\t\tFROM plan_table\n\t\t\t\t\t\tSTART WITH id = 0 AND statement_id = '{$statement_id}'\n\t\t\t\t\t\tCONNECT BY PRIOR id = parent_id\n\t\t\t\t\t\t\tAND statement_id = '{$statement_id}'";
$stmt2 = ociparse($this->_hMaster, $sql);
ociexecute($stmt2);
$row = array();
while (ocifetchinto($stmt2, $row, OCI_ASSOC + OCI_RETURN_NULLS)) {
list($html_table, $sData) = Phpfox_Debug::addRow($html_table, $row);
$sHtml .= $sData;
}
ocifreestatement($stmt2);
// Remove the plan we just made, we delete them on request anyway
$stmt2 = ociparse($this->_hMaster, "DELETE FROM {$table} WHERE statement_id='{$statement_id}'");
ociexecute($stmt2);
ocifreestatement($stmt2);
}
ocifreestatement($stmt);
if ($html_table) {
$sHtml .= '</table>';
}
return $sHtml;
}
示例13: db_free_result
/**
* db_free_result() - Frees a database result properly
*
* @param string Query result set handle
*/
function db_free_result($qhandle)
{
global $sys_db_results;
unset($sys_db_results[$qhandle]);
return @ocifreestatement($qhandle);
}
示例14: freePrepared
/**
* Free the internal resources associated with a prepared query.
*
* @param $stmt oci8 statement identifier
*
* @return bool TRUE on success, FALSE if $result is invalid
*/
function freePrepared($stmt)
{
if (!is_resource($stmt)) {
return false;
}
ocifreestatement($stmt);
unset($this->prepare_tokens[(int) $stmt]);
unset($this->prepare_types[(int) $stmt]);
unset($this->manip_query[(int) $stmt]);
return true;
}
示例15: closeQuery
/**
* Free resources associated with a query result set
* @param Mixed qHanle The query handle
*/
public function closeQuery($qHanle)
{
if (function_exists("oci_free_statement")) {
oci_free_statement($qHanle);
} else {
ocifreestatement($qHanle);
}
}