本文整理汇总了PHP中DBFactory类的典型用法代码示例。如果您正苦于以下问题:PHP DBFactory类的具体用法?PHP DBFactory怎么用?PHP DBFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DBFactory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($id)
{
$myDB = new DBFactory();
$this->sql = $myDB->getMysqlConnexionWithPDO();
$this->classes = $this->getClasses();
$this->id = $id;
}
示例2: getRole
function getRole($role)
{
$myDB = new DBFactory();
$sql = $myDB->getMysqlConnexionWithPDO();
$query = $sql->prepare("SELECT id, login, role FROM users WHERE role = :role AND login != :me");
$query->execute(array('role' => $role, 'me' => $_SESSION['user']));
return $query->fetchAll();
}
示例3: getCharacters
function getCharacters()
{
$myDB = new DBFactory();
$sql = $myDB->getMysqlConnexionWithPDO();
$query = $sql->prepare("SELECT chars.*, class.name AS className, spec1.role_name AS role1, spec2.role_name AS role2 FROM chars, specs AS spec1, specs AS spec2, class WHERE chars.spec1 = spec1.id AND chars.spec2 = spec2.id AND spec1.class_id = class.id");
$query->execute();
return $query->fetchAll();
}
示例4: ec_update_value
/**
* Wrapper to do all to work. Updates the items table based on the cached or live data.
*/
function ec_update_value($item_id)
{
$query = DBFactory::getDBQuery();
// Don't try if we can't open URLs with fopen.
// Do to!
// if (1 != function_exists('curl_init')) {
// return;
// }
// Don't try if the item id isn't an integer.
if (!is_numeric($item_id)) {
return;
}
// Verify we have a sync table to use.
verify_sync_table();
// The destroyed items etc feed in the -internal- killboard item ID.
// EVE Central needs the external ID if we have it.
$query->execute("SELECT typeID FROM kb3_invtypes WHERE typeID={$item_id}");
$data = $query->getRow();
$e_item_id = $data['typeID'];
// Don't try if the item id isn't an integer or it's 0.
if (!is_numeric($e_item_id) or 0 == $e_item_id) {
return;
}
file_put_contents(KB_CACHEDIR . '/evecentral/activity.log', "Request for {$item_id} -> {$e_item_id}\n", FILE_APPEND);
$value = ec_get_value($e_item_id);
if (-99 != $value) {
$query->execute("update kb3_item_price set price='{$value}' WHERE typeID={$item_id}");
return true;
} else {
file_put_contents(KB_CACHEDIR . '/evecentral/activity.log', "Failed to find it.\n", FILE_APPEND);
}
return false;
}
示例5: getInstance
public static function getInstance()
{
if (!DBFactory::$_instance instanceof MysqliDb) {
DBFactory::$_instance = new MysqliDB();
}
return DBFactory::$_instance;
}
示例6: updateChars
private function updateChars()
{
if (empty($this->chars)) {
return $this->chars;
}
foreach ($this->chars as $char) {
// check if chars eveid exists in kb
$sql = 'select plts.plt_id, plts.plt_externalid from kb3_pilots plts where plts.plt_name = "' . $char['Name'] . '"';
$qry = DBFactory::getDBQuery();
$qry->execute($sql);
if ($qry->recordCount() != 0) {
// pilot is in kb db, check he has his char id
$row = $qry->getRow();
$pilot_id = $row['plt_id'];
$pilot_external_id = $row['plt_externalid'];
if ($pilot_external_id == 0 && $pilot_id != 0) {
// update DB with ID
$qry->execute("UPDATE kb3_pilots SET plt_externalid = " . intval($char['charID']) . "\n WHERE plt_id = " . $pilot_id);
}
} else {
// pilot is not in DB
// Set Corp
$pilotscorp = Corporation::lookup($char['corpName']);
// Check Corp was set, if not, add the Corp
if (!$pilotscorp->getID()) {
$ialliance = Alliance::add('None');
$pilotscorp = Corporation::add($char['corpName'], $ialliance, gmdate("Y-m-d H:i:s"));
}
Pilot::add($char['Name'], $pilotscorp, gmdate("Y-m-d H:i:s"), intval($char['charID']));
}
}
return;
}
示例7: update014
function update014()
{
global $url, $smarty;
//Checking if this Update already done
if (CURRENT_DB_UPDATE < "014") {
if (is_null(config::get('014updatestatus'))) {
config::set('014updatestatus', 0);
}
$qry = DBFactory::getDBQuery(true);
if (config::get('014updatestatus') < 1) {
// Add killmail summary. time, hash, trust.
$sql = 'CREATE TABLE IF NOT EXISTS `kb3_mails` (
`kll_id` int(11) NOT NULL auto_increment,
`kll_timestamp` datetime NOT NULL default "0000-00-00 00:00:00",
`kll_external_id` int(8) default NULL,
`kll_hash` BINARY(16) NOT NULL,
`kll_trust` TINYINT NOT NULL DEFAULT 0,
PRIMARY KEY (`kll_id`),
UNIQUE KEY `external_id` (`kll_external_id`),
UNIQUE KEY `time_hash` (`kll_timestamp`,`kll_hash`)
) Engine=InnoDB';
$qry->execute($sql);
}
killCache();
config::set("DBUpdate", "014");
$qry->execute("INSERT INTO kb3_config (cfg_site, cfg_key, cfg_value) SELECT cfg_site, 'DBUpdate', '014' FROM kb3_config GROUP BY cfg_site ON DUPLICATE KEY UPDATE cfg_value = '014'");
config::del("014updatestatus");
$smarty->assign('refresh', 1);
$smarty->assign('content', "Update 014 completed.");
$smarty->display('update.tpl');
die;
}
}
示例8: getLanguage
public function getLanguage()
{
if (!$this->language instanceof Language && is_numeric($this->language)) {
$this->language = DBFactory::get('languages')->get($this->language);
}
return $this->language;
}
示例9: update016
/**
* @package EDK
*/
function update016()
{
global $url, $smarty;
//Checking if this Update already done
if (CURRENT_DB_UPDATE < "016") {
$qry = DBFactory::getDBQuery(true);
$sql = "ALTER TABLE `kb3_mails` ADD `kll_modified_time` DATETIME NOT NULL ";
$qry->execute("SHOW COLUMNS FROM kb3_mails LIKE 'kll_modified_time'");
if (!$qry->recordCount()) {
$qry->execute($sql);
}
$sql = "ALTER TABLE `kb3_mails` ADD INDEX ( `kll_modified_time` ) ";
$qry->execute("SHOW INDEXES FROM kb3_mails");
$indexexists = false;
while ($testresult = $qry->getRow()) {
if ($testresult['Column_name'] == 'kll_modified_time') {
$indexexists = true;
}
}
if (!$indexexists) {
$qry->execute($sql);
}
config::set("DBUpdate", "016");
$qry->execute("INSERT INTO kb3_config (cfg_site, cfg_key, cfg_value) SELECT cfg_site, 'DBUpdate', '016' FROM kb3_config GROUP BY cfg_site ON DUPLICATE KEY UPDATE cfg_value = '016'");
$smarty->assign('refresh', 1);
$smarty->assign('content', "Update 016 completed.");
$smarty->display('update.tpl');
die;
}
}
示例10: __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();
}
示例11: update034
/**
* @package EDK
*/
function update034()
{
global $url, $smarty;
//Checking if this Update already done
if (CURRENT_DB_UPDATE < "034") {
if (is_null(config::get('034updatestatus'))) {
config::set('034updatestatus', 0);
}
$qry = DBFactory::getDBQuery(true);
if (config::get('034updatestatus') < 1) {
$qry->execute("SHOW COLUMNS FROM kb3_invtypes LIKE 'radius'");
if ($qry->recordCount()) {
$sql = "ALTER TABLE `kb3_invtypes` DROP COLUMN `radius` ";
$qry->execute($sql);
}
}
config::set("DBUpdate", "034");
$qry->execute("INSERT INTO kb3_config (cfg_site, cfg_key, cfg_value) SELECT cfg_site, 'DBUpdate', '034' FROM kb3_config GROUP BY cfg_site ON DUPLICATE KEY UPDATE cfg_value = '034'");
config::del("034updatestatus");
$smarty->assign('refresh', 1);
$smarty->assign('content', "Update 034 completed.");
$smarty->display('update.tpl');
die;
}
}
示例12: getAdmin
public function getAdmin()
{
if (is_null($this->admin)) {
$this->admin = DBFactory::get('admins')->get($this->getSessionParam('admin'));
}
return $this->admin;
}
示例13: execQuery
function execQuery()
{
$qry = DBFactory::getDBQuery();
$qry->execute("select * from kb3_regions where reg_id = " . $this->id);
$row = $qry->getRow();
$this->name = $row['reg_name'];
$this->coords = array($row['reg_x'], $row['reg_y'], $row['reg_z']);
}
示例14: ItemList
/**
*
* @param array $itemarray
* @param float $price
*/
function ItemList($itemarray = null, $price = 0)
{
if (isset($itemarray)) {
$this->itemarray = $itemarray;
}
$this->price = $price;
$this->qry = DBFactory::getDBQuery();
}
示例15: getShipClassIDByName
public static function getShipClassIDByName($shipClassName)
{
$query = "SELECT scl_id FROM kb3_ship_classes WHERE scl_class = '{$shipClassName}'";
$qry = DBFactory::getDBQuery();
$qry->execute($query);
$shipClassId = $qry->getRow();
return $shipClassId["scl_id"];
}