/**
  * Modify permis's informations
  *
  * @param PK_FACTURATION, permis's id
  * @return 0 without errors, exception message any others cases
  */
 public function has_facturation($PK_FACTURATION)
 {
     try {
         $qry = oci_parse($this->db, 'SELECT AUTO.FACTURATION FROM FACTURATION WHERE FACTURATION.PK_FACTURATION =?');
         $qry->bindValue(1, $PK_FACTURATION, \PDO::PARAM_STR);
         $nrows = oci_fetch_all($qry, $res, null, null, OCI_FETCHSTATEMENT_BY_ROW);
         oci_close($this->db);
         return $res;
     } catch (Exception $e) {
         return $e->getMessage();
     }
 }
Пример #2
1
 /**
  * Modify all customer's informations from one customer 		
  * @param TYPE_FACTURE ,  customer's lasttName
  */
 public function add_marque($TYPE_FACTURE)
 {
     try {
         $qry = oci_parse($this->db, 'INSERT INTO AUTO.MARQUE (NOM) VALUES (?)');
         $qry->bindValue(1, $TYPE_FACTURE, \PDO::PARAM_STR);
         $nrows = oci_fetch_all($qry, $res, null, null, OCI_FETCHSTATEMENT_BY_ROW);
         oci_close($this->db);
         return $res;
     } catch (Exception $e) {
         return $e->getMessage();
     }
 }
Пример #3
1
 /**
  * Modify permis's informations
  *
  * @param PK_PERMIS, permis's id
  * @return 0 without errors, exception message any others cases
  */
 public function has_Permis($PK_PERMIS)
 {
     try {
         $qry = oci_parse($this->db, 'SELECT AUTO.PERMIS FROM PERMIS WHERE PERMIS.PK_PERMIS =?');
         $qry->bindValue(1, $PK_PERMIS, \PDO::PARAM_STR);
         $nrows = oci_fetch_all($qry, $res, null, null, OCI_FETCHSTATEMENT_BY_ROW);
         oci_close($this->db);
         return $res;
     } catch (Exception $e) {
         return $e->getMessage();
     }
 }
Пример #4
1
 /**
  * Modify permis's informations
  *
  * @param PK_LECON, permis's id
  * @return 0 without errors, exception message any others cases
  */
 public function has_marque($PK_LECON)
 {
     try {
         $qry = oci_parse($this->db, 'SELECT AUTO.EXAMEN FROM EXAMEN WHERE EXAMEN.PK_EXAMEN =?');
         $qry->bindValue(1, $PK_LECON, \PDO::PARAM_STR);
         $nrows = oci_fetch_all($qry, $res, null, null, OCI_FETCHSTATEMENT_BY_ROW);
         oci_close($this->db);
         return $res;
     } catch (Exception $e) {
         return $e->getMessage();
     }
 }
Пример #5
1
 /**
  * Modify permis's informations
  *
  * @param PK_VEHICULE, permis's id
  * @return 0 without errors, exception message any others cases
  */
 public function has_vehicule($PK_VEHICULE)
 {
     try {
         $qry = oci_parse($this->db, 'SELECT * FROM VEHICULE WHERE VEHICULE.PK_VEHICULE =?');
         $qry->bindValue(1, $PK_VEHICULE, \PDO::PARAM_STR);
         $nrows = oci_fetch_all($qry, $res, null, null, OCI_FETCHSTATEMENT_BY_ROW);
         oci_close($this->db);
         return $res;
     } catch (Exception $e) {
         return $e->getMessage();
     }
 }
 public function getById($id)
 {
     $this->conex = DataBase::getInstance();
     $stid = oci_parse($this->conex, "SELECT *\n\t\t\tFROM FISC_CIUDADANO WHERE ID_CIUDADANO=:id");
     if (!$stid) {
         $e = oci_error($this->conex);
         trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
     }
     // Realizar la lógica de la consulta
     oci_bind_by_name($stid, ':id', $id);
     $r = oci_execute($stid);
     if (!$r) {
         $e = oci_error($stid);
         trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
     }
     // Obtener los resultados de la consulta
     $alm = new FiscCiudadano();
     while ($fila = oci_fetch_array($stid, OCI_ASSOC + OCI_RETURN_NULLS)) {
         $it = new ArrayIterator($fila);
         while ($it->valid()) {
             $alm->__SET(strtolower($it->key()), $it->current());
             $it->next();
         }
     }
     //Libera los recursos
     oci_free_statement($stid);
     // Cierra la conexión Oracle
     oci_close($this->conex);
     //retorna el resultado de la consulta
     return $alm;
 }
