本文整理汇总了PHP中DataBase::getConn方法的典型用法代码示例。如果您正苦于以下问题:PHP DataBase::getConn方法的具体用法?PHP DataBase::getConn怎么用?PHP DataBase::getConn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataBase
的用法示例。
在下文中一共展示了DataBase::getConn方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get
public function get($id)
{
require_once 'DataBase.php';
$data = new DataBase();
$data->open();
$sql = "BEGIN GETRUTACONDUCTOR(:p_id, :rc); END;";
$sent = oci_parse($data->getConn(), $sql);
$refcur = oci_new_cursor($data->getConn());
$this->id = $id;
oci_bind_by_name($sent, ':p_id', $this->id);
oci_bind_by_name($sent, ':rc', $refcur, -1, OCI_B_CURSOR);
if (!oci_execute($sent)) {
return false;
}
if (!oci_execute($refcur)) {
return false;
}
while (($row = oci_fetch_array($refcur, OCI_ASSOC + OCI_RETURN_NULLS)) != false) {
$this->ruta = $row['ID_RUTA'];
$this->conductor = $row['ID_CONDUCTOR'];
$this->kilometraje = $row['KILOMETRAJE'];
$this->descripcion = $row['DESCRIPCION'];
}
oci_free_statement($refcur);
$data->free($sent);
$data->close();
return true;
}
示例2: loadAtendente
function loadAtendente()
{
include_once 'app.ado/DataBase.php';
$db = new DataBase();
$aten = $db->getConn()->query('select nome_usuario from usuarios where id_usuario = ' . $this->usuario_id . ';')->fetchAll(PDO::FETCH_CLASS, "Item");
return $aten;
}
示例3: render
public function render()
{
if (!$this->conteudo) {
include_once 'app.ado/DataBase.php';
$pdo = new DataBase();
$db = $pdo->getConn();
$sql = 'select * from ctrl_chaves';
if ($this->dt_inicial or $this->dt_final) {
$this->dt_inicial = $this->dt_inicial ? $this->dt_inicial : '2012/01/01';
$this->dt_final = $this->dt_final ? $this->dt_final : date('Y/m/d');
$sql .= ' where ((dt_inicial_controle between ? and ?) or (dt_final_controle between ? and ?))';
$exec[] = $this->dt_inicial;
$exec[] = $this->dt_final;
if ($this->id) {
$sql .= ' and id_controle = ?';
$exec[] = $this->id;
}
} elseif ($this->id) {
$sql .= ' where id_controle = ?';
$exec[] = $this->id;
}
if ($this->order) {
$sql .= ' order by ?';
$exec[] = $this->order;
}
$sth = $db->prepare($sql);
$conteudo = $sth->execute($exec);
$this->conteudo = $conteudo->fetchAll(PDO::FETCH_CLASS, 'CrlChave');
}
$tabela = new TTableChave($this->conteudo);
$pdf = new TRelatorio();
$pdf->writeHTML($tabela->render());
$pdf->render();
$pdf->exit();
}
示例4: loadLaboratorio
function loadLaboratorio()
{
include_once 'app.ado/DataBase.php';
$db = new DataBase();
$lab = $db->getConn()->query('select nome_laboratorio from laboratorios where id_laboratorio = ' . $this->laboratorio_id . ';')->fetch(PDO::FETCH_COLUMN);
unset($db);
return $lab;
}
示例5: buscaPermissoes
function buscaPermissoes($id)
{
include 'app.ado/DataBase.php';
$db = new DataBase();
$modulos = $db->getConn()->query('select m.nome_modulo from modulos m
inner join modulos_permissoes mp on (mp.modulo_id = m.id_modulo)
inner join modulos_permissoes_usuarios mpu on (mpu.modulo_permissao_id = mp.id_modulo_permissao)
where mpu.usuario_id = ' . $id . '
group by m.nome_modulo;')->fetchAll(PDO::FETCH_COLUMN);
foreach ($modulos as $modulo) {
$permissoes[$modulo] = $db->getConn()->query('select p.nome_permissao from permissoes p
inner join modulos_permissoes mp on (mp.permissao_id = p.id_permissao)
inner join modulos m on (mp.modulo_id = m.id_modulo)
inner join modulos_permissoes_usuarios mpu on (mpu.modulo_permissao_id = mp.id_modulo_permissao)
where mpu.usuario_id = ' . $id . ' and m.nome_modulo like "' . $modulo . '"
group by p.nome_permissao;')->fetchAll(PDO::FETCH_COLUMN);
}
$permissoes['usuarios'][] = 'info-usuario';
$permissoes['usuarios'][] = 'logout';
$permissoes['manutencoes'][] = 'm-manutencoes';
return $permissoes;
}
示例6: get_conn
/**
* 取得一个AdoDB的数据库连接对象
*/
function get_conn($dbhost = '', $dbname = '', $dbuser = '', $dbpsw = '', $charset = '')
{
require_once EZBOSS_CLASSES_PATH . DIRECTORY_SEPARATOR . 'DataBase.class.php';
if ($dbhost == '') {
global $dbhost, $dbname, $dbuser, $dbpsw, $charset;
}
$db = new DataBase($dbhost, $dbname, $dbuser, $dbpsw, $charset);
try {
$conn = $db->getConn();
return $conn;
} catch (Exception $e) {
echo "数据库连接失败";
exit;
}
}
示例7: get
public function get($id)
{
require_once 'DataBase.php';
$data = new DataBase();
$data->open();
$sql = "BEGIN GETPLANIFICACION(:id, :nombre, :distancia, :ruta); END;";
$sent = oci_parse($data->getConn(), $sql);
$this->id = $id;
oci_bind_by_name($sent, ':id', $this->id);
oci_bind_by_name($sent, ':nombre', $this->nombre);
oci_bind_by_name($sent, ':distancia', $this->distancia);
oci_bind_by_name($sent, ':ruta', $this->ruta);
oci_execute($sent);
$data->free($sent);
$data->close();
}
示例8: render
public function render()
{
if (!$this->conteudo) {
include_once 'app.ado/DataBase.php';
$pdo = new DataBase();
$db = $pdo->getConn();
$sql = 'select * from req_manutencoes';
if ($this->dt_inicial or $this->dt_final) {
$this->dt_inicial = $this->dt_inicial ? $this->dt_inicial : '2012/01/01';
$this->dt_final = $this->dt_final ? $this->dt_final : date('Y/m/d');
$sql .= ' where (dt_requisicao between ? and ?)';
$exec[] = $this->dt_inicial;
$exec[] = $this->dt_final;
if ($this->id) {
$sql .= ' and id_requisicao = ?';
$exec[] = $this->id;
}
} elseif ($this->id) {
$sql .= ' where id_requisicao = ?';
$exec[] = $this->id;
}
if ($this->order) {
$sql .= ' order by ?';
$exec[] = $this->order;
}
$sth = $db->prepare($sql);
$conteudo = $sth->execute($exec);
$this->conteudo = $conteudo->fetchAll(PDO::FETCH_CLASS, 'Requerir');
}
if (is_array($this->conteudo)) {
$html = '';
foreach ($this->conteudo as $requisicao) {
$tabela = new TTableManutencao($requisicao);
$html .= $tabela->render();
}
} else {
$tabela = new TTableManutencao($this->conteudo);
$html .= $tabela->render();
}
// $pdf = new TRelatorio();
//
// $pdf->writeHTML($html);
//
// $pdf->render();
// $pdf->exit();
}
示例9: loadManutencoes
function loadManutencoes()
{
include_once 'app.ado/DataBase.php';
$db = new DataBase();
$manu = $db->getConn()->query('select * from manutencoes where req_manutencao_id =' . $this->id_requisicao . ';')->fetchAll(PDO::FETCH_CLASS, 'Manu');
return $manu;
}
示例10: DataBase
<?php
include 'app.ado/DataBase.php';
$db = new DataBase();
$con = $db->getConn()->query('select * from emprestimos where usuario_id = 2;')->fetchAll(PDO::FETCH_CLASS, 'Emp');
$pdf = new TRelEmprestimo($con);
$pdf->render();
// include_once '../componentes/MPDF54/mpdf.php';
// $pdf = new mPDF();
// $pdf->WriteHTML("alo mundo");
// $pdf->Output('jomaro.pdf',"D");
// exit();
示例11: DataBase
<?php
$username = $_POST['user'];
$password = $_POST['pass'];
$rol = 0;
require_once 'DataBase.php';
$data = new DataBase();
$data->open();
$id = 0;
$sql = "BEGIN LOGIN(:user, :pass, :rol, :id); END;";
$sent = oci_parse($data->getConn(), $sql);
oci_bind_by_name($sent, ':user', $username);
oci_bind_by_name($sent, ':pass', $password);
oci_bind_by_name($sent, ':rol', $rol);
oci_bind_by_name($sent, ':id', $id);
oci_execute($sent);
$data->free($sent);
$data->close();
if ($rol > 0 && $id > 0) {
session_start();
$_SESSION['id'] = $id;
$_SESSION['user'] = $username;
$_SESSION['rol'] = $rol;
header('Location: index.php');
} else {
header('Location: loginform.php?error=1');
}
示例12: getAll
public function getAll()
{
$respuesta = array();
require_once 'DataBase.php';
$data = new DataBase();
$data->open();
$sql = "BEGIN GETALLRUTAS(:rc); END;";
$sent = oci_parse($data->getConn(), $sql);
$refcur = oci_new_cursor($data->getConn());
oci_bind_by_name($sent, ':rc', $refcur, -1, OCI_B_CURSOR);
if (!oci_execute($sent)) {
return false;
}
if (!oci_execute($refcur)) {
return false;
}
while (($row = oci_fetch_array($refcur, OCI_ASSOC + OCI_RETURN_NULLS)) != false) {
$elemento = new Ruta();
$elemento->id = $row['ID_RUTA'];
$elemento->nombre = $row['NOMBRE'];
$respuesta[] = $elemento;
}
oci_free_statement($refcur);
$data->free($sent);
$data->close();
return $respuesta;
}
示例13: delete
public function delete($id)
{
require_once 'DataBase.php';
$data = new DataBase();
$data->open();
$sql = "BEGIN DELUSUARIO(:id); END;";
$sent = oci_parse($data->getConn(), $sql);
oci_bind_by_name($sent, ':id', $id);
if (!oci_execute($sent)) {
return false;
}
$data->free($sent);
$data->close();
return true;
}
示例14: update
public function update()
{
if ($this->factura != "" && $this->proveedor != "" && $this->id != 0) {
require_once 'DataBase.php';
$data = new DataBase();
$data->open();
$sql = "BEGIN UPDMANTENIMIENTO(:id, :factura, :proveedor, :fecha, :monto, :descripcion, :vehiculo, :tipo); END;";
$sent = oci_parse($data->getConn(), $sql);
oci_bind_by_name($sent, ':id', $this->id);
oci_bind_by_name($sent, ':factura', $this->factura);
oci_bind_by_name($sent, ':proveedor', $this->proveedor);
oci_bind_by_name($sent, ':fecha', $this->fecha);
oci_bind_by_name($sent, ':monto', $this->monto);
oci_bind_by_name($sent, ':descripcion', $this->descripcion);
oci_bind_by_name($sent, ':vehiculo', $this->vehiculo);
oci_bind_by_name($sent, ':tipo', $this->tipoMantenimiento);
if (!oci_execute($sent)) {
return false;
}
$data->free($sent);
$data->close();
return true;
} else {
return false;
}
}
示例15: get
function get($id)
{
require_once 'DataBase.php';
$data = new DataBase();
$data->open();
$sql = "BEGIN GETVEHICULO(:id, :rc); END;";
$sent = oci_parse($data->getConn(), $sql);
$refcur = oci_new_cursor($data->getConn());
$this->id = $id;
oci_bind_by_name($sent, ':id', $this->id);
oci_bind_by_name($sent, ':rc', $refcur, -1, OCI_B_CURSOR);
if (!oci_execute($sent)) {
return false;
}
if (!oci_execute($refcur)) {
return false;
}
while (($row = oci_fetch_array($refcur, OCI_ASSOC + OCI_RETURN_NULLS)) != false) {
$this->id = $row['ID_VEHICULO'];
$this->placa = $row['PLACA'];
$this->kilometraje = $row['KILOMETRAJE'];
$this->serie = $row['SERIE'];
$this->motor = $row['MOTOR'];
$this->anio = $row['ANIO'];
$this->color = $row['COLOR'];
$this->marca = $row['MARCA'];
}
oci_free_statement($refcur);
$data->free($sent);
$data->close();
return true;
}