本文整理汇总了PHP中oci_rollback函数的典型用法代码示例。如果您正苦于以下问题:PHP oci_rollback函数的具体用法?PHP oci_rollback怎么用?PHP oci_rollback使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了oci_rollback函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: insertImage
function insertImage($conn, $photo_id, $owner_name, $descriptive_info, $thumbnail, $photo)
{
$photo_blob = oci_new_descriptor($conn, OCI_D_LOB);
$thumbnail_blob = oci_new_descriptor($conn, OCI_D_LOB);
$subject = $descriptive_info[0];
$place = $descriptive_info[1];
$date_time = $descriptive_info[2];
$description = $descriptive_info[3];
$permitted = $descriptive_info[4];
$sql = 'INSERT INTO images (photo_id, owner_name, permitted, subject, place,
timing, description, thumbnail, photo) VALUES (:photoid, :ownername,
:permitted, :subject, :place, TO_DATE(:datetime, \'MM/DD/YYYY\'), :description, empty_blob(),
empty_blob()) returning thumbnail, photo into :thumbnail, :photo';
$stid = oci_parse($conn, $sql);
oci_bind_by_name($stid, ':photoid', $photo_id);
oci_bind_by_name($stid, ':ownername', $owner_name);
oci_bind_by_name($stid, ':permitted', $permitted);
oci_bind_by_name($stid, ':subject', $subject);
oci_bind_by_name($stid, ':place', $place);
oci_bind_by_name($stid, ':datetime', $date_time);
oci_bind_by_name($stid, ':description', $description);
oci_bind_by_name($stid, ':thumbnail', $thumbnail_blob, -1, OCI_B_BLOB);
oci_bind_by_name($stid, ':photo', $photo_blob, -1, OCI_B_BLOB);
$res = oci_execute($stid, OCI_DEFAULT);
if ($thumbnail_blob->save($thumbnail) && $photo_blob->save($photo)) {
oci_commit($conn);
} else {
oci_rollback($conn);
}
oci_free_statement($stid);
$photo_blob->free();
$thumbnail_blob->free();
}
示例2: uploadImage
/**
* Insert image data to database (recoreded_data and thumbnail).
* First generate an unique image id, then insert image to recoreded_data and resized image to thubnail along with
* other given data
*/
function uploadImage($conn, $sensor_id, $date_created, $description)
{
$image_id = generateId($conn, "images");
if ($image_id == 0) {
return;
}
$image2 = file_get_contents($_FILES['file_image']['tmp_name']);
$image2tmp = resizeImage($_FILES['file_image']);
$image2Thumbnail = file_get_contents($image2tmp['tmp_name']);
// encode the stream
$image = base64_encode($image2);
$imageThumbnail = base64_encode($image2Thumbnail);
$sql = "INSERT INTO images (image_id, sensor_id, date_created, description, thumbnail, recoreded_data)\n VALUES(" . $image_id . ", " . $sensor_id . ", TO_DATE('" . $date_created . "', 'DD/MM/YYYY hh24:mi:ss'), '" . $description . "', empty_blob(), empty_blob())\n RETURNING thumbnail, recoreded_data INTO :thumbnail, :recoreded_data";
$result = oci_parse($conn, $sql);
$recoreded_dataBlob = oci_new_descriptor($conn, OCI_D_LOB);
$thumbnailBlob = oci_new_descriptor($conn, OCI_D_LOB);
oci_bind_by_name($result, ":recoreded_data", $recoreded_dataBlob, -1, OCI_B_BLOB);
oci_bind_by_name($result, ":thumbnail", $thumbnailBlob, -1, OCI_B_BLOB);
$res = oci_execute($result, OCI_DEFAULT) or die("Unable to execute query");
if ($recoreded_dataBlob->save($image) && $thumbnailBlob->save($imageThumbnail)) {
oci_commit($conn);
} else {
oci_rollback($conn);
}
oci_free_statement($result);
$recoreded_dataBlob->free();
$thumbnailBlob->free();
echo "New image is added with image_id ->" . $image_id . "<br>";
}
示例3: rollBack
public function rollBack()
{
if (!oci_rollback($this->_dbh)) {
throw OCI8Exception::fromErrorInfo($this->errorInfo());
}
return true;
}
示例4: rollback
public function rollback()
{
if (oci_rollback($this->connection)) {
$this->autoCommit = true;
} else {
$e = oci_error($this->connection);
throw new Sabel_Db_Exception_Driver($e["message"]);
}
}
示例5: rollBack
public function rollBack()
{
if (!oci_rollback($this->dbh)) {
$error = oci_error($this->dbh);
throw new \Exception($error['message'], $error['code']);
}
$this->executeMode = OCI_COMMIT_ON_SUCCESS;
return true;
}
示例6: UpdateRecord
public function UpdateRecord($sql, $conn)
{
$status_update = false;
$parse = oci_parse($sql, $conn);
$execute = oci_execute($parse);
if ($execute) {
oci_commit($conn);
$status_update = true;
} else {
oci_rollback($conn);
$status_update = false . oci_error();
}
return $status_update;
}
示例7: retrieveInfoJobPostResume
function retrieveInfoJobPostResume($jobID)
{
$SelectSQL = "SELECT J.userID, J.jobTitle, J.jobID, J.status, U.name, E.companyName\n\t\t\t\t\t\tFROM Users U, employer E, Job_Post J,\n\t\t\t\t\t\t(SELECT J.userID, J.jobID\n\t\t\t\t\t\tFROM Job_Post J\n\t\t\t\t\t\tWHERE J.requiredGPA <= (SELECT R.gpa\n\t\t\t\t\t\t\t\t\t\t\t\tFROM Resume_Post R\n\t\t\t\t\t\t\t\t\t\t\t\tWHERE R.userID = :userID AND R.resumeID = :resumeID) OR J.requiredGPA IS NULL\n\t\t\t\t\t\tINTERSECT\n\t\t\t\t\t\t(\n\t\t\t\t\t\t\tSELECT J.userID, J.jobID\n\t\t\t\t\t\t\tFROM Job_Post J\n\t\t\t\t\t\t\tWHERE (J.requiredDegree = 'Bachelor') AND EXISTS (\n\t\t\t\t\t\t\t\tSELECT R.degree \n\t\t\t\t\t\t\t\tFROM Resume_Post R\n\t\t\t\t\t\t\t\tWHERE R.userID = :userID AND R.resumeID = :resumeID AND R.degree = 'Bachelor')\n\t\t\t\t\t\t\tUNION\n\t\t\t\t\t\t\tSELECT J.userID, J.jobID\n\t\t\t\t\t\t\tFROM Job_Post J\n\t\t\t\t\t\t\tWHERE (J.requiredDegree = 'Bachelor' OR J.requiredDegree = 'Master') AND EXISTS (\n\t\t\t\t\t\t\t\tSELECT R.degree \n\t\t\t\t\t\t\t\tFROM Resume_Post R\n\t\t\t\t\t\t\t\tWHERE R.userID = :userID AND R.resumeID = :resumeID AND R.degree = 'Master')\n\t\t\t\t\t\t\tUNION\n\t\t\t\t\t\t\tSELECT J.userID, J.jobID\n\t\t\t\t\t\t\tFROM Job_Post J\n\t\t\t\t\t\t\tWHERE (J.requiredDegree = 'Bachelor' OR J.requiredDegree = 'Master' OR J.requiredDegree = 'Doctorate') AND EXISTS (\n\t\t\t\t\t\t\t\tSELECT R.degree \n\t\t\t\t\t\t\t\tFROM Resume_Post R\n\t\t\t\t\t\t\t\tWHERE R.userID = :userID AND R.resumeID = :resumeID AND R.degree = 'Doctorate')\n\t\t\t\t\t\t\tUNION\n\t\t\t\t\t\t\tSELECT J.userID, J.jobID\n\t\t\t\t\t\t\tFROM Job_Post J\n\t\t\t\t\t\t\tWHERE J.requiredDegree IS NULL\n\t\t\t\t\t\t)\n\t\t\t\t\t\tINTERSECT\n\t\t\t\t\t\tSELECT J.userID, J.jobID\n\t\t\t\t\t\tFROM Job_Post J\n\t\t\t\t\t\tWHERE NOT EXISTS(\n\t\t\t\t\t\t\t(SELECT JRS.skill_ID \n\t\t\t\t\t\t\t FROM Job_Require_Skill JRS\n\t\t\t\t\t\t\t WHERE JRS.jobID = J.jobID AND JRS.userID = J.userID)\n\t\t\t\t\t\t\t MINUS(\n\t\t\t\t\t\t\t SELECT RHS.skill_ID\n\t\t\t\t\t\t\t FROM Resume_Have_Skill RHS, Job_Require_Skill JRS\n\t\t\t\t\t\t\t WHERE RHS.userID = :userID AND RHS.resumeID = :resumeID AND JRS.jobID = J.jobID AND JRS.userID = J.userID \n\t\t\t\t\t\t\t\t\tAND JRS.skill_ID = RHS.skill_ID AND (JRS.knowledgeLevel <= RHS.knowledgeLevel OR JRS.knowledgeLevel IS NULL)))\n\t\t\t\t\t\tMINUS\n\t\t\t\t\t\tSELECT J.job_post_userID, J.jobID\n\t\t\t\t\t\tFROM JobSeeker_Apply_Job J\n\t\t\t\t\t\tWHERE J.userID = :userID\n\t\t\t\t\t\t) AllowedJob\n\t\t\t\t\t\tWHERE J.status = '1' AND AllowedJob.userID = J.userID AND AllowedJob.jobID = J.jobID AND J.userID = U.userID AND U.userID = E.userID";
// Connect to database
$stid = oci_parse($conn, $SelectSQL);
oci_bind_by_name($stid, ":userID", $userID);
oci_bind_by_name($stid, ":resumeID", $resumeID);
// Execute and Check Errors
oci_execute($stid);
$err = oci_error($stid);
if ($err) {
oci_rollback($conn);
$err_code = $err['code'];
$error_msg = "CANDIDATE JOB ERROR. Some unknown database error occurred. Please inform database administrator with these error messages.<br>\n" . "Error code : " . $err['code'] . "<br>" . "Error message : " . $err['message'] . "<br>";
echo $error_msg;
}
return $stid;
}
示例8: ajouterContenu
public function ajouterContenu($id_fichier, $contenu)
{
$sql = "INSERT INTO CONTENU(ID_FICHIER,CONTENU) VALUES ({$id_fichier}, EMPTY_CLOB())\n RETURNING CONTENU INTO :CONTENU_loc";
$conn = oci_connect("DBA_PARAPHEUR", "12345678", "XE");
$stmt = oci_parse($conn, $sql);
// Creates an "empty" OCI-Lob object to bind to the locator
$clob = oci_new_descriptor($conn, OCI_D_LOB);
// Bind the returned Oracle LOB locator to the PHP LOB object
oci_bind_by_name($stmt, ":CONTENU_loc", $clob, -1, OCI_B_CLOB);
// Execute the statement using , OCI_DEFAULT - as a transaction
oci_execute($stmt, OCI_DEFAULT) or die("Unable to execute query\n");
// Now save a value to the clob
if (!$clob->save($contenu)) {
// On error, rollback the transaction
oci_rollback($conn);
} else {
// On success, commit the transaction
oci_commit($conn);
}
}
示例9: displaySkillOptionInfo
function displaySkillOptionInfo()
{
global $conn;
// Get Skill List and ID Form
$skillListSQL = "SELECT S.skillTitle, S.skill_ID FROM SKILL S";
$skillListSTID = oci_parse($conn, $skillListSQL);
// Execute and Check Errors
oci_execute($skillListSTID, OCI_DEFAULT);
$err = oci_error($skillListSTID);
if ($err) {
oci_rollback($conn);
$err_code = $err['code'];
$error_msg = "SKILL LIST RETRIEVE ERROR. Some unknown database error occurred. Please inform database administrator with these error messages.<br>\n" . "Error code : " . $err['code'] . "<br>" . "Error message : " . $err['message'] . "<br>";
echo $error_msg;
} else {
while ($row = oci_fetch_row($skillListSTID)) {
echo "<input type='hidden' name='skill[]' value='" . $row[1] . "'>";
echo "<input type='checkbox' name='skill[]' value='" . $row[1] . "'>" . $row[0];
echo "<select name='skilllevel[]'>\n\t\t\t\t\t\t<option value='0'>0</option>\n\t\t\t\t\t\t<option value='1'>1</option>\n\t\t\t\t\t\t<option value='2'>2</option>\n\t\t\t\t\t\t<option value='3'>3</option>\n\t\t\t\t\t\t<option value='4'>4</option>\n\t\t\t\t\t\t<option value='5'>5</option>\n\t\t\t\t\t\t</select>";
echo "<br>";
}
}
}
示例10: rollback_transaction
public function rollback_transaction()
{
oci_rollback($this->connection);
}
示例11: rollback
function rollback($fname = 'DatabaseOracle::rollback')
{
if ($this->mTrxLevel) {
oci_rollback($this->mConn);
$this->mTrxLevel = 0;
$this->doQuery('SET CONSTRAINTS ALL IMMEDIATE');
}
}
示例12: oci_commit
if ($parse) {
oci_commit($conn);
echo "success";
} else {
oci_rollback($conn);
echo "failed";
}
} else {
$sql = "INSERT INTO MD_PROC_DELAY_REMS(HEAD_MARK,ID,REMS,ENTRY_DATE,ENTRY_SIGN,PROC_TYPE,PROC_SUB_TYPE) values ('{$HM}','{$HMID}','{$REMS}',TO_DATE('{$REMS_DT}','MM/DD/YYYY'),'{$username}','{$PROC_TYP}','{$PROC_SUB_TYP}')";
$parse = oci_parse($conn, $sql);
oci_execute($parse);
if ($parse) {
oci_commit($conn);
echo "success";
} else {
oci_rollback($conn);
echo "failed";
}
}
break;
case 'show_md_remaks':
$HM = $_POST['HM'];
$HMID = $_POST['HMID'];
$PROC_TYP = $_POST['PROC_TYP'];
$PROC_SUB_TYP = $_POST['PROC_SUB_TYP'];
$title = $_POST['title'];
?>
<table class="table-bordered compact" width="100%">
<thead style="background-color:gray;">
<tr>
<th colspan="3" class="text-center"><?php
示例13: res_sel
function res_sel($sel, $dbcnx)
{
if (!$dbcnx) {
return null;
}
// $req = pg_query($sel) or die('echec sql : ' . pg_last_error());
// $req = pg_query($sel);
$req = ociparse($dbcnx, $sel);
// oracle
if (!oci_execute($req, OCI_DEFAULT)) {
oci_rollback($dbcnx);
$e = oci_error($req);
print "<pre><font color='red'>" . $e['sqltext'] . ': ' . $e['message'] . '</font></pre>';
$_url = "../index.php?ong=" . $_POST['ong'];
echo "<br><br><b><a href={$_url}>Retour</a></b>";
die;
}
$res = array();
$i = 0;
while ($line = oci_fetch_array($req, OCI_ASSOC + OCI_RETURN_NULLS)) {
// oracle
// while ($line = pg_fetch_array($req, null, PGSQL_ASSOC)) {
foreach ($line as $cle => $col_value) {
$res[strtolower($cle)][$i] = $col_value;
}
$i++;
}
$total_lignes = $i;
// pg_free_result($req);
oci_free_statement($req);
//oracle
// return list($res, $total_lignes);
return array('res' => $res, 'total_lignes' => $total_lignes);
}
示例14: _trans_rollback
/**
* Rollback Transaction
*
* @return bool
*/
protected function _trans_rollback()
{
$this->commit_mode = OCI_COMMIT_ON_SUCCESS;
return oci_rollback($this->conn_id);
}
示例15: registrar2
//.........这里部分代码省略.........
if (!$stid) {
echo "Desde el parse 2";
$e = oci_error($this->conex);
trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
//$e = oci_error($this->conex);
//trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
//Libera los recursos
oci_free_statement($stid);
// Cierra la conexión Oracle
oci_close($this->conex);
return false;
}
// Realizar la lógica de la consulta
oci_bind_by_name($stid, ':id_den', $id_den);
oci_bind_by_name($stid, ':id_ciu', $id_ciu);
oci_bind_by_name($stid, ':rif', $rif);
oci_bind_by_name($stid, ':mot', $motivo);
oci_bind_by_name($stid, ':sts', $sts);
oci_bind_by_name($stid, ':fec', $fecha);
oci_bind_by_name($stid, ':descrip', $descripcion);
oci_bind_by_name($stid, ':responsable', $responsable);
//oci_bind_by_name($stid, ':apoderado', $apoderado);
/*
oci_bind_by_name($stid, ':creator', $data->__GET('createdby'));
oci_bind_by_name($stid, ':updater', $data->__GET('updatedby'));
oci_bind_by_name($stid, ':upd', $data->__GET('updatedate'));
*/
$r = oci_execute($stid, OCI_NO_AUTO_COMMIT);
if (!$r) {
echo "Desde el execute 2";
$e = oci_error($this->conex);
trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
//Revertimos los cambios
oci_rollback($this->conex);
//Libera los recursos
oci_free_statement($stid);
// Cierra la conexión Oracle
oci_close($this->conex);
return false;
}
//Libera los recursos
oci_free_statement($stid);
/*Insertando en la tabla FISC_APODERADO*/
//No ocurrió ningún fallo al insertar los datos de la denuncia
/*Insertando en la tabla FISC_DOCUMENTOS
$documentos = $data->__GET('documentos');
//$error = false;
for($i=0;$i<count($documentos);$i++)
{
$consulta = "INSERT INTO FISC_DOC_DEN(
id_denuncia,
id_documento)
values (
:id_den,:id_doc)";
$stid = oci_parse($this->conex, $consulta);
if (!$stid)
{
echo "Desde el parse 3";
$e = oci_error($this->conex);
trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
oci_rollback($this->conex);
//$error = true;
//self::eliminar($id_den);
//$e = oci_error($this->conex);