Пример #7
0
function get_list($data)
{
    $results = array();
    $games = array();
    $conn = oci_connect('malz', '1Qaz2wsx', '(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(Host=db1.chpc.ndsu.nodak.edu)(Port=1521)))(CONNECT_DATA=(SID=cs)))');
    //Select customer with last name from field
    $userQuery = 'select userName from Account where listId = :data';
    $listQuery = 'select * from ListGame, Game where listId = :data and ListGame.gameId = Game.gameId';
    $stid = oci_parse($conn, $userQuery);
    $stid2 = oci_parse($conn, $listQuery);
    oci_bind_by_name($stid, ':data', $data);
    oci_bind_by_name($stid2, ':data', $data);
    oci_execute($stid, OCI_DEFAULT);
    //iterate through each row
    while ($row = oci_fetch_array($stid, OCI_ASSOC)) {
        $results[] = $row;
    }
    oci_execute($stid2, OCI_DEFAULT);
    while ($row = oci_fetch_array($stid2, OCI_ASSOC)) {
        $games[] = $row;
    }
    $results[] = $games;
    echo json_encode($results);
    oci_free_statement($stid);
    oci_free_statement($stid2);
    oci_close($conn);
}
 public function close_connection()
 {
     if (isset($this->connection)) {
         oci_close($this->connection);
         unset($this->connection);
     }
 }
Пример #9
0
 function disconnect()
 {
     if ($this->connectionId) {
         oci_close($this->connectionId);
         $this->connectionId = null;
     }
 }
Пример #10
0
function get_filteredGames($data)
{
    // The connection string is loooooooong. It's easiest to copy/paste this line. Remember to replace 'username' and 'password'!
    $conn = oci_connect('malz', '1Qaz2wsx', '(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(Host=db1.chpc.ndsu.nodak.edu)(Port=1521)))(CONNECT_DATA=(SID=cs)))');
    if ($data === 'all') {
        $results = array();
        $query = 'select * from Game';
        $stid = oci_parse($conn, $query);
        oci_bind_by_name($stid, ':data', $data);
        oci_execute($stid);
        //iterate through each row
        while ($row = oci_fetch_array($stid, OCI_ASSOC)) {
            $results[] = $row;
        }
        echo json_encode($results);
        oci_free_statement($stid);
        oci_close($conn);
    } else {
        $results = array();
        $data = $data . '%';
        $query = 'select * from Game where gameName like :data';
        $stid = oci_parse($conn, $query);
        oci_bind_by_name($stid, ':data', $data);
        oci_execute($stid);
        //iterate through each row
        while ($row = oci_fetch_array($stid, OCI_ASSOC)) {
            $results[] = $row;
        }
        echo json_encode($results);
        oci_free_statement($stid);
        oci_close($conn);
    }
}
Пример #11
0
function loginChk($conn)
{
    isset($_POST["email"]);
    isset($_POST["pass1"]);
    global $username, $password, $password_enc;
    /* *** A1 - Injection attacks, converted all SQL statments to include binding/placeholders to prevent injection attacks.
     *
     */
    //check password in database
    $s = oci_parse($conn, "SELECT username FROM tblusers WHERE username=:username_prefix AND password=:pw");
    oci_bind_by_name($s, ':username_prefix', $username);
    oci_bind_by_name($s, ':pw', $password_enc);
    oci_execute($s);
    //evaluate based on db information
    $res = oci_fetch_row($s);
    if ($res) {
        oci_free_statement($s);
        oci_close($conn);
        return true;
    } else {
        oci_free_statement($s);
        oci_close($conn);
        echo "Username or password were incorrect.</br> Please try to login again, <a href='login.html'>click to return to login page</a>.";
        return false;
    }
}
Пример #12
0
 public static function desconectar()
 {
     oci_close($this->conn);
     //cierro la conexion activa
     $this->conn = null;
     //elimina conexion
 }
