2 /* vim: set expandtab sw=4 ts=4 sts=4: */
4 * Provides download to a given field defined in parameters.
12 // we don't want the usual PMA_Response-generated HTML above the column's data
13 define('PMA_BYPASS_GET_INSTANCE', 1);
14 require_once 'libraries/common.inc.php';
15 require_once 'libraries/mime.lib.php';
18 * Sets globals from $_GET
25 foreach ($get_params as $one_get_param) {
26 if (isset($_GET[$one_get_param])) {
27 $GLOBALS[$one_get_param] = $_GET[$one_get_param];
31 /* Check parameters */
32 PMA_Util
::checkParameters(
33 array('db', 'table', 'where_clause', 'transform_key')
37 if (!PMA_DBI_select_db($db)) {
39 sprintf(__('\'%s\' database does not exist.'), htmlspecialchars($db)),
44 /* Check if table exists */
45 if (!PMA_DBI_get_columns($db, $table)) {
46 PMA_Util
::mysqlDie(__('Invalid table name'));
50 $sql = 'SELECT ' . PMA_Util
::backquote($transform_key)
51 . ' FROM ' . PMA_Util
::backquote($table)
52 . ' WHERE ' . $where_clause . ';';
53 $result = PMA_DBI_fetch_value($sql);
55 /* Check return code */
56 if ($result === false) {
57 PMA_Util
::mysqlDie(__('MySQL returned an empty result set (i.e. zero rows).'), $sql);
60 /* Avoid corrupting data */
61 @ini_set
('url_rewriter.tags', '');
64 $table . '-' . $transform_key . '.bin',
65 PMA_detectMIME($result),