本文整理匯總了PHP中oci_commit函數的典型用法代碼示例。如果您正苦於以下問題:PHP oci_commit函數的具體用法?PHP oci_commit怎麽用?PHP oci_commit使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了oci_commit函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: actualizarPassword
function actualizarPassword($newpassword, $token)
{
$conex = DataBase::getInstance();
$stid = oci_parse($conex, "UPDATE FISC_USERS SET \n\t\t\t\t\t\tpassword=:newpassword\n\t\t\t\t WHERE token=:token");
if (!$stid) {
oci_free_statement($stid);
oci_close($conex);
return false;
}
// Realizar la lógica de la consulta
oci_bind_by_name($stid, ':token', $token);
oci_bind_by_name($stid, ':newpassword', $newpassword);
$r = oci_execute($stid, OCI_NO_AUTO_COMMIT);
if (!$r) {
oci_free_statement($stid);
oci_close($conex);
return false;
}
$r = oci_commit($conex);
if (!$r) {
oci_free_statement($stid);
oci_close($conex);
return false;
}
oci_free_statement($stid);
// Cierra la conexión Oracle
oci_close($conex);
return true;
}
示例2: 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();
}
示例3: obtenerDenuncias
function obtenerDenuncias($denuncias)
{
//$ids = transformarArray($denuncias,",");
$conex = DataBase::getInstance();
foreach ($denuncias as $key => $value) {
$conex = DataBase::getInstance();
$stid = oci_parse($conex, "UPDATE FISC_DENUNCIAS SET \n\t\t\t\t\tASIGNACION=1 , ASIGNADOPOR=:sesion_cod\n\t\t\t\t\tWHERE ID_DENUNCIA=:ID");
if (!$stid) {
oci_free_statement($stid);
oci_close($conex);
return false;
}
// Realizar la lógica de la consulta
oci_bind_by_name($stid, ':ID', $value);
oci_bind_by_name($stid, ':sesion_cod', $_SESSION['USUARIO']['codigo_usuario']);
$r = oci_execute($stid, OCI_NO_AUTO_COMMIT);
if (!$r) {
oci_free_statement($stid);
oci_close($conex);
return false;
}
$r = oci_commit($conex);
if (!$r) {
oci_free_statement($stid);
oci_close($conex);
return false;
}
oci_free_statement($stid);
// Cierra la conexión Oracle
oci_close($conex);
}
return true;
}
示例4: createPicturesTableIfNeeded
function createPicturesTableIfNeeded($db)
{
$table = 'pictures';
$index = 'description_indx';
$table = strtoupper($table);
if (!$this->tableExists($db, $table)) {
$sql = "CREATE TABLE {$table} (\n picture_id int PRIMARY KEY,\n name VARCHAR2(50) NOT NULL,\n creation_date DATE,\n upload_date DATE,\n description VARCHAR2(1000),\n image ORDSYS.ORDImage,\n image_sig ORDSYS.ORDImageSignature,\n artist_fk int REFERENCES artists(artist_id),\n artist_safety_level int,\n museum_ownes_fk int REFERENCES museums(museum_id),\n museum_exhibits_fk int REFERENCES museums(museum_id),\n museum_exhibits_startdate date,\n museum_exhibits_enddate date,\n owner_fk int REFERENCES owners(owner_id)\n )";
$this->executeSql($db, $sql);
$this->createSequence($db, $table . "_seq");
}
$index = strtoupper($index);
if (!$this->indexExists($db, $index)) {
//create index for description
$sql = "begin\n ctx_ddl.create_preference('mylexer', 'BASIC_LEXER' );\n ctx_ddl.set_attribute ( 'mylexer', 'mixed_case', 'NO' );\n end;";
echo "{$this->log} - {$sql} <br />";
$stmt = oci_parse($db, $sql);
oci_execute($stmt, OCI_NO_AUTO_COMMIT);
$sql = "begin\n ctx_ddl.create_preference('mystore', 'BASIC_STORAGE');\n ctx_ddl.set_attribute('mystore', 'I_TABLE_CLAUSE', 'tablespace INDX');\n ctx_ddl.set_attribute('mystore', 'K_TABLE_CLAUSE', 'tablespace INDX');\n ctx_ddl.set_attribute('mystore', 'R_TABLE_CLAUSE', 'tablespace INDX');\n ctx_ddl.set_attribute('mystore', 'N_TABLE_CLAUSE', 'tablespace INDX');\n ctx_ddl.set_attribute('mystore', 'I_INDEX_CLAUSE', 'tablespace INDX');\n ctx_ddl.set_attribute('mystore', 'P_TABLE_CLAUSE', 'tablespace INDX');\n end;";
echo "{$this->log} - {$sql} <br />";
$stmt = oci_parse($db, $sql);
oci_execute($stmt, OCI_NO_AUTO_COMMIT);
$sql = "CREATE INDEX myIndex ON PICTURES ( DESCRIPTION )\n INDEXTYPE IS CTXSYS.CONTEXT\n PARAMETERS ( 'LEXER mylexer STORAGE mystore SYNC (ON COMMIT)' )";
echo "{$this->log} - {$sql} <br />";
$stmt = oci_parse($db, $sql);
oci_execute($stmt, OCI_NO_AUTO_COMMIT);
oci_commit($db);
}
}
示例5: commit
public function commit()
{
set_error_handler(static::getErrorHandler());
$isSuccess = oci_commit($this->resource);
restore_error_handler();
return $isSuccess;
}
示例6: Execute
/**
*Execução de comandos padrões de consulta a banco (SELECT, INSERT, UPDATE, DELETE, CREATE...)
*@name execute()
*@return ObjectQuery
**/
public function Execute($argSql, $argName = NAME_QUERY)
{
global $result;
# call the connect database method
$sqli = $this->conn->__conecta();
# instancia as variáveis
$this->sql = $argSql;
$this->name = $argName;
//echo $this->dbtype;
//exit;
if ($this->conn->typedb == "mysql") {
try {
# execute sql command
$result = $sqli->query($this->sql);
# fecha a conexão com o banco de dados
$sqli->close();
# retorno do método
return $result;
} catch (Exception $e) {
echo "<b>Erro de query: </b>" . $e->getMessage() . "\n <b>Linha: </b>" . $e->getLine() . "\n";
}
}
if ($this->conn->typedb == "oracle") {
try {
$result = oci_parse($sqli, $this->sql);
oci_execute($result);
oci_commit($sqli);
OCILogoff($sqli);
return $result;
} catch (Exception $e) {
OCILogoff($sqli);
echo "<b>Erro de query: </b>" . $e->getMessage() . "\n <b>Linha: </b>" . $e->getLine() . "\n";
}
}
}
示例7: 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>";
}
示例8: commit
public function commit()
{
if (!oci_commit($this->_dbh)) {
throw OCI8Exception::fromErrorInfo($this->errorInfo());
}
return true;
}
示例9: commit
public function commit()
{
parent::commit();
if (!oci_commit($this->link)) {
$this->set_driver_error(null, PDO::ERRMODE_EXCEPTION, 'commit');
}
$this->setAttribute(PDO::ATTR_AUTOCOMMIT, 1);
return true;
}
示例10: commit
public function commit()
{
if (!oci_commit($this->dbh)) {
$error = oci_error($this->dbh);
throw new \Exception($error['message'], $error['code']);
}
$this->executeMode = OCI_COMMIT_ON_SUCCESS;
return true;
}
示例11: commit
public function commit()
{
if (oci_commit($this->connection)) {
$this->autoCommit = true;
} else {
$e = oci_error($this->connection);
throw new Sabel_Db_Exception_Driver($e["message"]);
}
}
示例12: gagal__
function gagal__($param, $conn)
{
$sql = "DELETE FROM MART_MST_CHKOUT WHERE MART_WR_ID = '{$param}'";
$parse = oci_parse($conn, $sql);
$exe = oci_execute($parse);
if ($exe) {
oci_commit($conn);
}
}
示例13: insertRow
public function insertRow($t, $reqBody)
{
foreach ($reqBody as $req) {
$i = "INSERT INTO {$t} VALUES ('{$req->id}', null, null, '{$req->l_name}', sysdate)";
$resource = oci_parse($this->conn, $i);
oci_execute($resource, OCI_NO_AUTO_COMMIT);
}
oci_commit($this->conn);
//echo $req->id . "\n";
}
示例14: 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;
}
示例15: insert
public function insert($sql)
{
$this->last_query = $sql;
$this->stid = oci_parse($this->connection, $sql);
oci_bind_by_name($this->stid, ":ID", $id, 32);
$result = oci_execute($this->stid);
$this->affected_rows_value = oci_num_rows($this->stid);
$committed = oci_commit($this->connection);
//$commited, result from commit currently not analyzed, space for improvement
if ($result) {
return $id;
} else {
return -1;
}
}