Пример #1
0
 /**
  * Shorthand fetch single row using specified column and value.
  *
  * @param string $tableName
  *            The name of the table to select from.
  * @param string $column
  *            (optional) Column name to query on.
  * @param integer $value
  *            (optional) The value of the column.
  * @return An associative array of the table row.
  */
 public static function get($tableName, $column = null, $value = null)
 {
     $sth = DKY_DB::build($tableName);
     if (!empty($column) && !empty($value)) {
         $sth->where("`" . $column . "` = :" . $column . "", $column, $value);
     }
     return $sth->find(true);
 }
Пример #2
0
 public function getGroups($bShort = false)
 {
     $do_group = DKY_DB::build("group");
     $do_group->find();
     $aGroups = array();
     while ($aGroup = $do_group->fetch()) {
         if (!$bShort) {
             $aGroups[$aGroup["group_id"]] = $aGroup;
         } else {
             $aGroups[$aGroup["group_id"]] = $aGroup["label"];
         }
     }
     return $aGroups;
 }
Пример #3
0
 public static function deleteItemGroups($itemId)
 {
     $do_item_group = DKY_DB::build("item_group");
     $do_item_group->where("`item_id` = :itemId", "itemId", $itemId);
     return $do_item_group->delete();
 }