本文整理汇总了PHP中DBFactory::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP DBFactory::getInstance方法的具体用法?PHP DBFactory::getInstance怎么用?PHP DBFactory::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBFactory
的用法示例。
在下文中一共展示了DBFactory::getInstance方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* 构造方法
*
* @access public
* @param mixed $name
* @return mixed
*/
public function __construct($name)
{
$dbinfo = DBFactory::getDbInfo();
$this->tablePre = $dbinfo['tablePre'];
$this->table = $name;
$this->dbo = DBFactory::getInstance();
}
示例2: __construct
/**
* 构造方法
*
* @access public
* @param mixed $name
*/
public function __construct($name = null)
{
$this->db = DBFactory::getInstance();
$dbinfo = DBFactory::getDbInfo();
$this->prefix = $dbinfo['tablePre'];
$this->table($name);
}
示例3: __construct
public function __construct()
{
$this->db = DBFactory::getInstance();
$this->resultModel = new Model("result");
$this->resultListModel = new Model("result_list");
$this->examineResultModel = new Model("examine_result");
$config = Config::getInstance();
$this->jkf = $config->get('jkf');
}
示例4: update
public function update()
{
$updateFile = Tiny::getPath('data') . 'update.php';
$this->assign('status', '0');
if (file_exists($updateFile)) {
$updateInfo = (include $updateFile);
if (isset($updateInfo['version'])) {
$version = $updateInfo['version'];
$versionFile = APP_CODE_ROOT . 'version.php';
$currentVersion = (include $versionFile);
if ($currentVersion == $version[0]) {
$do = Req::args('do');
if ($do == 'yes') {
$dbinfo = DBFactory::getDbInfo();
$this->assign('status', '1');
if (isset($updateInfo['sql'][$dbinfo['type']])) {
$sqls = $updateInfo['sql'][$dbinfo['type']];
$db = DBFactory::getInstance();
if (is_array($sqls)) {
foreach ($sqls as $sql) {
$db->doSql($sql);
}
}
File::putContents($versionFile, "<?php return '{$version[1]}';?>");
unlink($updateFile);
$this->assign('info', '升级成功!');
} else {
$this->assign('info', '不支持' . $dbinfo['type'] . '数据库类型的升级!');
}
} else {
$this->assign('info', '系统可从当前版本:' . $currentVersion . '升级到' . $version[1]);
}
} else {
$this->assign('status', '-1');
$this->assign('info', '没有可升级的信息!');
}
} else {
$this->assign('status', '-1');
$this->assign('info', '没有可升级的信息!');
}
} else {
$this->assign('status', '-1');
$this->assign('info', '没有可升级的信息!');
}
$this->redirect();
}
示例5: set_exception_handler
<?php
include 'variables.php';
include 'functions.php';
include 'DBFactory.php';
// Top Level Exception handler
set_exception_handler('uncaught_exception_handler');
// Datenbank Objekt holen
$db = DBFactory::getInstance();
// Wenn es die Tabelle nicht gibt, dann soll diese erzeugt werden
$sql = 'CREATE TABLE IF NOT EXISTS Statistics (
`key` VARCHAR(50) NOT NULL,
`index` VARCHAR(50) NOT NULL,
`value` VARCHAR(50) NOT NULL)';
if (!($stmt = $db->prepare($sql))) {
echo 'ERROR: ' . $db->error;
return;
}
if (!$stmt->execute()) {
echo 'ERROR: ' . $stmt->error;
return;
}
$stmt->close();
// Variable zum auslesen des updatestrings
$update = "nothing defined";
// Wenn ein Updatestring übergeben wurde, ...
if (isset($_POST['update'])) {
// dann diesen auslesen
$update = $_POST['update'];
// Den updatestring splitten
$frags = array();
示例6: __construct
/**
* 构造函数
*
* @access public
* @return mixed
*/
public function __construct()
{
$this->db = DBFactory::getInstance();
}
示例7: __construct
function __construct()
{
$this->_tableName = "ctoken";
$this->_db = DBFactory::getInstance();
}