コード例 #1
0
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
0
ファイル: uploadDB.php プロジェクト: ismailmare/Photoshare
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
0
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
0
 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
0
ファイル: Oci8Connection.php プロジェクト: jpina/oci8
 public function commit()
 {
     set_error_handler(static::getErrorHandler());
     $isSuccess = oci_commit($this->resource);
     restore_error_handler();
     return $isSuccess;
 }
コード例 #6
0
 /**
  *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
0
/**
 * 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
0
 public function commit()
 {
     if (!oci_commit($this->_dbh)) {
         throw OCI8Exception::fromErrorInfo($this->errorInfo());
     }
     return true;
 }
コード例 #9
0
ファイル: oci.php プロジェクト: Deepab23/clinic
 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
0
ファイル: PdoAdapter.php プロジェクト: df-arif/df-core
 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
0
ファイル: Driver.php プロジェクト: reoring/sabel
 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
0
 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
0
 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
0
 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
0
 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;
     }
 }
コード例 #16
0
ファイル: Contenu.php プロジェクト: svast/start
 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);
     }
 }
コード例 #17
0
ファイル: config.php プロジェクト: robyirloreto/clinicamobile
 public function conectarse()
 {
     $Cn = oci_pconnect($this->udb, $this->pdb, $this->server, 'AL32UTF8');
     if (!$Cn) {
         $e = oci_error();
         trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
         return "noconex";
     } else {
         $qry = oci_parse($Cn, "alter session set NLS_TERRITORY='SPAIN'");
         $qry = oci_execute($qry);
         @oci_commit($Cn);
         $qry = oci_parse($Cn, "alter session set NLS_DATE_FORMAT='DD-MM-YYYY HH24:MI:SS'");
         $qry = oci_execute($qry, OCI_DEFAULT);
         @oci_commit($Cn);
         $qry = oci_parse($Cn, "alter session set NLS_TIMESTAMP_FORMAT='DD-MM-YYYY HH24:MI:SS'");
         $qry = oci_execute($qry, OCI_DEFAULT);
         @oci_commit($Cn);
         /* $qry = oci_parse($Cn, "alter session set NLS_NUMERIC_CHARACTERS='.,'");
            $qry = oci_execute($qry, OCI_DEFAULT);
            @oci_commit($Cn);*/
         return $Cn;
     }
     //by Robyir
 }
コード例 #18
0
function oracle_query($query, $connection)
{
    $resultMessage = "";
    $resultSet = null;
    $result = 0;
    $sth = oci_parse($connection, $query);
    if (!$sth) {
        //error de parseo.
        $e = oci_error($connection);
        $resultSet = null;
        error_log($query . ": " . htmlentities($e['message']), 0);
        return -1;
    }
    //echo $query;
    $results = oci_execute($sth, OCI_DEFAULT);
    if (!$results) {
        //error de ejecuci�n.
        $e = oci_error($sth);
        error_log($query . ":- " . htmlentities($e['message']), 0);
        return -1;
    }
    oci_commit($connection);
    return $sth;
}
コード例 #19
0
ファイル: oracleconnection.php プロジェクト: Satariall/izurit
 /**
  * Executes a query against connected database.
  * Rises SqlQueryException on any database error.
  * <p>
  * When object $trackerQuery passed then calls its startQuery and finishQuery
  * methods before and after query execution.
  *
  * @param string                            $sql Sql query.
  * @param array                             $binds Array of binds.
  * @param \Bitrix\Main\Diag\SqlTrackerQuery $trackerQuery Debug collector object.
  *
  * @return resource
  * @throws \Bitrix\Main\Db\SqlQueryException
  */
 protected function queryInternal($sql, array $binds = null, \Bitrix\Main\Diag\SqlTrackerQuery $trackerQuery = null)
 {
     $this->connectInternal();
     if ($trackerQuery != null) {
         $trackerQuery->startQuery($sql, $binds);
     }
     $result = oci_parse($this->resource, $sql);
     if (!$result) {
         if ($trackerQuery != null) {
             $trackerQuery->finishQuery();
         }
         throw new SqlQueryException("", $this->getErrorMessage($this->resource), $sql);
     }
     $executionMode = $this->transaction;
     /** @var \OCI_Lob[] $clob */
     $clob = array();
     if (!empty($binds)) {
         $executionMode = OCI_DEFAULT;
         foreach ($binds as $key => $val) {
             $clob[$key] = oci_new_descriptor($this->resource, OCI_DTYPE_LOB);
             oci_bind_by_name($result, ":" . $key, $clob[$key], -1, OCI_B_CLOB);
         }
     }
     if (!oci_execute($result, $executionMode)) {
         if ($trackerQuery != null) {
             $trackerQuery->finishQuery();
         }
         throw new SqlQueryException("", $this->getErrorMessage($result), $sql);
     }
     if (!empty($binds)) {
         if (oci_num_rows($result) > 0) {
             foreach ($binds as $key => $val) {
                 if ($clob[$key]) {
                     $clob[$key]->save($binds[$key]);
                 }
             }
         }
         if ($this->transaction == OCI_COMMIT_ON_SUCCESS) {
             oci_commit($this->resource);
         }
         foreach ($binds as $key => $val) {
             if ($clob[$key]) {
                 $clob[$key]->free();
             }
         }
     }
     if ($trackerQuery != null) {
         $trackerQuery->finishQuery();
     }
     $this->lastQueryResult = $result;
     return $result;
 }
