当前位置: 首页>>代码示例>>PHP>>正文


PHP DataBase::getInstance方法代码示例

本文整理汇总了PHP中DataBase::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP DataBase::getInstance方法的具体用法?PHP DataBase::getInstance怎么用?PHP DataBase::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DataBase的用法示例。


在下文中一共展示了DataBase::getInstance方法的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;
}
开发者ID:vanckruz,项目名称:draftReports,代码行数:29,代码来源:Controller_password.php

示例2: delete

 public function delete($id)
 {
     $db = DataBase::getInstance();
     $conn = $db->conn;
     $query = "DELETE from " . static::$table . " WHERE " . static::$key . "={$id}";
     return $conn->exec($query);
 }
开发者ID:savicdragan15,项目名称:cosmic,代码行数:7,代码来源:ActiveRecord.php

示例3: __construct

 function __construct($path)
 {
     $this->ruta = $path;
     include_once "class.db.php";
     include_once $this->ruta . "inc/clases/class.pac.php";
     $this->conexion = DataBase::getInstance();
 }
开发者ID:hackdracko,项目名称:kosmos,代码行数:7,代码来源:proceso.certificado.php

示例4: getById

 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;
 }
开发者ID:vanckruz,项目名称:draftReports,代码行数:31,代码来源:class_fisc_ciudadanoDAO.php

示例5: __construct

 public function __construct()
 {
     try {
         $this->pdo = DataBase::getInstance();
     } catch (Exception $e) {
         die($e->getMessage());
     }
 }
开发者ID:vanckruz,项目名称:draftReports,代码行数:8,代码来源:class.CiudadanoDAO.php

示例6: __construct

 function __construct($path)
 {
     $this->ruta = $path;
     include_once "class.dbremota.php";
     include_once "class.db.php";
     include_once $this->ruta . "inc/clases/class.leercfdi.php";
     $this->conexion = DataBaseRemota::getInstance();
     $this->conexion_local = DataBase::getInstance();
 }
开发者ID:hackdracko,项目名称:kosmos,代码行数:9,代码来源:proceso.reporte.php

示例7: getUserFromDatabase

 public static function getUserFromDatabase($i_UserID)
 {
     // @var Database
     $dataBase = DataBase::getInstance();
     $tableName = $dataBase->getTableForPersonID($i_UserID);
     $className = $dataBase->getClassNameForTable($tableName);
     $returnVal = $dataBase->getObjectForClass("ID = " . $i_UserID, $tableName, $className);
     return $returnVal;
 }
开发者ID:shachar-b,项目名称:monopolywebservices,代码行数:9,代码来源:EmployeeScreenGenerator.php

示例8: _connect

 /**
  * Connects to the database
  *
  * @access private
  * @return bool
  */
 private function _connect()
 {
     try {
         self::$_dataBase = DataBase::getInstance();
         return true;
     } catch (Exception $ex) {
         trigger_error("Error: ActiveRecord can't get a DataBase instance, please check database configuration in config.xml", E_USER_ERROR);
         return false;
     }
 }
开发者ID:andreums,项目名称:framework1.5,代码行数:16,代码来源:ActiveRecord.class.php

示例9: adapterSourceObject

 protected function adapterSourceObject()
 {
     if (strtoupper($this->source) == 'DB') {
         $this->db = DataBase::getInstance();
     } else {
         if (strtoupper($this->source) == 'REDIS') {
             $this->db = Redis::getInstance();
         }
     }
 }
开发者ID:robbinhan,项目名称:PEASY,代码行数:10,代码来源:Dao.php

示例10: __construct

 function __construct()
 {
     /**
      * Object of Registry class
      * @var Registry $registry
      */
     $registry = Registry::getInstance();
     $this->db = DataBase::getInstance();
     $this->db_config = $registry->getValue('db_config');
     $this->sessionEngineObj = SessionEngine::getInstance();
 }
开发者ID:GerashenkoVladimir,项目名称:students2.0,代码行数:11,代码来源:AbstractModel.php

示例11: __construct

 function __construct()
 {
     /*
      * Object of Settings class
      *
      * @var Settings
      * */
     $settings = Settings::getInstance();
     $this->db = DataBase::getInstance();
     $this->db_config = $settings->getDBConfig();
 }
开发者ID:GerashenkoVladimir,项目名称:test,代码行数:11,代码来源:AbstractModel.php

示例12: get

 public function get($courriel)
 {
     $cnx = DataBase::getInstance();
     $pstmt = $cnx->prepare("SELECT * FROM user WHERE courriel = :c");
     $pstmt->execute(array('c' => $courriel));
     $result = $pstmt->fetch(PDO::FETCH_OBJ);
     if ($result) {
         $u = new User();
         $u->loadFromObject($result);
         $pstmt->closeCursor();
         DataBase::close();
         return $u;
     }
     $pstmt->closeCursor();
     DataBase::close();
     return NULL;
 }
开发者ID:sisowath,项目名称:TP_PHP,代码行数:17,代码来源:UserDao.php

