Example #1
0
 /**
  * Accede al objeto db que tiene el API para consultas/comandos sobre la fuente
  * @return toba_db
  */
 function get_db($reusar = true)
 {
     if ($reusar) {
         if (!isset($this->db)) {
             $this->pre_conectar();
             $this->db = toba_dba::get_db_de_fuente(toba::instancia()->get_id(), $this->definicion['proyecto'], $this->definicion['fuente_datos'], $reusar);
             $this->crear_usuario_para_auditoria($this->db);
             $this->post_conectar();
             if (isset($this->definicion['schema']) && $this->db->get_schema() == null) {
                 $this->db->set_schema($this->get_conf_schemas());
             }
             $this->configurar_parseo_errores($this->db);
         }
         return $this->db;
     } else {
         //-- Se pide una conexión aislada, que no la reutilize ninguna otra parte de la aplicación
         // Esta el codigo anterior repetido porque si se unifica, el post_conectar asume la presencia de $this->db y no habria forma de pedir una conexion aislada
         $db = toba_dba::get_db_de_fuente(toba::instancia()->get_id(), $this->definicion['proyecto'], $this->definicion['fuente_datos'], $reusar);
         $this->crear_usuario_para_auditoria($db);
         if (isset($this->definicion['schema']) && $this->db->get_schema() == null) {
             $db->set_schema($this->get_conf_schemas());
         }
         $this->configurar_parseo_errores($db);
         return $db;
     }
 }
Example #2
0
 function get_schema_db()
 {
     $parametros = toba_dba::get_parametros_base($this->memoria['base']);
     if (isset($parametros['schema'])) {
         return $parametros['schema'];
     }
 }
Example #3
0
 function get_lista_bases()
 {
     $bases = toba_dba::get_bases_definidas();
     $datos = array();
     $orden = 0;
     foreach ($bases as $base => $descripcion) {
         $datos[$orden]['id'] = $base;
         $datos[$orden]['nombre'] = $base . ' --- ' . $descripcion['base'] . '@' . $descripcion['profile'];
         $orden++;
     }
     return $datos;
 }
Example #4
0
 function db()
 {
     return toba_dba::get_db($this->base);
 }
Example #5
0
 static function get_base_activa()
 {
     if (self::activado()) {
         return toba_dba::get_db(self::$memoria['base']);
     }
 }
Example #6
0
 /**
  *	Devuelve una referencia a la instancia
  */
 private static function get_instancia()
 {
     if (!isset(self::$dba)) {
         $c = __CLASS__;
         self::$dba = new $c();
     }
     return self::$dba;
 }