コード例 #20
0
ファイル: db_oracle.php プロジェクト: tmlsoft/main
 public function commit_transaction()
 {
     oci_commit($this->connection);
 }
コード例 #21
0
ファイル: oci8_driver.php プロジェクト: oalkhanishvili/track2
 /**
  * Commit Transaction
  *
  * @return	bool
  */
 public function trans_commit()
 {
     if (!$this->trans_enabled) {
         return TRUE;
     }
     // When transactions are nested we only begin/commit/rollback the outermost ones
     if ($this->_trans_depth > 0) {
         return TRUE;
     }
     $this->commit_mode = OCI_COMMIT_ON_SUCCESS;
     return oci_commit($this->conn_id);
 }
コード例 #22
0
ファイル: DatabaseOracle.php プロジェクト: Tjorriemorrie/app
 function update($table, $values, $conds, $fname = 'DatabaseOracle::update', $options = array())
 {
     global $wgContLang;
     $table = $this->tableName($table);
     $opts = $this->makeUpdateOptions($options);
     $sql = "UPDATE {$opts} {$table} SET ";
     $first = true;
     foreach ($values as $col => &$val) {
         $sqlSet = $this->fieldBindStatement($table, $col, $val, true);
         if (!$first) {
             $sqlSet = ', ' . $sqlSet;
         } else {
             $first = false;
         }
         $sql .= $sqlSet;
     }
     if ($conds !== array() && $conds !== '*') {
         $conds = $this->wrapConditionsForWhere($table, $conds);
         $sql .= ' WHERE ' . $this->makeList($conds, LIST_AND);
     }
     if (($this->mLastResult = $stmt = oci_parse($this->mConn, $sql)) === false) {
         $e = oci_error($this->mConn);
         $this->reportQueryError($e['message'], $e['code'], $sql, __METHOD__);
         return false;
     }
     foreach ($values as $col => &$val) {
         $col_info = $this->fieldInfoMulti($table, $col);
         $col_type = $col_info != false ? $col_info->type() : 'CONSTANT';
         if ($val === null) {
             // do nothing ... null was inserted in statement creation
         } elseif ($col_type != 'BLOB' && $col_type != 'CLOB') {
             if (is_object($val)) {
                 $val = $val->getData();
             }
             if (preg_match('/^timestamp.*/i', $col_type) == 1 && strtolower($val) == 'infinity') {
                 $val = '31-12-2030 12:00:00.000000';
             }
             $val = $wgContLang != null ? $wgContLang->checkTitleEncoding($val) : $val;
             if (oci_bind_by_name($stmt, ":{$col}", $val) === false) {
                 $e = oci_error($stmt);
                 $this->reportQueryError($e['message'], $e['code'], $sql, __METHOD__);
                 return false;
             }
         } else {
             if (($lob[$col] = oci_new_descriptor($this->mConn, OCI_D_LOB)) === false) {
                 $e = oci_error($stmt);
                 throw new DBUnexpectedError($this, "Cannot create LOB descriptor: " . $e['message']);
             }
             if ($col_type == 'BLOB') {
                 $lob[$col]->writeTemporary($val);
                 oci_bind_by_name($stmt, ":{$col}", $lob[$col], -1, SQLT_BLOB);
             } else {
                 $lob[$col]->writeTemporary($val);
                 oci_bind_by_name($stmt, ":{$col}", $lob[$col], -1, OCI_B_CLOB);
             }
         }
     }
     wfSuppressWarnings();
     if (oci_execute($stmt, $this->execFlags()) === false) {
         $e = oci_error($stmt);
         if (!$this->ignore_DUP_VAL_ON_INDEX || $e['code'] != '1') {
             $this->reportQueryError($e['message'], $e['code'], $sql, __METHOD__);
             return false;
         } else {
             $this->mAffectedRows = oci_num_rows($stmt);
         }
     } else {
         $this->mAffectedRows = oci_num_rows($stmt);
     }
     wfRestoreWarnings();
     if (isset($lob)) {
         foreach ($lob as $lob_v) {
             $lob_v->free();
         }
     }
     if (!$this->mTrxLevel) {
         oci_commit($this->mConn);
     }
     oci_free_statement($stmt);
 }
