本文整理汇总了PHP中Zend\Db\Adapter\Adapter::setProfiler方法的典型用法代码示例。如果您正苦于以下问题:PHP Adapter::setProfiler方法的具体用法?PHP Adapter::setProfiler怎么用?PHP Adapter::setProfiler使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend\Db\Adapter\Adapter
的用法示例。
在下文中一共展示了Adapter::setProfiler方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testGetProfiler
/**
* @testdox unit test: Test getProfiler() will store profiler
* @covers Zend\Db\Adapter\Adapter::getProfiler
*/
public function testGetProfiler()
{
$this->adapter->setProfiler($profiler = new Profiler\Profiler());
$this->assertSame($profiler, $this->adapter->getProfiler());
$adapter = new Adapter(array('driver' => $this->mockDriver, 'profiler' => true), $this->mockPlatform);
$this->assertInstanceOf('Zend\\Db\\Adapter\\Profiler\\Profiler', $adapter->getProfiler());
}
示例2: createService
/**
* Create db adapter service
*
* @param ServiceLocatorInterface $serviceLocator
* @return Adapter
*/
public function createService(ServiceLocatorInterface $serviceLocator)
{
$config = $serviceLocator->get('Config');
$result = new Adapter($config['db']);
if (defined('SCPPER_DEBUG')) {
$profiler = new \Zend\Db\Adapter\Profiler\Profiler();
$result->setProfiler($profiler);
if ($result->getPlatform()->getName() === 'MySQL') {
$result->query('SET SESSION query_cache_type=0;', Adapter::QUERY_MODE_EXECUTE);
}
}
return $result;
}
示例3: createService
/**
* Create db adapter service
*
* @param ServiceLocatorInterface $serviceLocator
* @return Adapter
*/
public function createService(ServiceLocatorInterface $serviceLocator)
{
$config = $serviceLocator->get('Config');
$adapter = new Adapter($config['db']);
$authStorage = $serviceLocator->get('Sundew\\AuthStorage');
$user = array();
if (!$authStorage->isEmpty()) {
$user = $authStorage->read();
}
$fileName = 'Query' . date('Ymd') . '.log';
$logger = new SundewLogger($fileName, $user);
$adapter->setProfiler($logger);
return $adapter;
}
示例4: __invoke
public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
{
$config = $container->get('config');
$lachesisConfig = isset($config['lachesis']) ? $config['lachesis'] : ['enabled' => false];
if (!isset($lachesisConfig['log_dir'])) {
$lachesisConfig['log_dir'] = 'data/kharon/lachesis';
}
$enabled = isset($config['lachesis']['enabled']) ? (bool) $config['lachesis']['enabled'] : false;
$adapter = new Adapter($config['db'] ?? []);
if ($enabled == false) {
return $adapter;
}
$data = [];
if ($container->has('Request')) {
$data = $this->prepareData($container->get('Request'));
}
$adapter->setProfiler(new Lachesis($lachesisConfig, $data));
return $adapter;
}
示例5: setProfiler
public function setProfiler($profiler)
{
$this->adapter->setProfiler($profiler);
}
示例6: createOfficeBNCAdapter
private function createOfficeBNCAdapter()
{
$officeAdapter = new \Zend\Db\Adapter\Adapter(array('driver' => 'Pdo_Mysql', 'driver_options' => array(\PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES 'UTF8'"), 'dsn' => 'mysql:dbname=officebnc;host=192.168.1.200:3306', 'username' => 'sql_officevg', 'password' => '34w6ygwetgsdft_436ygbsvseB12433'));
$officeAdapter->setProfiler(new \Zend\Db\Adapter\Profiler\Profiler());
$officeSql = new \Zend\Db\Sql\Sql($officeAdapter);
return array($officeAdapter, $officeSql);
}