本文整理汇总了PHP中ocisetprefetch函数的典型用法代码示例。如果您正苦于以下问题:PHP ocisetprefetch函数的具体用法?PHP ocisetprefetch怎么用?PHP ocisetprefetch使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ocisetprefetch函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _execute
/**
* Executes given SQL statement. This is an overloaded method.
*
* @param string $sql SQL statement
* @return resource Result resource identifier or null
* @access protected
*/
function _execute($sql)
{
$this->_statementId = @ociparse($this->connection, $sql);
if (!$this->_statementId) {
$this->_setError($this->connection);
return false;
}
if ($this->__transactionStarted) {
$mode = OCI_DEFAULT;
} else {
$mode = OCI_COMMIT_ON_SUCCESS;
}
if (!@ociexecute($this->_statementId, $mode)) {
$this->_setError($this->_statementId);
return false;
}
$this->_setError(null, true);
switch (ocistatementtype($this->_statementId)) {
case 'DESCRIBE':
case 'SELECT':
$this->_scrapeSQL($sql);
break;
default:
return $this->_statementId;
break;
}
if ($this->_limit >= 1) {
ocisetprefetch($this->_statementId, $this->_limit);
} else {
ocisetprefetch($this->_statementId, 3000);
}
$this->_numRows = ocifetchstatement($this->_statementId, $this->_results, $this->_offset, $this->_limit, OCI_NUM | OCI_FETCHSTATEMENT_BY_ROW);
$this->_currentRow = 0;
$this->limit();
return $this->_statementId;
}
示例2: _execute
/**
* Execute the query
*
* @access private called by the base class
* @param string an SQL query
* @return resource
*/
function _execute($sql)
{
// oracle must parse the query before it is run. All of the actions with
// the query are based on the statement id returned by ociparse
$this->_set_stmt_id($sql);
ocisetprefetch($this->stmt_id, 1000);
return @ociexecute($this->stmt_id, $this->_commit);
}
示例3: execute
/**
* Execute the query
*
* @access private called by the base class
* @param string an SQL query
* @return resource
*/
function execute($sql)
{
// oracle must parse the query before it
// is run, all of the actions with
// the query are based off the statement id
// returned by ociparse
$this->_set_stmt_id($sql);
ocisetprefetch($this->stmt_id, 1000);
return @ociexecute($this->stmt_id);
}
示例4: array
/**
* Executes a DB statement prepared with prepare().
*
* To determine how many rows of a result set get buffered using
* ocisetprefetch(), see the "result_buffering" option in setOptions().
* This option was added in Release 1.7.0.
*
* @param resource $stmt a DB statement resource returned from prepare()
* @param mixed $data array, string or numeric data to be used in
* execution of the statement. Quantity of items
* passed must match quantity of placeholders in
* query: meaning 1 for non-array items or the
* quantity of elements in the array.
*
* @return mixed returns an oic8 result resource for successful SELECT
* queries, DB_OK for other successful queries.
* A DB error object is returned on failure.
*
* @see DB_oci8::prepare()
*/
function &execute($stmt, $data = array())
{
$data = (array) $data;
$this->last_parameters = $data;
$this->last_query = $this->_prepared_queries[(int) $stmt];
$this->_data = $data;
$types = $this->prepare_types[(int) $stmt];
if (count($types) != count($data)) {
$tmp = $this->raiseError(DB_ERROR_MISMATCH);
return $tmp;
}
$i = 0;
foreach ($data as $key => $value) {
if ($types[$i] == DB_PARAM_MISC) {
/*
* Oracle doesn't seem to have the ability to pass a
* parameter along unchanged, so strip off quotes from start
* and end, plus turn two single quotes to one single quote,
* in order to avoid the quotes getting escaped by
* Oracle and ending up in the database.
*/
$data[$key] = preg_replace("/^'(.*)'\$/", "\\1", $data[$key]);
$data[$key] = str_replace("''", "'", $data[$key]);
} elseif ($types[$i] == DB_PARAM_OPAQUE) {
$fp = @fopen($data[$key], 'rb');
if (!$fp) {
$tmp = $this->raiseError(DB_ERROR_ACCESS_VIOLATION);
return $tmp;
}
$data[$key] = fread($fp, filesize($data[$key]));
fclose($fp);
} elseif ($types[$i] == DB_PARAM_SCALAR) {
// Floats have to be converted to a locale-neutral
// representation.
if (is_float($data[$key])) {
$data[$key] = $this->quoteFloat($data[$key]);
}
}
if (!@OCIBindByName($stmt, ':bind' . $i, $data[$key], -1)) {
$tmp = $this->oci8RaiseError($stmt);
return $tmp;
}
$this->last_query = str_replace(':bind' . $i, $this->quoteSmart($data[$key]), $this->last_query);
$i++;
}
if ($this->autocommit) {
$success = @OCIExecute($stmt, OCI_COMMIT_ON_SUCCESS);
} else {
$success = @OCIExecute($stmt, OCI_DEFAULT);
}
if (!$success) {
$tmp = $this->oci8RaiseError($stmt);
return $tmp;
}
$this->last_stmt = $stmt;
if ($this->manip_query[(int) $stmt] || $this->_next_query_manip) {
$this->_last_query_manip = true;
$this->_next_query_manip = false;
$tmp = DB_OK;
} else {
$this->_last_query_manip = false;
@ocisetprefetch($stmt, $this->options['result_buffering']);
$tmp = new DB_result($this, $stmt);
}
return $tmp;
}
示例5: array
/**
* Execute a query
* @param string $query query
* @param boolean $is_manip if the query is a manipulation query
* @param resource $connection
* @param string $database_name
* @return result or error object
* @access protected
*/
function &_doQuery($query, $is_manip = false, $connection = null, $database_name = null)
{
$this->last_query = $query;
$result = $this->debug($query, 'query', array('is_manip' => $is_manip, 'when' => 'pre'));
if ($result) {
if (PEAR::isError($result)) {
return $result;
}
$query = $result;
}
if ($this->getOption('disable_query')) {
if ($is_manip) {
return 0;
}
return null;
}
if (is_null($connection)) {
$connection = $this->getConnection();
if (PEAR::isError($connection)) {
return $connection;
}
}
$result = @OCIParse($connection, $query);
if (!$result) {
$err = $this->raiseError(null, null, null, 'Could not create statement', __FUNCTION__);
return $err;
}
$mode = $this->in_transaction ? OCI_DEFAULT : OCI_COMMIT_ON_SUCCESS;
if (!@OCIExecute($result, $mode)) {
$err =& $this->raiseError($result, null, null, 'Could not execute statement', __FUNCTION__);
return $err;
}
if (is_numeric($this->options['result_prefetching'])) {
@ocisetprefetch($result, $this->options['result_prefetching']);
}
$this->debug($query, 'query', array('is_manip' => $is_manip, 'when' => 'post', 'result' => $result));
return $result;
}
示例6: _stored_execute
function _stored_execute($sql, $params)
{
// oracle must parse the query before it is run. All of the actions with
// the query are based on the statement id returned by ociparse
$this->stmt_id = FALSE;
$this->_set_stmt_id($sql);
//begin modification
if (!$this->stmt_id) {
$e = oci_error($this->stmt_id);
log_message('error', $e['message']);
return FALSE;
}
if ($this->binds !== FALSE) {
//print_r("binding parameters");
$this->_bind_params($params);
}
ocisetprefetch($this->stmt_id, 1000);
$exec_worked = ociexecute($this->stmt_id, $this->_commit);
if ($exec_worked === FALSE) {
// if ociexecute failed, grab the oracle error message and log it
$e = oci_error($this->stmt_id);
log_message('error', $e['message']);
}
return $exec_worked;
//@ociexecute($this->stmt_id, $this->_commit);
//end modification
}
示例7: _prep_query
/**
* Prepare the query
* Only if Oracle Type
*
* @access protected
* @return string
* @see self::execute()
*/
function _prep_query($sQuery)
{
if (true === $this->_bPrefetch) {
@ocisetprefetch($this->stmt_id, $this->_iPrefetch);
}
if (count($this->aInputBinds) + count($this->aOutputBinds) > 0) {
if (is_resource($this->stmt_id)) {
// Append Data to collection
reset($this->aInputBinds);
for ($iBind = 0, $iMaxi = count($this->aInputBinds); $iBind < $iMaxi; $iBind++) {
if (false === $this->_setInputBind(current($this->aInputBinds))) {
return false;
} else {
next($this->aInputBinds);
}
}
// Append Data to collection
reset($this->aOutputBinds);
for ($iBind = 0, $iMaxi = count($this->aOutputBinds); $iBind < $iMaxi; $iBind++) {
$aBind = current($this->aOutputBinds);
if (false === $this->_setOutputBind($aBind)) {
return false;
} else {
$this->aOutputBinds[key($this->aOutputBinds)] = $aBind;
next($this->aOutputBinds);
}
}
}
}
}
示例8: ocidefinebyname
ocidefinebyname();
ocierror();
ociexecute();
ocifetch();
ocifetchinto();
ocifetchstatement();
ocifreecollection();
ocifreecursor();
ocifreedesc();
ocifreestatement();
ociinternaldebug();
ociloadlob();
ocilogoff();
ocilogon();
ocinewcollection();
ocinewcursor();
ocinewdescriptor();
ocinlogon();
ocinumcols();
ociparse();
ociplogon();
ociresult();
ocirollback();
ocirowcount();
ocisavelob();
ocisavelobfile();
ociserverversion();
ocisetprefetch();
ocistatementtype();
ociwritelobtofile();
ociwritetemporarylob();