コード例 #23
0
 /**
  * Makes sure each database and extension handles BEGIN, COMMIT and ROLLBACK 
  * 
  * @param  string &$sql          The SQL to check for a transaction query
  * @param  string $result_class  The type of result object to create
  * @return mixed  `FALSE` if normal processing should continue, otherwise an object of the type $result_class
  */
 private function handleTransactionQueries(&$sql, $result_class)
 {
     // SQL Server supports transactions, but starts then with BEGIN TRANSACTION
     if ($this->type == 'mssql' && preg_match('#^\\s*(begin|start(\\s+transaction)?)\\s*#i', $sql)) {
         $sql = 'BEGIN TRANSACTION';
     }
     $begin = FALSE;
     $commit = FALSE;
     $rollback = FALSE;
     // Track transactions since most databases don't support nesting
     if (preg_match('#^\\s*(begin|start)(\\s+(transaction|work))?\\s*$#iD', $sql)) {
         if ($this->inside_transaction) {
             throw new fProgrammerException('A transaction is already in progress');
         }
         $this->inside_transaction = TRUE;
         $begin = TRUE;
     } elseif (preg_match('#^\\s*(commit)(\\s+(transaction|work))?\\s*$#iD', $sql)) {
         if (!$this->inside_transaction) {
             throw new fProgrammerException('There is no transaction in progress');
         }
         $this->inside_transaction = FALSE;
         $commit = TRUE;
     } elseif (preg_match('#^\\s*(rollback)(\\s+(transaction|work))?\\s*$#iD', $sql)) {
         if (!$this->inside_transaction) {
             throw new fProgrammerException('There is no transaction in progress');
         }
         $this->inside_transaction = FALSE;
         $rollback = TRUE;
     }
     if (!$begin && !$commit && !$rollback) {
         return FALSE;
     }
     // The PDO, OCI8 and SQLSRV extensions require special handling through methods and functions
     $is_pdo = $this->extension == 'pdo';
     $is_oci = $this->extension == 'oci8';
     $is_sqlsrv = $this->extension == 'sqlsrv';
     $is_ibm_db2 = $this->extension == 'ibm_db2';
     if (!$is_pdo && !$is_oci && !$is_sqlsrv && !$is_ibm_db2) {
         return FALSE;
     }
     $this->statement = $sql;
     // PDO seems to act weird if you try to start transactions through a normal query call
     if ($is_pdo) {
         try {
             $is_mssql = $this->type == 'mssql' && substr($this->database, 0, 4) != 'dsn:';
             $is_oracle = $this->type == 'oracle' && substr($this->database, 0, 4) != 'dsn:';
             if ($begin) {
                 // The SQL Server PDO object hasn't implemented transactions
                 if ($is_mssql) {
                     $this->connection->exec('BEGIN TRANSACTION');
                 } elseif ($is_oracle) {
                     $this->connection->setAttribute(PDO::ATTR_AUTOCOMMIT, FALSE);
                 } else {
                     $this->connection->beginTransaction();
                 }
             } elseif ($commit) {
                 if ($is_mssql) {
                     $this->connection->exec('COMMIT');
                 } elseif ($is_oracle) {
                     $this->connection->exec('COMMIT');
                     $this->connection->setAttribute(PDO::ATTR_AUTOCOMMIT, TRUE);
                 } else {
                     $this->connection->commit();
                 }
             } elseif ($rollback) {
                 if ($is_mssql) {
                     $this->connection->exec('ROLLBACK');
                 } elseif ($is_oracle) {
                     $this->connection->exec('ROLLBACK');
                     $this->connection->setAttribute(PDO::ATTR_AUTOCOMMIT, TRUE);
                 } else {
                     $this->connection->rollBack();
                 }
             }
         } catch (Exception $e) {
             $db_type_map = array('db2' => 'DB2', 'mssql' => 'MSSQL', 'mysql' => 'MySQL', 'oracle' => 'Oracle', 'postgresql' => 'PostgreSQL', 'sqlite' => 'SQLite');
             throw new fSQLException('%1$s error (%2$s) in %3$s', $db_type_map[$this->type], $e->getMessage(), $sql);
         }
     } elseif ($is_oci) {
         if ($commit) {
             oci_commit($this->connection);
         } elseif ($rollback) {
             oci_rollback($this->connection);
         }
     } elseif ($is_sqlsrv) {
         if ($begin) {
             sqlsrv_begin_transaction($this->connection);
         } elseif ($commit) {
             sqlsrv_commit($this->connection);
         } elseif ($rollback) {
             sqlsrv_rollback($this->connection);
         }
     } elseif ($is_ibm_db2) {
         if ($begin) {
             db2_autocommit($this->connection, FALSE);
         } elseif ($commit) {
             db2_commit($this->connection);
             db2_autocommit($this->connection, TRUE);
         } elseif ($rollback) {
             db2_rollback($this->connection);
             db2_autocommit($this->connection, TRUE);
         }
     }
     if ($result_class) {
         $result = new $result_class($this);
         $result->setSQL($sql);
         $result->setResult(TRUE);
         return $result;
     }
     return TRUE;
 }
