Пример #1
0
 public function saveConfig($key, $value)
 {
     $db = new MainDB();
     $conn = $db->getConnection();
     $stmt = $conn->prepare(self::$UPDATE);
     $stmt->bindValue(':value', $value);
     $stmt->bindValue(':key', $key);
     $stmt->execute();
     $error = $stmt->errorInfo();
 }
Пример #2
0
 public static function getInstance()
 {
     if (!self::$mainDataStore) {
         self::$mainDataStore = new MainDB();
         return self::$mainDataStore;
     }
     return self::$mainDataStore;
 }
Пример #3
0
 public function __construct()
 {
     self::$db = MainDB::getInstance();
 }
Пример #4
0
 public function executeAttributeQuery($attributes, $colValuePair, $isApplyFilter = false)
 {
     foreach ($colValuePair as $key => $value) {
         if ($value != '') {
             $query_array[] = $key . ' = ' . "'" . $value . "'";
         }
     }
     $columns = implode(", ", $attributes);
     $query = "SELECT " . $columns . " FROM " . $this->tableName . " WHERE " . implode(" AND ", $query_array);
     if ($isApplyFilter) {
         $query = FilterUtil::applyFilter($query, false);
     }
     $db = MainDB::getInstance();
     $conn = $db->getConnection();
     $sth = $conn->prepare($query);
     $sth->execute();
     //$this->throwException($sth->errorInfo());
     $objList = $sth->fetchAll();
     return $objList;
 }