示例13: findAll

 public function findAll()
 {
     $liste = array();
     $cnx = DataBase::getInstance();
     $pstmt = $cnx->prepare("SELECT * FROM alerts ORDER BY active=1 DESC");
     $pstmt->execute();
     while ($result = $pstmt->fetch(PDO::FETCH_OBJ)) {
         $p = new Alert();
         $p->setId($result->id);
         $p->setTitle($result->title);
         $p->setText($result->text);
         $p->setDate($result->date);
         $p->setActive($result->active);
         array_push($liste, $p);
     }
     $pstmt->closeCursor();
     DataBase::close();
     return $liste;
 }
开发者ID:sisowath,项目名称:TP_PHP,代码行数:19,代码来源:AlertDao.php

示例14: getproductDetails

 public function getproductDetails($pdtid)
 {
     $post = new \Modules\Blog\Models\Post();
     //$this->render->view('Modules.Blog.Views.index',array('a'=>'This is A','b'=>'This is B'));
     $this->render->addJS('a.js');
     $this->render->addCSS('a.css');
     $this->render->addCSS('css/default.css');
     $this->render->with("title", "This is New Title");
     $this->render->alam = "This is Alam";
     $this->render->template('Modules.Blog.Views.index', array('a' => 'This is A', 'b' => 'This is B'));
     exit;
     //echo View::test();
     //$post->id=26;
     //$post->title="asdasdasd";
     //$post->save();
     //$post->delete(array(7,8,9));
     // $post->id=26;
     // $post->title="This is Koushik Post Modified";
     // $post->save();
     // echo $post;
     //print_r($post->select('*')->where('id','>',5)->andWhere('id','<',8)->first());
     // $post->title="First Post";
     // $post->save();
     // echo $post->id;
     $db = DataBase::getInstance();
     $db->setQuery("Select a from test")->query();
     //$db2=DataBase::getInstance();
     //$db2->setQuery("INSERT INTO `users`(`username`,`password`) VALUES('bisu','33333')")->query();
     //print_r($db2->getQueries());
     // //echo baseURL;
     // echo Config::get('database.default','test');
     // echo '<hr>';
     // Config::set('database.default','bisu');
     // Config::set('database.mysql.passwordp','rootwdp');
     // echo '<hr>';
     // echo Config::get('database.default','test');
     // echo '<hr>';
     echo "You want to see the details od {$pdtid}";
 }
开发者ID:druto,项目名称:druto,代码行数:39,代码来源:BlogController.php

示例15: agregar

 /**
  * 
  *
  **/
 public function agregar(&$jefe)
 {
     $this->conex = DataBase::getInstance();
     $consulta = "INSERT INTO FISC_JEFE_OFICINA (\n\t\t\tid_jefe,\n\t\t\tnacionalidad,\n\t\t\tprimer_nombre,\n\t\t\tsegundo_nombre,\n\t\t\tprimer_apellido ,\n\t\t\tsegundo_apellido,\n\t\t\ttratamineto_protocolar,\n\t\t\tnumero_resolucion,\n\t\t\tfecha_resolucion\n \t\t)\n\t\t\tvalues\n\t\t\t(\n\t\t\t\t:id_jefe,\n\t\t\t\t:nacionalidad,\n\t\t\t\t:primer_nombre,\n\t\t\t\t:segundo_nombre\n\t\t\t\t:primer_apellido\n\t\t\t\t:segundo_apellido\n\t\t\t\t:tratamineto_protocolar,\n\t\t\t\t:numero_resolucion,\n\t\t\t\t:fecha_resolucion\n\t\t\t)";
     foreach ($jefes as $jefe) {
         $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;
         }
         $id_jefe = $jefe->__GET('id_jefe');
         $nacionalidad = $jefe->__GET('nacionalidad');
         $primer_nombre = $jefe->__GET('primer_nombre');
         $segundo_nombre = $jefe->__GET('segundo_nombre');
         $primer_apellido = $jefe->__GET('primer_apellido');
         $segundo_apellido = $jefe->__GET('segundo_apellido');
         $tratamineto_protocolar = $jefe->__GET('tratamineto_protocolar');
         $numero_resolucion = $jefe->__GET('numero_resolucion');
         $fecha_resolucion = $jefe->__GET('fecha_resolucion');
         // Realizar la lógica de la consulta
         oci_bind_by_name($stid, ':id_jefe', $id_jefe);
         oci_bind_by_name($stid, ':nacionalidad', $nacionalidad);
         oci_bind_by_name($stid, ':primer_nombre', $primer_nombre);
         oci_bind_by_name($stid, ':segundo_nombre', $segundo_nombre);
         oci_bind_by_name($stid, ':primer_apellido', $primer_apellido);
         oci_bind_by_name($stid, ':segundo_apellido', $segundo_apellido);
         oci_bind_by_name($stid, ':tratamineto_protocolar', $tratamineto_protocolar);
         oci_bind_by_name($stid, ':numero_resolucion', $numero_resolucion);
         oci_bind_by_name($stid, ':fecha_resolucion', $fecha_resolucion);
         $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;
         }
     }
     //END FOREACH
     $r = oci_commit($this->conex);
     if (!$r) {
         oci_free_statement($stid);
         oci_close($this->conex);
         return false;
     }
     oci_free_statement($stid);
     // Cierra la conexión Oracle
     oci_close($this->conex);
     return true;
 }
开发者ID:vanckruz,项目名称:draftReports,代码行数:73,代码来源:model_jefe_oficina.php


注:本文中的DataBase::getInstance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。