コード例 #24
0
         $sql = "UPDATE MD_PROC_DELAY_REMS SET REMS = '{$REMS}',ENTRY_SIGN = '{$username}' WHERE HEAD_MARK = '{$HM}' AND ID='{$HMID}' AND ENTRY_DATE = TO_DATE('{$REMS_DT}','MM/DD/YYYY') AND PROC_TYPE = '{$PROC_TYP}' AND PROC_SUB_TYPE = '{$PROC_SUB_TYP}'";
         $parse = oci_parse($conn, $sql);
         oci_execute($parse);
         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%">
コード例 #25
0
ファイル: Oracle.php プロジェクト: basdog22/Qool
 /**
  * Commit a transaction and return to autocommit mode.
  *
  * @return void
  * @throws Zend_Db_Adapter_Oracle_Exception
  */
 protected function _commit()
 {
     if (!oci_commit($this->_connection)) {
         /**
          * @see Zend_Db_Adapter_Oracle_Exception
          */
         require_once 'Zend/Db/Adapter/Oracle/Exception.php';
         throw new Zend_Db_Adapter_Oracle_Exception(oci_error($this->_connection));
     }
     $this->_setExecuteMode(OCI_COMMIT_ON_SUCCESS);
 }
コード例 #26
0
ファイル: Oracle.php プロジェクト: josephholsten/swaplady
 /**
  * Commit a transaction and return to autocommit mode.
  *
  * @return void
  * @throws Zend_Db_Adapter_Oracle_Exception
  */
 protected function _commit()
 {
     if (!oci_commit($this->_connection)) {
         throw new Zend_Db_Adapter_Oracle_Exception(oci_error($this->_connection));
     }
     $this->_setExecuteMode(OCI_COMMIT_ON_SUCCESS);
 }