Пример #13
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;
}
Пример #14
0
 /**
  * Disconnects from the database.
  * Does nothing if there was no connection established.
  *
  * @return void
  */
 protected function disconnectInternal()
 {
     if (!$this->isConnected) {
         return;
     }
     $this->isConnected = false;
     oci_close($this->resource);
 }
Пример #15
0
 public function close() {
   $statement = oci_parse($this->connection, "COMMIT");
   if($this->use_transaction) {
     oci_execute($statement);
     oci_free_statement($statement);
     oci_close($this->connection);
   }
 }
Пример #16
0
 /**
  * Destructor closes the statement and connection
  */
 function __destruct()
 {
     if ($this->stid) {
         oci_free_statement($this->stid);
     }
     if ($this->conn) {
         oci_close($this->conn);
     }
 }
Пример #17
0
 /**
  * Odpojí se od vybrané databáze.
  */
 function Disconnect()
 {
     if ($this->connection_type == DB_CONNECTION_USE_PDO_MYSQL) {
         $this->connection = null;
     } else {
         oci_close($this->connection);
     }
     // Oracle
 }
Пример #18
0
 public function &close()
 {
     if (is_resource($this->resource) && get_resource_type($this->resource) == "oci8 connection") {
         oci_close($this->resource);
     } else {
         unset($this->resource);
     }
     return $this;
 }
Пример #19
0
 /**
  * Closes a database connection, if it is open
  * Returns success, true if already closed
  */
 function close()
 {
     $this->mOpened = false;
     if ($this->mConn) {
         return oci_close($this->mConn);
     } else {
         return true;
     }
 }
Пример #20
0
 /**
  * Disconnects the handler from the database
  */
 public function _disconnect()
 {
     if ($this->db !== null) {
         if (!self::$dbparams['persistent_connection']) {
             oci_close($this->db);
         }
         $this->db = null;
     }
 }
Пример #21
0
 /**
  *@package db_oracle
  *@method close()
  *@desc Close Oracle connection
  *@since v0.1 beta
  * */
 public function close()
 {
     if (isset($this->resource)) {
         oci_free_statement($this->resource);
     }
     if (self::$is_connected) {
         oci_close(self::$conn);
         self::$is_connected = false;
     }
 }
Пример #22
0
function show_foto($id)
{
    $conn = oci_connect('mmAdmin', 'mmAdmin', '//localhost/MATCHMEDB');
    $stid = oci_parse($conn, "begin :result := get_foto(person_id => :codigo); end;");
    oci_bind_by_name($stid, ":result", $resul, 200);
    oci_bind_by_name($stid, ":codigo", $id);
    oci_execute($stid);
    oci_close($conn);
    return $resul;
}
Пример #23
0
 public function close()
 {
     $this->conn_open = false;
     if (!$this->reuse_connection) {
         if ($this->handle && !$this->data_result) {
             return oci_close($this->handle);
         }
     }
     return true;
 }
Пример #24
0
 function query_oracle($sql)
 {
     if (!($con = $this->con_oracle())) {
         return 0;
     } else {
         $res = oci_parse($con, $sql);
         oci_execute($res);
         oci_close($con);
         return $res;
     }
 }
Пример #25
0
 /**
  * Modify all customer's informations from one customer 		
  * @param PERMIS ,  customer's lasttName
  */
 public function add_permis($PERMIS)
 {
     try {
         $qry = oci_parse($this->db, 'INSERT INTO AUTO.PERMIS (NOM) VALUES (?)');
         $qry->bindValue(1, $car_id, \PDO::PARAM_INT);
         oci_execute($qry);
         oci_close($this->db);
     } catch (Exception $e) {
         return $e->getMessage();
     }
 }
