当前位置: 首页>>代码示例>>PHP>>正文


PHP Mysql::getInstance方法代码示例

本文整理汇总了PHP中Mysql::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP Mysql::getInstance方法的具体用法?PHP Mysql::getInstance怎么用?PHP Mysql::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mysql的用法示例。


在下文中一共展示了Mysql::getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: is_answered

function is_answered($task_id)
{
    $uid = (int) $_SESSION['uid'];
    $sql = "select * from moderators_history where task_id={$task_id} && to_usr!=from_usr order by id desc limit 0,1;";
    $from_usr = Mysql::getInstance()->query($sql)->first('from_usr');
    return $from_usr == $uid;
}
开发者ID:Eugen1985,项目名称:stalker_portal,代码行数:7,代码来源:tasks.php

示例2: __construct

 public function __construct()
 {
     $this->mysqlInstance = \Mysql::getInstance();
     $this->reseller_id = NULL;
     $this->admin_id = NULL;
     $this->admin_login = NULL;
 }
开发者ID:Eugen1985,项目名称:stalker_portal,代码行数:7,代码来源:BaseStalkerModel.php

示例3: check

 public function check($page, $action = 'view')
 {
     if ($this->admin->getLogin() == 'admin') {
         return true;
     }
     return (bool) Mysql::getInstance()->from('acl')->where(array('gid' => $this->admin->getGID(), 'page' => $page, 'acl.' . $action => 1))->get()->first();
 }
开发者ID:Eugen1985,项目名称:stalker_portal,代码行数:7,代码来源:adminaccess.class.php

示例4: getInstance

 public static function getInstance($id = false)
 {
     if (!$id) {
         foreach (self::$connectionData as $k => $v) {
             $idC = $k;
             break;
         }
     } else {
         $idC = $id;
     }
     $connection = Model::getConnectionData($idC);
     $database = NULL;
     // Debug::print_r("getInstance $id ", $connection);
     if (Run::MYSQL === true && $connection['type_db'] == "mysql") {
         $database = Mysql::getInstance($id);
         if ($id) {
             Mysql::setActive($id);
         }
         self::$query = new MysqlQuery($id);
         return $database;
     } else {
         if (Run::POSTGRE === true && $connection['type_db'] == "postgre") {
             $database = Postgre::getInstance($id);
             if ($id) {
                 Postgre::setActive($id);
             }
             self::$query = new PostgreQuery($id);
             return $database;
         } else {
             return false;
         }
     }
 }
开发者ID:obscurun,项目名称:run-dev,代码行数:33,代码来源:model.php

示例5: delete

 public function delete(RESTApiRequest $request, $parent_id)
 {
     $user = \Mysql::getInstance()->from('users')->where(array('id' => $parent_id))->get()->first();
     if (!empty($user['now_playing_link_id'])) {
         switch ($user['now_playing_type']) {
             case 1:
                 // tv
                 if (time() - strtotime($user['now_playing_start']) > 30 * 60) {
                     // more then 30 min
                     \Mysql::getInstance()->insert('played_itv', array('itv_id' => $user['now_playing_link_id'], 'uid' => $parent_id, 'playtime' => 'NOW()', 'user_locale' => $user['locale']));
                 }
                 break;
             case 2:
                 // video
                 if (time() - strtotime($user['now_playing_start']) > 60 * 60) {
                     // more then 1 hour (70% can't be counted)
                     \Mysql::getInstance()->insert('played_video', array('video_id' => $user['now_playing_link_id'], 'uid' => $parent_id, 'playtime' => 'NOW()'));
                 }
                 break;
             case 11:
                 // tvarchive
                 if (time() - strtotime($user['now_playing_start']) > 60) {
                     // more then 1 min
                     $program = \Mysql::getInstance()->from('epg')->where(array('id' => $user['now_playing_link_id']))->get()->first();
                     if (!empty($program)) {
                         \Mysql::getInstance()->insert('played_tv_archive', array('ch_id' => $program['ch_id'], 'uid' => $parent_id, 'playtime' => 'NOW()', 'length' => time() - strtotime($user['now_playing_start'])));
                     }
                 }
                 break;
         }
     }
     return \Mysql::getInstance()->update('users', array('now_playing_type' => '', 'now_playing_content' => '', 'last_active' => 'NOW()'), array('id' => $parent_id))->result();
 }
开发者ID:saydulk,项目名称:stalker_portal,代码行数:33,代码来源:restapiusermediainfo.class.php

示例6: set_karaoke_returned

function set_karaoke_returned($id, $val, $txt)
{
    if (!$id) {
        return;
    }
    Mysql::getInstance()->update('karaoke', array('returned' => $val, 'reason' => $txt, 'done' => intval(!$val)), array('id' => $id));
}
开发者ID:Eugen1985,项目名称:stalker_portal,代码行数:7,代码来源:last_closed_karaoke.php

示例7: get_users_count_in_tariff

function get_users_count_in_tariff($tariff)
{
    $tariff_ids = array($tariff['id']);
    if ($tariff['user_default'] == 1) {
        $tariff_ids[] = 0;
    }
    return Mysql::getInstance()->from('users')->count()->in('tariff_plan_id', $tariff_ids)->get()->counter();
}
开发者ID:Eugen1985,项目名称:stalker_portal,代码行数:8,代码来源:tariffs.php

示例8: MysqlQuery

 function MysqlQuery($id)
 {
     $this->query_string = "";
     $this->_line = __LINE__;
     $this->_function = __FUNCTION__;
     $this->_class = __CLASS__;
     $this->_file = __FILE__;
     $this->mysql = Mysql::getInstance($id);
 }