コード例 #27
0
ファイル: class_db_oci8.php プロジェクト: jinshana/kajonacms
 /**
  * Ends a successful operation by committing the transaction
  * @return void
  */
 public function transactionCommit()
 {
     oci_commit($this->linkDB);
     $this->bitTxOpen = false;
 }
コード例 #28
0
ファイル: oci8_driver.php プロジェクト: hagar72/topics
 /**
  * Commit Transaction
  *
  * @return	bool
  */
 protected function _trans_commit()
 {
     $this->commit_mode = OCI_COMMIT_ON_SUCCESS;
     return oci_commit($this->conn_id);
 }
コード例 #29
0
ファイル: Oracle.php プロジェクト: tests1/zendcasts
 /**
  * Commit a transaction
  *
  * @return void
  */
 public function commit()
 {
     return @oci_commit($this->connection);
 }
コード例 #30
0
 public function registrar2(Denuncia $data, FiscEmpresa $empresa)
 {
     $this->conex = DataBase::getInstance();
     /*Consultar Empresa*/
     $id_empresa = $empresa->__GET('id_fisc_empresa');
     $consulta_empresa = "SELECT * FROM FISC_EMPRESA WHERE ID_FISC_EMPRESA= '" . $id_empresa . "'";
     $compemp = oci_parse($this->conex, $consulta_empresa);
     if (!$compemp) {
         return false;
     }
     $exemp = oci_execute($compemp);
     if (!$exemp) {
         return false;
     }
     $empresa_result = oci_fetch_assoc($compemp);
     /*Consultar Empresa*/
     /*Verificar existencia de empresa*/
     if (!isset($empresa_result['ID_EMPRESA'])) {
         /*Insertando en la tabla FISC_EMPRESA*/
         $id_emp = $empresa->__GET('id_fisc_empresa');
         $rif = $empresa->__GET('rif_fisc_empresa');
         $nombre = $empresa->__GET('nombre_fisc_empresa');
         $telefono = $empresa->__GET('telefono_fisc_empresa');
         $email = $empresa->__GET('email_fisc_empresa');
         $direccion = $empresa->__GET('direccion_fisc_empresa');
         $referencia = $empresa->__GET('punto_ref_fisc_empresa');
         $denuncias = 1;
         //clave foranea de tabla denuncia
         $fiscalizaciones = 3;
         //clave foranea de tabla fiscalizaciones
         $consulta = "INSERT INTO FISC_EMPRESA (\n\t\t\t\tID_FISC_EMPRESA, \n\t\t\t\tRIF_FISC_EMPRESA,\n\t\t\t\tNOMBRE_FISC_EMPRESA, \n\t\t\t\tTELEFONO_FISC_EMPRESA, \n\t\t\t\tEMAIL_FISC_EMPRESA, \n\t\t\t\tDIRECCION_FISC_EMPRESA, \n\t\t\t\tDENUNCIAS_FISC_EMPRESA, \n\t\t\t\tPUNTO_REF_FISC_EMPRESA, \n\t\t\t\tFISCALIZACIONES_FISC_EMPRESA)\nvalues\n(\n\t:id_emp,\n\t:rif_emp,\n\t:nombre, \n\t:telefono,\n\t:email,\n\t:direccion,\n\t:denuncias,\n\t:ref,\n\t:fiscalizaciones\n\t)";
         $stid = oci_parse($this->conex, $consulta);
         if (!$stid) {
             echo "Desde el parse 1";
             $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;
         }
         oci_bind_by_name($stid, ':id_emp', $id_emp);
         oci_bind_by_name($stid, ':rif_emp', $rif);
         oci_bind_by_name($stid, ':nombre', $nombre);
         oci_bind_by_name($stid, ':telefono', $telefono);
         oci_bind_by_name($stid, ':email', $email);
         oci_bind_by_name($stid, ':direccion', $direccion);
         oci_bind_by_name($stid, ':denuncias', $denuncias);
         oci_bind_by_name($stid, ':ref', $referencia);
         oci_bind_by_name($stid, ':fiscalizaciones', $fiscalizaciones);
         $r = oci_execute($stid, OCI_NO_AUTO_COMMIT);
         if (!$r) {
             echo "Desde el execute 1";
             $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;
         }
         /*Insertando en la tabla FISC_EMPRESA*/
     }
     /*Verificar existencia de empresa*/
     /*Insertando en la tabla FISC_APODERADO*/
     $id_den = $data->__GET('id_denuncia');
     $id_ciu = $data->__GET('id_ciudadano');
     $motivo = $data->__GET('motivo_denuncia');
     $sts = $data->__GET('estatus_denuncia');
     $fecha = $data->__GET('fecha_denuncia');
     $rif = $data->__GET('rif');
     $descripcion = $data->__GET('descripcion');
     $responsable = $data->__GET('responsable');
     //$apoderado   = $data->__GET('apoderado');
     $consulta = "INSERT INTO FISC_APODERADO(\n\tid_denuncia,\n\tid_ciudadano,\n\trif,\n\tmotivo_denuncia,\n\testatus_denuncia,\n\tfecha_denuncia,\n\tdescripcion, \n\tresponsable)\nvalues (\n\t:id_den,\n\t:id_ciu,\n\t:rif,\n\t:mot,\n\t:sts,\n\t:fec,\n\t:descrip,\n\t:responsable)";
     $stid = oci_parse($this->conex, $consulta);
     /*values (
      	:id_den,:id_ciu,:rif,:mot,:sts,
      	:fec,:descrp,:creator,:upd)");*/
     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);
         			//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;
     			}
     
     			oci_bind_by_name($stid, ':id_den', $id_den);
     			oci_bind_by_name($stid, ':id_doc', $documentos[$i]);
     			$r = oci_execute($stid, OCI_NO_AUTO_COMMIT);
     			if (!$r)
     			{
     				echo "Desde el execute 3";
     				$e = oci_error($this->conex);
         			trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
     				//$error = true;
         			//self::eliminar($id_den);
         			oci_rollback($this->conex);
         			//$e = oci_error($stid);
         			//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;
     			}
     		}
     		Insertando en la tabla FISC_DOCUMENTOS*/
     //Verificar existencia de Apoderado
     /*
     if( !isset($apoderado_result['ID_APODERADO']))
     {
     
     //Insertando en la tabla FISC_APODERADO
     $nombres_apoderado    = $data->__GET('nombres_apoderado');
     $apellidos_apoderado  = $data->__GET('apellidos_apoderado');
     
     $consulta = "INSERT INTO FISC_APODERADO(
     					id_apoderado,
     					nombres_apoderado,
     					apellidos_apoderado)
     					values (
     			    	:id_apo, :name_apo, :ape_apo)";
     		$stid_apo = oci_parse($this->conex, $consulta);
     		
     		if (!$stid_apo)
     		{
     			echo "Desde el parse 4";
     			$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);
         			//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;
     		}
     
     		oci_bind_by_name($stid_apo, ':id_apo', $id_apoderado);
     		oci_bind_by_name($stid_apo, ':name_apo', $nombres_apoderado);
     		oci_bind_by_name($stid_apo, ':ape_apo', $apellidos_apoderado);
     		$execute_apo = oci_execute($stid_apo, OCI_NO_AUTO_COMMIT);
     		if (!$execute_apo)
     		{
     			echo "Desde el execute 4";
     			$e = oci_error($this->conex);
         			trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
     			//$error = true;
         			//self::eliminar($id_den);
         			oci_rollback($this->conex);
         			//$e = oci_error($stid);
         			//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;
     		}
     
     //Insertando en la tabla FISC_APODERADO
     
     }//Verificar existencia de Apoderado
     */
     $r = oci_commit($this->conex);
     if (!$r) {
         oci_close($this->conex);
         return false;
     }
     // Cierra la conexión Oracle
     oci_close($this->conex);
     return true;
 }