本文整理汇总了PHP中Sql类的典型用法代码示例。如果您正苦于以下问题:PHP Sql类的具体用法?PHP Sql怎么用?PHP Sql使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Sql类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: listaDestinatarios
public function listaDestinatarios($_prComunicado)
{
$sb = new StringBuilder();
$Sql = new Sql();
$sb->append("SELECT *");
$sb->append("FROM " . T_COMEMP);
$sb->append("LEFT JOIN");
$sb->append(T_EMP);
$sb->append("ON codigo_emp = empregado_coe");
$sb->append(sprintf("WHERE comunicado_coe = %s", $_prComunicado));
return $Sql->executaSQL($sb->toString());
}
示例2: logar
public function logar(Login $login)
{
$Sql = new Sql();
$sb = new StringBuilder();
$sb->append("SELECT *");
$sb->append("FROM " . T_USUARIO);
$sb->append(sprintf("WHERE login_usr = %s", $login->getLoginUsr()));
$sb->append(sprintf("AND senha_usr = %s", $login->getSenhaUsr()));
$sb->append("AND ativo_usr = 1");
$retorno = $Sql->ExecutaSQL($sb->toString());
if (count($retorno) > 0) {
global $Sess;
// Dados do Usuario Logado
$Sess->usuario = $retorno[0];
// Atualiza o usuário
$usuario = new Usuarios();
$usuario->setCodigoUsr(toNumero($retorno[0]['codigo_usr']));
$usuario->setUltimoacessoUsr(toDateTime());
$this->alterar($usuario);
// inicia Sessao
$Sess->logado_sys = true;
$Sess->ultimoacesso_sys = time();
return true;
}
return false;
}
示例3: enviar
public function enviar()
{
try {
$Sql = new Sql();
$Sql->inicio();
$agendaDAO = new AgendaDAO();
$agenda = $agendaDAO->consultaCodigo(toNumero(GetVar('agenda')));
$empregadosDAO = new EmpregadosDAO();
$destinatarios = $empregadosDAO->listarSelecao(GetVar('destinatarios'));
$emailController = new EmailController();
$listaEmail = array();
foreach ($destinatarios as $key => $empregado) {
if ($empregado['email_emp'] != "") {
$listaEmail[] = array("email" => $empregado['email_emp'], "nome" => $empregado['nome_emp']);
}
$agendaEnviadoEmpreg = new AgendaEnviadoEmpreg();
$agendaEnviadoEmpreg->setAgendaAee(toNumero(GetVar('agenda')));
$agendaEnviadoEmpreg->setEmpregadoAee(toNumero($empregado['codigo_emp']));
$agendaDAO->cadastrar($agendaEnviadoEmpreg, $codigo_aee, $Sql);
}
$emailController->setAssunto("Agendamento de Entrevista");
$emailController->setConteudo($this->montaAgendamento($agenda[0]));
$emailController->setListaEmail($listaEmail);
$return = $emailController->enviarEmail();
if (is_string($return)) {
throw new Exception($return);
}
$Sql->commit($return);
$result = $return ? 'Comunicado de Agendamento enviado com sucesso.' : 'Erro ao enviar Comunicado de Agendamento.';
echo json_encode(array("success" => is_string($return) ? false : $return, "msg" => is_string($return) ? $return : $result));
} catch (Exception $e) {
echo json_encode(array("success" => false, "msg" => $e->getMessage()));
}
}
示例4: updateComprovante
public function updateComprovante($id, $parcela, $data, $nome_comprovante)
{
$sql = new Sql();
$sql->conn_bd();
$query = 'UPDATE parcelas SET data = "' . $data . '" , comprovante = "' . $nome_comprovante . '" WHERE parcela_n = ' . $parcela . ' && id_conta = ' . $id . '';
mysql_query($query);
}
示例5: verificaCli
public function verificaCli($user, $pass)
{
$sql = new Sql();
$sql->conn();
$query = "SELECT * FROM usuario";
//WHERE user = '".$user."' && senha = ".$pass;
$result = mysql_query($query);
$cont = 0;
while (mysql_fetch_array($result)) {
// $usuario = $row['user'];
// $senha = $row['senha'];
$cont++;
//return true;
}
// $sql = "SELECT * FROM tabela WHERE id=$id";
// $query = mysql_query($sql);
// while($sql = mysql_fetch_array($query)){
// $nome = $sql["nome"];
// echo "Resultados para o ID $idNome:$nome";
// }
if ($cont > 0) {
return true;
} else {
return false;
}
}
示例6: search
public function search()
{
$response = "";
$sqlhandler = new Sql();
if ($this->client) {
$sql = "SELECT * FROM `choice` WHERE content LIKE '%{$this->content}%' LIMIT 0, 1 ";
} else {
$sql = "SELECT * FROM `choice` WHERE content LIKE '%{$this->content}%'";
}
if ($result = $sqlhandler->excute_query($sql)) {
if ($result->num_rows == 0) {
return $this->send_ms("暂时还没有队友碰到这题。");
}
while ($row = $result->fetch_assoc()) {
$key = htmlspecialchars(strtoupper($row['c_key']));
$time = date('g:i A d / M / Y D', $row['c_time']);
$content = htmlspecialchars(stripcslashes($row['content']));
$user = htmlspecialchars(stripcslashes($row['c_user']));
if ($this->client) {
$response .= $content . "|" . $key . "|" . $user;
} else {
$response .= "<p><strong>题目:</strong><span><pre>{$content}</pre></span></p><p><strong>答案:</strong><span class=\"answer\">{$key}</span></p><p class=\"post_info\"><span class=\"glyphicon glyphicon-user\" aria-hidden=\"true\"></span> {$user} <span class=\"glyphicon glyphicon-time\" aria-hidden=\"true\"></span> {$time}</p>";
}
//$response .= "{\"content\": \"{$content}\", \"key\": \"{$key}\", \"user\": \"{$user}\", \"time\": \"{$time}\"},";
}
//$response = rtrim($response, ',') . "]";
//<p><strong>题目:</strong><span><pre>{$content}</pre></span></p><p><strong>答案:</strong><span class=\"answer\">{$key}</span></p><p class=\"post_info\"><span class=\"glyphicon glyphicon-user\" aria-hidden=\"true\"></span> {$user} <span class=\"glyphicon glyphicon-time\" aria-hidden=\"true\"></span> {$time}</p>";
}
return $this->send_ms($response);
}
示例7: getOrderedByName
/**
* Returns all states ordered by name
*
* @return TableEntitySetInterface
*/
public function getOrderedByName()
{
$sql = new Sql($this->getAdapter());
$select = $sql->select();
$select->from($this->tableGateway->getTable());
$select->order('state_name asc');
return $this->tableGateway->selectWith($select);
}
示例8: limpa_materiais_produto
public function limpa_materiais_produto($id_produto)
{
$sql = new Sql();
$sql->conn_bd();
$g = new Glob();
$query = "DELETE FROM produto_materiais WHERE id_produto = '%s'";
$result = $g->tratar_query($query, $id_produto);
}
示例9: __construct
public function __construct($name)
{
$s = new Sql();
$connect = $s->connectToDatabase('recruit');
$jbID = $s->createJobPosition($connect, $name);
$this->jpID = $jbID;
$this->jobPositionName = $name;
}
示例10: getStatus
public function getStatus()
{
$s = new Sql();
$connect = $s->connectToDatabase('recruit');
$data = mysqli_query($connect, "SELECT sessionstatus.status FROM sessionstatus,recruitmentsession WHERE recruitmentsession.sessionStatusID=sessionstatus.sessionStatusID AND RSID='{$this->RSID}'");
$row = $data->fetch_row();
return $row[0];
}
示例11: eliminarCategoria
public function eliminarCategoria($id)
{
$sql = new Sql();
$sql->addTable('tipos');
$sql->setOpcion('delete');
$sql->addWhere("`idTipo =`" . $id);
Persistence::eliminar($sql);
}
示例12: setThresholdPeriod
public function setThresholdPeriod($thresholdPeriod)
{
$this->thresholdPeriodYears = $thresholdPeriod;
$s = new Sql();
global $databaseName;
$connectValue = $s->connectToDatabase($databaseName);
$row = $s->insertToConfig($connectValue, $thresholdPeriod);
}
示例13: eliminarDetalleProductoSucursalByProductolId
public function eliminarDetalleProductoSucursalByProductolId($id)
{
$sql = new Sql();
$sql->addTable('detalleProductoSucursales');
$sql->setOpcion('delete');
$sql->addWhere("`pedidoId =`" . $id);
Persistence::eliminar($sql);
}
示例14: testBindISO8601DateValue
/**
* @covers Gacela\DataSource\Query\Sql::bind
* @dataProvider providerDates
*/
public function testBindISO8601DateValue($date, $bound)
{
$time = time();
$this->object->where('date = :date', array(':date' => $date));
$where = $this->object->where;
list($sql, $binds) = $this->object->assemble();
$this->assertSame($bound, $binds[':date']);
}
示例15: atualiza_cbo_x_exames
public function atualiza_cbo_x_exames($id_cbo, $array_id_exames)
{
$sql = new Sql();
$sql->conn_bd();
$g = new Glob();
mysql_query("DELETE FROM cbo_exames WHERE id_cbo = " . $id_cbo);
$this->add_cbo_x_exames($array_id_exames, $id_cbo);
}