PMA\libraries\Bookmark::get PHP Метод

get() публичный статический Метод

Retrieve a specific bookmark
public static get ( string $db, mixed $id, string $id_field = 'id', boolean $action_bookmark_all = false, boolean $exact_user_match = false ) : Bookmark
$db string the current database name
$id mixed an identifier of the bookmark to get
$id_field string which field to look up the identifier
$action_bookmark_all boolean true: get all bookmarks regardless of the owning user
$exact_user_match boolean whether to ignore bookmarks with no user
Результат Bookmark the bookmark
    public static function get($db, $id, $id_field = 'id', $action_bookmark_all = false, $exact_user_match = false)
    {
        global $controllink;
        $cfgBookmark = self::getParams();
        if (empty($cfgBookmark)) {
            return null;
        }
        $query = "SELECT * FROM " . Util::backquote($cfgBookmark['db']) . "." . Util::backquote($cfgBookmark['table']) . " WHERE dbase = '" . $GLOBALS['dbi']->escapeString($db) . "'";
        if (!$action_bookmark_all) {
            $query .= " AND (user = '" . $GLOBALS['dbi']->escapeString($cfgBookmark['user']) . "'";
            if (!$exact_user_match) {
                $query .= " OR user = ''";
            }
            $query .= ")";
        }
        $query .= " AND " . Util::backquote($id_field) . " = " . $GLOBALS['dbi']->escapeString($id) . " LIMIT 1";
        $result = $GLOBALS['dbi']->fetchSingleRow($query, 'ASSOC', $controllink);
        if (!empty($result)) {
            $bookmark = new Bookmark();
            $bookmark->_id = $result['id'];
            $bookmark->_database = $result['dbase'];
            $bookmark->_user = $result['user'];
            $bookmark->_label = $result['label'];
            $bookmark->_query = $result['query'];
            return $bookmark;
        }
        return null;
    }

Usage Example

Пример #1
0
 /**
  * Tests for Bookmark::get()
  *
  * @return void
  */
 public function testGet()
 {
     $this->assertNull(Bookmark::get('phpmyadmin', '1'));
 }
All Usage Examples Of PMA\libraries\Bookmark::get