本文整理汇总了PHP中Db::getDb方法的典型用法代码示例。如果您正苦于以下问题:PHP Db::getDb方法的具体用法?PHP Db::getDb怎么用?PHP Db::getDb使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Db
的用法示例。
在下文中一共展示了Db::getDb方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Model
/**
* So far, it only initializes the connection to the database, using the ADOdb API.
*/
function Model()
{
$this->Object();
$this->_db =& Db::getDb();
// fetch the database prefix
$this->_prefix = Db::getPrefix();
$this->_db->debug = DAO_DEBUG_ENABLED;
}
示例2: ConfigDbStorage
/**
* Connects to the database using the parameters in the config file.
*
*/
function ConfigDbStorage($params = null)
{
// initialize the connection
$this->_db =& Db::getDb();
// get the prefix
$this->_dbPrefix = Db::getPrefix();
// and finally, load the whole data
$this->_loadData();
}
示例3: bb2_db_query
function bb2_db_query($query)
{
include_once PLOG_CLASS_PATH . "class/database/db.class.php";
$db =& Db::getDb();
$result = $db->Execute($query);
if (!$result) {
return false;
}
return $result;
}
示例4: PluginTopCommentVisitors
function PluginTopCommentVisitors()
{
$this->PluginBase();
$this->id = "topcommentvisitors";
$this->author = "Mark Wu";
$this->desc = "This plugin offers the rank list of visitors by number of comments.";
$this->prefix = Db::getPrefix();
$this->db =& Db::getDb();
$this->locales = array("en_UK", "zh_TW", "zh_CN");
$this->init();
}
示例5: getByUsername
public static function getByUsername($username)
{
$query = "SELECT * FROM Users WHERE username = :username";
$stmt = Db::getDb()->prepare($query);
$stmt->bindParam(":username", $username);
if ($stmt->execute() && ($row = $stmt->fetch())) {
$user = new User();
$user->initFromDb($row);
return $user;
}
return null;
}
示例6: _checkTables
/**
* @private
*/
function _checkTables()
{
// create the table to keep track of the voters, so that people cannot vote
// more than once
$fields = "\r\n\t\t\t id I(10) NOTNULL PRIMARY AUTOINCREMENT,\r\n\t\t\t recipients TEXT NOTNULL DEFAULT '',\n\t\t\t recipients_cc TEXT NOTNULL DEFAULT '',\n\t\t\t recipients_bcc TEXT NOTNULL DEFAULT '',\r\n\t\t\t subject C(255) NOTNULL DEFAULT '',\r\n\t\t\t body XL NOTNULL DEFAULT '',\r\n\t\t\t\t date T(14) DEFDATE\r\n\t\t\t\t ";
$db =& Db::getDb();
$dbPrefix = Db::getPrefix();
$tableName = $dbPrefix . "mailcentre_sent";
// create the data dictionary and create the table if necessary
$dict = NewDataDictionary($db);
$sqlArray = $dict->ChangeTableSQL($tableName, $fields);
$result = $dict->ExecuteSQLArray($sqlArray);
if (!$result) {
die("There was an error creating the plugin tables!");
}
return true;
}
示例7: _verifyTable
function _verifyTable()
{
$fields = "\n id I(11) NOTNULL PRIMARY AUTOINCREMENT,\n blogId I(11) NOTNULL KEY,\n active C(1) NOTNULL KEY,\n subject TEXT NOTNULL,\n responses TEXT NOTNULL,\n responsedata TEXT NOTNULL,\n dateadded I(11) NOTNULL";
$fields2 = "\n id I(11) NOTNULL KEY,\n ip I8 NOTNULL KEY,\n date I(11) NOTNULL KEY";
$db =& Db::getDb();
$dbPrefix = Db::getPrefix();
$tableName = $dbPrefix . "plogpoll_polls";
$tableName2 = $dbPrefix . "plogpoll_voterips";
$dict = NewDataDictionary($db);
$sqlAry = $dict->ChangeTableSQL($tableName, $fields);
$result = $dict->ExecuteSQLArray($sqlAry);
if (!$result) {
die("There was an error creating/updating plogpoll plugin tables!");
}
$sqlAry = $dict->ChangeTableSQL($tableName2, $fields2);
$result = $dict->ExecuteSQLArray($sqlAry);
if (!$result) {
die("There was an error creating/updating plogpoll plugin tables!");
}
}
示例8: getById
public static function getById($id)
{
$modelClass = get_called_class();
$tableName = $modelClass . "s";
$query = "\tSELECT\t*\n\t\t\t\t\t\tFROM\t{$tableName}\n\t\t\t\t\t\tWHERE\tid = :id";
$stmt = Db::getDb()->prepare($query);
$stmt->bindParam(":id", $id);
if ($stmt->execute() && ($row = $stmt->fetch())) {
$model = new $modelClass();
$model->initFromDb($row);
return $model;
}
return null;
}
示例9: newPost
include_once PLOG_CLASS_PATH . "class/object/object.class.php";
include_once PLOG_CLASS_PATH . "class/net/xmlrpc/IXR_Library.lib.php";
include_once PLOG_CLASS_PATH . "class/config/config.class.php";
include_once PLOG_CLASS_PATH . "class/database/db.class.php";
include_once PLOG_CLASS_PATH . "class/dao/users.class.php";
include_once PLOG_CLASS_PATH . "class/dao/article.class.php";
include_once PLOG_CLASS_PATH . "class/dao/articles.class.php";
include_once PLOG_CLASS_PATH . "class/dao/articlecategories.class.php";
include_once PLOG_CLASS_PATH . "class/dao/users.class.php";
include_once PLOG_CLASS_PATH . "class/dao/blogs.class.php";
include_once PLOG_CLASS_PATH . "class/template/cachecontrol.class.php";
include_once PLOG_CLASS_PATH . "class/gallery/dao/galleryresources.class.php";
include_once PLOG_CLASS_PATH . "class/plugin/pluginmanager.class.php";
// init database
$_db = new Db();
$adodb = $_db->getDb();
// config object
$config =& Config::getConfig();
// users object
$users = new Users();
// articles object
$articles = new Articles();
// category object
$category = new ArticleCategories();
// blog object
$blogsG = new Blogs();
function newPost($args)
{
global $users, $articles, $blogsG;
$appkey = $args[0];
$blogid = $args[1];