Last active
August 29, 2015 14:04
-
-
Save raphaeldealmeida/1c82eb759fc662f92841 to your computer and use it in GitHub Desktop.
Exemplo de uso
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Carregar as classes ZEND sem require_once | |
require_once 'Zend/Loader/Autoloader.php'; | |
$loader = Zend_Loader_Autoloader::getInstance(); | |
$loader->setFallbackAutoloader(true); | |
//Obtendo o adaptador | |
$dbAdapter = Zend_Db::factory('adaptador', | |
array('username' => 'usuario', | |
'password' => 'senha', | |
'dbname' => 'base' | |
)); | |
/** | |
* Opcional: Configuração do profile | |
* Para ver as queries é necessário instalar a extensão firebug e firephp | |
*/ | |
$profiler = new Zend_Db_Profiler_Firebug('ALL DB QUERYES'); | |
$profiler->setEnabled(true); | |
$dbAdapter->setProfiler($profiler); | |
ob_start(); | |
//Executando a query | |
$dbAdapter->query("SELECT * FROM TABELA")->fetchAll(); | |
/** | |
* Opcional: Configuração do profile | |
* No final do arquivo | |
*/ | |
$channel = Zend_Wildfire_Channel_HttpHeaders::getInstance(); | |
$channel->flush(); | |
$channel->getResponse()->sendHeaders(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment