本文整理汇总了PHP中OCIFreeStatement函数的典型用法代码示例。如果您正苦于以下问题:PHP OCIFreeStatement函数的具体用法?PHP OCIFreeStatement怎么用?PHP OCIFreeStatement使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了OCIFreeStatement函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: uploadImageData
function uploadImageData($db, $file, $currentPictureId, $table, $id)
{
// insert the new record into the media's table and load the
// corresponding blob with the media's data
// (we use oracle's pseudo column rowid which identifies a row
// within a table (but not within a database) to refer to the
// right record later on)
$sql = "DECLARE\n obj ORDSYS.ORDImage;\n iblob BLOB;\n BEGIN\n SELECT image INTO obj FROM {$table}\n WHERE {$id} = {$currentPictureId} FOR UPDATE;\n\n iblob := obj.source.localData;\n :extblob := iblob;\n\n UPDATE {$table} SET image = obj WHERE {$id} = {$currentPictureId};\n END;";
// the function OCINewDescriptor allocates storage to hold descriptors or
// lob locators.
// see http://www.php.net/manual/en/function.ocinewdescriptor.php
$blob = OCINewDescriptor($db, OCI_D_LOB);
$sql = strtr($sql, chr(13) . chr(10), " ");
$stmt = OCIParse($db, $sql);
// the function OCIBindByName binds a PHP variable to a oracle placeholder
// (whether the variable will be used for input or output will be determined
// run-time, and the necessary storage space will be allocated)
// see http://www.php.net/manual/en/function.ocibindbyname.php
OCIBindByName($stmt, ':extblob', $blob, -1, OCI_B_BLOB);
echo "{$this->log} - {$sql} <br />";
OCIExecute($stmt, OCI_DEFAULT);
// read the files data and load it into the blob
$blob->savefile($file);
OCIFreeStatement($stmt);
$blob->free();
}
示例2: add_image
function add_image($name, $imagetype, $file)
{
if (!is_null($file)) {
if ($file["error"] != 0 || $file["size"] == 0) {
error("Incorrect Image");
} else {
if ($file["size"] < 1024 * 1024) {
global $DB;
$imageid = get_dbid("images", "imageid");
$image = fread(fopen($file["tmp_name"], "r"), filesize($file["tmp_name"]));
if ($DB['TYPE'] == "ORACLE") {
DBstart();
$lobimage = OCINewDescriptor($DB['DB'], OCI_D_LOB);
$stid = OCIParse($DB['DB'], "insert into images (imageid,name,imagetype,image)" . " values ({$imageid}," . zbx_dbstr($name) . "," . $imagetype . ",EMPTY_BLOB())" . " return image into :image");
if (!$stid) {
$e = ocierror($stid);
error("Parse SQL error [" . $e["message"] . "] in [" . $e["sqltext"] . "]");
return false;
}
OCIBindByName($stid, ':image', $lobimage, -1, OCI_B_BLOB);
if (!OCIExecute($stid, OCI_DEFAULT)) {
$e = ocierror($stid);
error("Execute SQL error [" . $e["message"] . "] in [" . $e["sqltext"] . "]");
return false;
}
$result = DBend($lobimage->save($image));
if (!$result) {
error("Couldn't save image!\n");
return false;
}
$lobimage->free();
OCIFreeStatement($stid);
return $stid;
} else {
if ($DB['TYPE'] == "POSTGRESQL") {
$image = pg_escape_bytea($image);
} else {
if ($DB['TYPE'] == "SQLITE3") {
$image = bin2hex($image);
}
}
}
return DBexecute("insert into images (imageid,name,imagetype,image)" . " values ({$imageid}," . zbx_dbstr($name) . "," . $imagetype . "," . zbx_dbstr($image) . ")");
} else {
error("Image size must be less than 1Mb");
}
}
} else {
error("Select image to download");
}
return false;
}
示例3: query
/**
* Performs an SQL query.
*
* @param string $query
* @param mixed $limit
* @param boolean $warnOnFailure
* @access public
*/
function query($query, $limit = false, $warnOnFailure = true)
{
if ($limit != false) {
$query = sprintf('SELECT * FROM (%s) WHERE ROWNUM <= %d', $query, $limit);
}
if ($this->config['debug_level'] > 1) {
$this->debugQuery($query);
}
@OCIFreeStatement($this->result);
$this->result = @OCIParse($this->connection, $query);
if (!$this->result) {
$error = OCIError($this->result);
phpOpenTracker::handleError($error['code'] . $error['message'], E_USER_ERROR);
}
@OCIExecute($this->result);
if (!$this->result && $warnOnFailure) {
$error = OCIError($this->result);
phpOpenTracker::handleError($error['code'] . $error['message'], E_USER_ERROR);
}
}
示例4: sql_freeresult
function sql_freeresult($query_id = 0)
{
if (!$query_id) {
$query_id = $this->query_result;
}
if ($query_id) {
$result = @OCIFreeStatement($query_id);
return $result;
} else {
return false;
}
}
示例5: getRecords
/**
* This function will execute the SQL statement and return the records as an associative array. Optionally, you
* can limit the number of records that are returned. Optionally, you can also specify which record to start
* from.
*
* @param $sql The SQL statement to use.
* @param $limit (optional) How many records to return
* @param $offset (optional) Where to start from
*
* @returns The records matching the SQL statement as an associative array.
*/
function getRecords($sql, $limit = -1, $offset = -1)
{
$sql = $this->_prepareSqlForLimit($sql, $limit, $offset);
$result = $this->_connectAndExec($sql);
$type = YDConfig::get('YD_DB_FETCHTYPE') == YD_DB_FETCH_NUM ? OCI_NUM : OCI_ASSOC;
$dataset = array();
while (ocifetchinto($result, $line, $type)) {
array_push($dataset, $this->_lowerKeyNames($line));
}
OCIFreeStatement($result);
return $dataset;
}
示例6: getRecords
/**
* This function will execute the SQL statement and return the records as an associative array.
*
* @param $sql The SQL statement to use.
*
* @returns The records matching the SQL statement as an associative array.
*/
function getRecords($sql)
{
$result = $this->_connectAndExec($sql);
$dataset = array();
while (ocifetchinto($result, $line, OCI_ASSOC)) {
array_push($dataset, $this->_lowerKeyNames($line));
}
OCIFreeStatement($result);
return $dataset;
}
示例7: GetLastInsertID
function GetLastInsertID($sTable)
{
if (!($res = OCIParse($this->conn, "select currval(seq_{$sTable})"))) {
trigger_error("Error parsing insert ID query!");
return $this->ReportError($this->conn);
}
if (OCIExecute($res)) {
@OCIFetchInto($res, $Record, OCI_NUM | OCI_ASSOC | OCI_RETURN_NULLS);
@OCIFreeStatement($res);
return $Record[0];
}
trigger_error("Error executing insert ID query!");
return $this->ReportError($res);
}
示例8: write
public function write($id, $data)
{
$query = "MERGE INTO " . self::$_table["saveHandler"]["options"]["name"] . " M ";
$query .= "USING (SELECT '" . $id . "' AS ID, :TIME AS LIFETIME, :DADOS AS DATAVAL FROM DUAL) N ";
$query .= "ON (M." . self::$_table["saveHandler"]["options"]["primary"][0] . " = N.ID ) ";
$query .= "WHEN MATCHED THEN ";
$query .= "UPDATE SET M." . self::$_table["saveHandler"]["options"]["lifetimeColumn"] . " = N.LIFETIME, ";
$query .= "M." . self::$_table["saveHandler"]["options"]["dataColumn"] . " = N.DATAVAL ";
$query .= "WHEN NOT MATCHED THEN INSERT( " . self::$_table["saveHandler"]["options"]["primary"][0] . ", ";
$query .= self::$_table["saveHandler"]["options"]["lifetimeColumn"] . ", ";
$query .= self::$_table["saveHandler"]["options"]["dataColumn"] . " ) ";
$query .= "VALUES(N.ID, N.LIFETIME, N.DATAVAL) ";
$stmt = OCIParse(self::$_db, $query);
$clob = OCINewDescriptor(self::$_db, OCI_D_LOB);
OCIBindByName($stmt, ':TIME', time());
OCIBindByName($stmt, ':DADOS', $clob, -1, OCI_B_CLOB);
$clob->WriteTemporary($data, OCI_TEMP_CLOB);
$exe = OCIExecute($stmt, OCI_DEFAULT);
if ($exe === true) {
$ret = true;
OCICommit(self::$_db);
} else {
$ret = false;
OCIRollback(self::$_db);
}
$clob->close();
$clob->free();
OCIFreeStatement($stmt);
return $ret;
}
示例9: DBCloseConnection
function DBCloseConnection($statement)
{
// Libera todos los recursos asociados a la sentencia..
OCIFreeStatement($statement);
}
示例10: OCIParse
// create SQL statement
$sql = "Select * from Classes";
// parse SQL statement
$sql_statement = OCIParse($conn, $sql);
// execute SQL query
OCIExecute($sql_statement);
// get number of columns for use later
$num_columns = OCINumCols($sql_statement);
// start results formatting
echo "<TABLE BORDER=1>";
echo "<TR><TH>SCU Core Class</TH><TH>Alternate Class</TH><TH>University</TH></TR>";
// format results by row
while (OCIFetch($sql_statement)) {
echo "<TR>";
for ($i = 1; $i <= $num_columns; $i++) {
$column_value = OCIResult($sql_statement, $i);
echo "<TD>{$column_value}</TD>";
}
echo "</TR>";
}
echo "</TABLE>";
OCIFreeStatement($sql_statement);
OCILogoff($conn);
?>
<html>
<head>
<title>Step 1</title>
</head>
<body>
</body>
</html>
示例11: ocilogon
$username = $_POST['username'];
$password = $_POST['pwd'];
if ($password == null) {
echo '<font color="' . red . '">Password cannot be blank. Please enter a valid password</font>';
echo "<br/><br/>";
echo "<a href='http://uisacad.uis.edu/~kmulpu2/PasswordReset.html'>Back To Password Reset Page</a>";
exit;
}
$connection = ocilogon("tanis2", "oracle", "oracle.uis.edu");
$sqlquery = "UPDATE CREDENTIALS SET password='" . $password . "' WHERE username='" . $username . "'";
$sql_id = ociparse($connection, $sqlquery);
if (!$sql_id) {
$e = oci_error($connection);
echo "The following error occured:";
print htmlentities($e['message']);
exit;
}
$returnValue = ociexecute($sql_id, OCI_DEFAULT);
if ($returnValue == 1) {
echo '<font color="' . blue . '">Password was reset successfully</font>';
ocicommit($connection);
echo "<br/><br/>";
echo "<a href='http://uisacad.uis.edu/~kmulpu2/DillardsReporting.html'>Back To Login Page</a>";
} else {
echo '<font color="' . red . '">Unable to reset password due to server issues. Please try again later</font>';
}
OCIFreeStatement($sql_id);
OCILogoff($connection);
?>
</body>
</html>
示例12: _close
function _close()
{
if ($this->connection->_stmt === $this->_queryID) {
$this->connection->_stmt = false;
}
if (!empty($this->_refservicior)) {
OCIFreeServicior($this->_refservicior);
$this->_refservicior = false;
}
@OCIFreeStatement($this->_queryID);
$this->_queryID = false;
}
示例13: result
/** returns array of assoc array's */
function result($stmt = FALSE, $from = FALSE, $to = FALSE)
{
if (!$stmt) {
$stmt = $this->stmt;
}
$result = array();
if (!$from && !$to) {
while (@ocifetchinto($stmt, $arr, OCI_ASSOC + OCI_RETURN_NULLS)) {
$result[] = $arr;
}
} else {
$counter = 0;
while (@ocifetchinto($stmt, $arr, OCI_ASSOC + OCI_RETURN_NULLS)) {
if ($counter >= $from && $counter <= $to) {
$result[] = $arr;
}
$counter++;
}
}
@OCIFreeStatement($stmt);
return $result;
}
示例14: dbi_free_result
function dbi_free_result($res)
{
if ($res === true) {
// Not needed for UPDATE, DELETE, etc
return;
}
if (strcmp($GLOBALS['db_type'], 'mysql') == 0) {
return mysql_free_result($res);
} elseif (strcmp($GLOBALS['db_type'], 'mysqli') == 0) {
return mysqli_free_result($res);
} elseif (strcmp($GLOBALS['db_type'], 'mssql') == 0) {
return mssql_free_result($res);
} elseif (strcmp($GLOBALS['db_type'], 'oracle') == 0) {
// Not supported. Ingore.
if ($GLOBALS['oracle_statement'] >= 0) {
OCIFreeStatement($GLOBALS['oracle_statement']);
$GLOBALS['oracle_statement'] = -1;
}
} elseif (strcmp($GLOBALS['db_type'], 'postgresql') == 0) {
return pg_freeresult($res);
} elseif (strcmp($GLOBALS['db_type'], 'odbc') == 0) {
return odbc_free_result($res);
} elseif (strcmp($GLOBALS['db_type'], 'ibm_db2') == 0) {
return db2_free_result($res);
} elseif (strcmp($GLOBALS['db_type'], 'ibase') == 0) {
return ibase_free_result($res);
} elseif (strcmp($GLOBALS['db_type'], 'sqlite') == 0) {
// Not supported
} else {
dbi_fatal_error('dbi_free_result (): ' . translate('db_type not defined.'));
}
}
示例15: oci_fetch_array
//execute SQL statement
$row = oci_fetch_array($objQuery, OCI_ASSOC);
if ($row !== null) {
//test for an empty return
echo "fname:" . $row[0];
$fname = "";
if ($row["obs_photo"]) {
$fname = PATH_ROOT . "\\species\\t_" . $row["obs_photo"];
} else {
if ($row["lscape_photo"]) {
$fname = PATH_ROOT . "\\landscape\\t_" . $row["lscape_photo"];
}
}
echo "fname:" . $row;
echo "fname:" . $row["lscape_photo"];
OCIFreeStatement($objQuery);
if ($fname != "") {
//Header('Content-Type: image/jpeg');
//readfile($fname);
echo $fname;
}
} else {
$Error = "the system cannot find the file";
//error in query
}
} else {
$Error = "failed to connect to the database";
//error in connection
}
} else {
$Error = "missing parameter in querystring";