本文整理匯總了PHP中Driver::getDriver方法的典型用法代碼示例。如果您正苦於以下問題:PHP Driver::getDriver方法的具體用法?PHP Driver::getDriver怎麽用?PHP Driver::getDriver使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Driver
的用法示例。
在下文中一共展示了Driver::getDriver方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: _getDriver
/**
* Load database driver to query for results
**/
private function _getDriver()
{
require_once APPPATH . 'libraries/scaffolder/drivers/driver' . EXT;
return Driver::getDriver();
}
示例2: testDriver
/**
* Verify if database driver is functional
*/
public function testDriver()
{
require BASEPATH . 'codeigniter/Common' . EXT;
require BASEPATH . 'codeigniter/Compat' . EXT;
require APPPATH . 'config/constants' . EXT;
require BASEPATH . 'codeigniter/Base5' . EXT;
require_once APPPATH . 'libraries/scaffolder/drivers/driver' . EXT;
$test_table = 'cidade';
$num_fields = 4;
$pk = "id";
$driver = Driver::getDriver();
$tables = $driver->getTables();
$this->assert(in_array($test_table, $tables), true, "Show test table");
$fields = $driver->getFields($test_table);
$this->assert(count($fields), $num_fields, "Display {$num_fields} fields");
$primary_key = $this->getTablePK($fields);
$this->assertNotNull($primary_key, "Has primary key");
$this->assert($primary_key->getName(), $pk, "Primary Key equals {$pk}");
}