Esempio n. 1
0
 /**
  * Constructor opens a connection to the database
  * @param string $module Module text for End-to-End Application Tracing
  * @param string $cid Client Identifier for End-to-End Application Tracing
  */
 function __construct($module, $cid)
 {
     $this->conn = @oci_pconnect(SCHEMA, PASSWORD, DATABASE, CHARSET);
     if (!$this->conn) {
         $m = oci_error();
         throw new \Exception('No se puede conectar a la base de datos: ' . $m['message']);
     }
     // Record the "name" of the web user, the client info and the module.
     // These are used for end-to-end tracing in the DB.
     oci_set_client_info($this->conn, CLIENT_INFO);
     oci_set_module_name($this->conn, $module);
     oci_set_client_identifier($this->conn, $cid);
 }
Esempio n. 2
0
 /**
  * Constructor opens a connection to the database
  * @param string $module Module text for End-to-End Application Tracing
  * @param string $cid Client Identifier for End-to-End Application Tracing
  * @throws \Exception
  */
 public function __construct($module, $cid)
 {
     $this->conn = @oci_new_connect(O_USERNAME, O_PASSWORD, O_DATABASE, O_CHARSET);
     if (!$this->conn) {
         $m = oci_error();
         throw new \Exception("Cannot open connection to Oracle db " . $m["message"]);
     }
     // Record the "name" of the web user, the client info and the module.
     // These are used for end-to-end tracing in the DB.
     oci_set_client_info($this->conn, CLIENT_INFO);
     oci_set_module_name($this->conn, $module);
     oci_set_client_identifier($this->conn, $cid);
 }
Esempio n. 3
0
 /**
  * Utiliza o recurso do Oracle que permite vincular informações do usuário da aplicação à sua sessão no banco de dados.
  * @param type $userId
  * @param type $userIP
  * @param type $module
  * @param type $action
  */
 public function setUserInformation($userId, $userIP = null, $module = null, $action = null)
 {
     oci_set_client_identifier($this->dbh, $userId);
     if ($userIP) {
         oci_set_client_info($this->dbh, $userIP);
     }
     if ($module) {
         oci_set_module_name($this->dbh, $module);
     }
     if ($action) {
         oci_set_action($this->dbh, $action);
     }
 }
Esempio n. 4
0
 public function setModuleName($moduleName)
 {
     set_error_handler(static::getErrorHandler());
     $isSuccess = oci_set_module_name($this->resource, $moduleName);
     restore_error_handler();
     return $isSuccess;
 }