本文整理汇总了PHP中DBFactory::get_db_connection方法的典型用法代码示例。如果您正苦于以下问题:PHP DBFactory::get_db_connection方法的具体用法?PHP DBFactory::get_db_connection怎么用?PHP DBFactory::get_db_connection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBFactory
的用法示例。
在下文中一共展示了DBFactory::get_db_connection方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
public function setUp()
{
$this->test_table = PREFIX . 'test_table';
$connection = DBFactory::get_db_connection();
$sql_querier = DBFactory::new_sql_querier($connection);
$this->dbms_utils = new MySQLDBMSUtils($sql_querier);
$this->querier = new DBQuerier($sql_querier);
$this->drop_test_table();
$this->create_test_table();
$this->populate_test_table();
}
示例2: setUp
public function setUp()
{
self::$test_table1 = PREFIX . 'test_table_1';
self::$test_table2 = PREFIX . 'test_table_2';
$connection = DBFactory::get_db_connection();
self::$querier = DBFactory::new_sql_querier($connection);
self::$querier->disable_query_translator();
self::$dbms_utils = new MySQLDBMSUtils(self::$querier);
self::$querier->inject("DROP TABLE IF EXISTS `" . self::$test_table1 . "`");
self::$querier->inject("CREATE TABLE `" . self::$test_table1 . "` (\n\t\t\t `id` int(11) NOT NULL auto_increment,\n\t\t\t `ip` varchar(50) NOT NULL default '',\n\t\t\t `time` date NOT NULL default '0000-00-00',\n\t\t\t `total` int(11) NOT NULL default '0',\n\t\t\t PRIMARY KEY (`id`),\n\t\t\t KEY `ip` (`ip`)\n\t\t\t) ENGINE=MyISAM DEFAULT CHARSET=latin1;");
self::$querier->inject("INSERT INTO `" . self::$test_table1 . "` (`ip`, `time`, `total`) VALUES (:ip, NOW(), :total)", array('ip' => '127.0.0.1', 'total' => 42));
self::$querier->inject("INSERT INTO `" . self::$test_table1 . "` (`ip`, `time`, `total`) VALUES (:ip, DATE(:time), :total)", array('ip' => '127.0.0.2', 'time' => '2003-12-31 01:02:03', 'total' => 37));
self::$querier->inject("INSERT INTO `" . self::$test_table1 . "` (`ip`, `time`, `total`) VALUES (:ip, CURDATE(), :total)", array('ip' => '127.0.0.3', 'total' => 1764));
self::$querier->inject("DROP TABLE IF EXISTS `" . self::$test_table2 . "`");
self::$querier->inject("CREATE TABLE `" . self::$test_table2 . "` (\n\t\t\t `pk` int(11) NOT NULL auto_increment,\n\t\t\t `name` varchar(50) NOT NULL default '',\n\t\t\t PRIMARY KEY (`pk`)\n\t\t\t) ENGINE=MyISAM DEFAULT CHARSET=latin1;");
}
示例3: get_sql_querier
/**
* Returns the sql querier
* @return SQLQuerier
*/
private static function get_sql_querier()
{
if (self::$sql_querier === null) {
self::$sql_querier = DBFactory::new_sql_querier(DBFactory::get_db_connection());
}
return self::$sql_querier;
}