本文整理汇总了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;
}
示例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);
}
示例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();
}
示例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;
}
示例5: __construct
public function __construct()
{
try {
$this->pdo = DataBase::getInstance();
} catch (Exception $e) {
die($e->getMessage());
}
}
示例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();
}
示例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;
}
示例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;
}
}
示例9: adapterSourceObject
protected function adapterSourceObject()
{
if (strtoupper($this->source) == 'DB') {
$this->db = DataBase::getInstance();
} else {
if (strtoupper($this->source) == 'REDIS') {
$this->db = Redis::getInstance();
}
}
}
示例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();
}
示例11: __construct
function __construct()
{
/*
* Object of Settings class
*
* @var Settings
* */
$settings = Settings::getInstance();
$this->db = DataBase::getInstance();
$this->db_config = $settings->getDBConfig();
}
示例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;
}
示例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;
}
示例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}";
}
示例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;
}