开发者ID:obscurun,项目名称:run-dev,代码行数:9,代码来源:mysql_query.php

示例9: executeSql

 public function executeSql($file)
 {
     $fileInfo = file_get_contents($file);
     $sql = $this->parseSql($fileInfo);
     unset($fileInfo);
     $mysql = Mysql::getInstance();
     foreach ($sql as $s) {
         $mysql->execute($s);
     }
 }
开发者ID:swg0110,项目名称:iBarn,代码行数:10,代码来源:Install.class.php

示例10: filter

 private function filter($profile)
 {
     if (empty($profile)) {
         throw new RESTNotFound("User not found");
     }
     $profile = array_intersect_key($profile, $this->fields_map);
     $themes = \Middleware::getThemes();
     $profile['theme'] = empty($profile['theme']) || !array_key_exists($profile['theme'], $themes) ? \Mysql::getInstance()->from('settings')->get()->first('default_template') : $profile['theme'];
     $profile['themes'] = $themes;
     return $profile;
 }
开发者ID:Eugen1985,项目名称:stalker_portal,代码行数:11,代码来源:restapiusersettings.class.php

示例11: __construct

 public function __construct()
 {
     $this->db = Mysql::getInstance();
     $this->xml_url = $this->xml_url . '?' . time();
     $this->weekday_arr = array('', _('Sun'), _('Mon'), _('Tue'), _('Wed'), _('Thu'), _('Fri'), _('Sat'));
     $this->tod_arr = array(_('Night'), _('Morning'), _('Day'), _('Evening'));
     $this->month_arr = array('', _('Jan'), _('Feb'), _('Mar'), _('Apr'), _('May'), _('Jun'), _('Jul'), _('Aug'), _('Sep'), _('Oct'), _('Nov'), _('Dec'));
     $this->cloudiness_arr = array(_('clear'), _('partly cloudy'), _('cloudy'), _('overcast'));
     $this->precipitation_arr = array('', '', '', '', _('rain'), _('rainfall'), _('snow'), _('snow'), _('thunderstorm'), _('no data'), _('w/o precipitation'));
     $this->direction_arr = array('N', 'NE', 'E', 'SE', 'S', 'SW', 'W', 'NW');
 }
开发者ID:Eugen1985,项目名称:stalker_portal,代码行数:11,代码来源:gismeteo.class.php

示例12: update

 public function update(RESTRequest $request)
 {
     $stb_list = $request->getConvertedIdentifiers();
     if (empty($stb_list)) {
         throw new RESTCommandException('Empty stb list');
     }
     foreach ($stb_list as $uid) {
         Mysql::getInstance()->update('users', array('access_token' => strtoupper(md5(microtime(1) . uniqid()))), array('id' => $uid));
         Mysql::getInstance()->update('access_tokens', array('token' => 'invalid_' . md5(microtime(1) . uniqid()), 'refresh_token' => 'invalid_' . md5(microtime(1) . uniqid())), array('uid' => $uid));
     }
     return true;
 }
开发者ID:saydulk,项目名称:stalker_portal,代码行数:12,代码来源:restcommandstbauth.class.php

示例13: setOff

 public function setOff()
 {
     $this->checkIfInitialized();
     if ($this->storage['status'] == 0) {
         return true;
     }
     $result = Mysql::getInstance()->update('storages', array('status' => 0), array('id' => $this->storage['id']));
     if ($result) {
         Mysql::getInstance()->insert('master_log', array('log_txt' => "Storage " . $this->storage['storage_name'] . " has been disabled after " . $this->max_failures . " failures in " . $this->stat_period . "s", 'added' => 'NOW()'));
     }
     return $result;
 }
开发者ID:Eugen1985,项目名称:stalker_portal,代码行数:12,代码来源:storage.class.php

示例14: getCollectionByAttribute

 public function getCollectionByAttribute($attribute, $like)
 {
     $bdd = Mysql::getInstance();
     $select = 'SELECT id FROM chauffeurs where ' . $attribute . ' LIKE "%' . $like . '%"';
     $req = $bdd->prepare($select);
     $req->execute();
     $chauffeurs = array();
     foreach ($req->fetchAll() as $row) {
         $chauffeur = new Chauffeurs();
         $chauffeur->load($row["id"]);
         $chauffeurs[] = $chauffeur;
     }
     return $chauffeurs;
 }
开发者ID:Khaes,项目名称:Cpcsi_chauffeurs,代码行数:14,代码来源:Chauffeurs.php

示例15: writePackageSubscribeLog

 public static function writePackageSubscribeLog($user_id, $package_id, $set_state)
 {
     $data = array('user_id' => $user_id, 'set_state' => $set_state, 'package_id' => $package_id);
     if (!empty(Stb::getInstance()->id) && (empty($_SERVER['TARGET']) || $_SERVER['TARGET'] !== 'API' && $_SERVER['TARGET'] !== 'ADM')) {
         $data['initiator_id'] = Stb::getInstance()->id;
         $data['initiator'] = 'user';
     } else {
         $data['initiator_id'] = Admin::getInstance()->getId();
         if (!empty($data['initiator_id'])) {
             $data['initiator'] = 'admin';
         }
     }
     Mysql::getInstance()->insert('package_subscribe_log', $data);
 }
开发者ID:Eugen1985,项目名称:stalker_portal,代码行数:14,代码来源:log.class.php


注:本文中的Mysql::getInstance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。