Пример #26
0
 /**
  * Modify all customer's informations from one customer 		
  * @param TYPE_FACTURE ,  customer's lasttName
  */
 public function add_type_facture($TYPE_FACTURE)
 {
     try {
         $qry = oci_parse($this->db, 'INSERT INTO AUTO.TYPE_FACTURE (LIBELLE) VALUES (?)');
         $qry->bindValue(1, $TYPE_FACTURE, \PDO::PARAM_STR);
         oci_execute($qry);
         oci_close($this->db);
     } catch (Exception $e) {
         return $e->getMessage();
     }
 }
Пример #27
0
 /**
  * Modify permis's informations
  *
  * @param PK_TYPE_FACTURE, permis's id
  * @return 0 without errors, exception message any others cases
  */
 public function has_Type_Facture($PK_TYPE_FACTURE)
 {
     try {
         $qry = oci_parse($this->db, 'SELECT AUTO.TYPE_FACTURE FROM TYPE_FACTURE WHERE TYPE_FACTURE.PK_TYPE_FACTURE =?');
         $qry->bindValue(1, $PK_TYPE_FACTURE, \PDO::PARAM_STR);
         $nrows = oci_fetch_all($qry, $res, null, null, OCI_FETCHSTATEMENT_BY_ROW);
         oci_close($this->db);
         return $res;
     } catch (Exception $e) {
         return $e->getMessage();
     }
 }
Пример #28
0
 /**
  * Modify all customer's informations from one customer 		
  * @param PRIX_FM ,  customer's lasttName
  * @param NB_LECON_PACK ,  customer's lasttName
  * @param LIBELLE ,  customer's lasttName
  */
 public function add_formule($PRIX_FM, $NB_LECON_PACK, $LIBELLE)
 {
     try {
         $qry = oci_parse($this->db, 'INSERT INTO AUTO.FORMULES (PRIX_FM, NB_LECON_PACK, LIBELLE) VALUES (?,?,?)');
         $qry->bindValue(1, $PRIX_FM, \PDO::PARAM_STR);
         $qry->bindValue(2, $NB_LECON_PACK, \PDO::PARAM_STR);
         $qry->bindValue(3, $LIBELLE, \PDO::PARAM_STR);
         oci_execute($qry);
         oci_close($this->db);
     } catch (Exception $e) {
         return $e->getMessage();
     }
 }
Пример #29
0
 /**
  * Modify all customer's informations from one customer 		
  * @param NOM ,  customer's lasttName
  * @param DATE_PASSAGE ,  customer's lasttName
  * @param LIBELLE ,  customer's lasttName
  */
 public function add_formule($NOM, $DATE_PASSAGE)
 {
     try {
         //INSERT INTO "AUTO"."EXAMEN" (FK_PERMIS, FK_ELEVE, NOM, DATE_PASSAGE) VALUES ('1', '21', 'ghgh', TO_DATE('2017-01-20 18:44:27', 'YYYY-MM-DD HH24:MI:SS'))
         $qry = oci_parse($this->db, 'INSERT INTO AUTO.FORMULES ( NOM, DATE_PASSAGE) VALUES (?,?)');
         $qry->bindValue(1, $NOM, \PDO::PARAM_STR);
         $qry->bindValue(2, $DATE_PASSAGE, \PDO::PARAM_STR);
         oci_execute($qry);
         oci_close($this->db);
     } catch (Exception $e) {
         return $e->getMessage();
     }
 }
Пример #30
-1
function isle($sql)
{
    $conn = oci_connect("yeni3", "yeni3", "//10.6.30.11/mykdb");
    $s = oci_parse($conn, $sql);
    $res = oci_execute($s);
    oci_fetch_all($s, $res);
    return $res;
    oci_close($conn);
}