diff --git a/bs_change_mime_type.php b/bs_change_mime_type.php index f9eb4e61c..e30fe1b78 100644 --- a/bs_change_mime_type.php +++ b/bs_change_mime_type.php @@ -43,13 +43,13 @@ // if BS plugins exist if ($PMA_Config->get('BLOBSTREAMING_PLUGINS_EXIST')) { - $mybs_ref_tbl = $PMA_Config->get('PBMS_NAME') . '_reference'; - $mybs_cust_content_type_tbl = $PMA_Config->get('PBMS_NAME') . '_custom_content_type'; + $pbms_ref_tbl = $PMA_Config->get('PBMS_NAME') . '_reference'; + $pbms_cust_content_type_tbl = $PMA_Config->get('PBMS_NAME') . '_custom_content_type'; // if specified DB is selected if (PMA_DBI_select_db($bsDB)) { - $query = "SELECT * FROM " . PMA_backquote($mybs_ref_tbl); + $query = "SELECT * FROM " . PMA_backquote($pbms_ref_tbl); $query .= " WHERE Blob_url='" . PMA_sqlAddslashes($bsReference) . "'"; $result = PMA_DBI_query($query); @@ -57,7 +57,7 @@ // if record exists if ($data = PMA_DBI_fetch_assoc($result)) { - $query = "SELECT count(*) FROM " . PMA_backquote($mybs_cust_content_type_tbl); + $query = "SELECT count(*) FROM " . PMA_backquote($pbms_cust_content_type_tbl); $query .= " WHERE Blob_url='" . PMA_sqlAddslashes($bsReference) . "'"; $result = PMA_DBI_query($query); @@ -67,12 +67,12 @@ { if (1 == $data['count(*)']) { - $query = "UPDATE " . PMA_backquote($mybs_cust_content_type_tbl) . " SET Content_type='"; + $query = "UPDATE " . PMA_backquote($pbms_cust_content_type_tbl) . " SET Content_type='"; $query .= PMA_sqlAddslashes($bsNewMIMEType) . "' WHERE Blob_url='" . PMA_sqlAddslashes($bsReference) . "'"; } else { - $query = "INSERT INTO " . PMA_backquote($mybs_cust_content_type_tbl) . " (Blob_url, Content_type)"; + $query = "INSERT INTO " . PMA_backquote($pbms_cust_content_type_tbl) . " (Blob_url, Content_type)"; $query .= " VALUES('" . PMA_sqlAddslashes($bsReference) . "', '" . PMA_sqlAddslashes($bsNewMIMEType) . "')"; } diff --git a/db_structure.php b/db_structure.php index b1ab16264..85bc310f5 100644 --- a/db_structure.php +++ b/db_structure.php @@ -190,7 +190,7 @@ $sum_row_count_pre = ''; // added by rajk - for blobstreaming $PMA_Config = $_SESSION['PMA_Config']; -if (!empty ($PMA_Config)) +if (!empty($PMA_Config)) $session_bs_tables = $PMA_Config->get('BLOBSTREAMING_TABLES'); // list of blobstreaming tables $tableReductionCount = 0; // the amount to reduce the table count by diff --git a/libraries/blobstreaming.lib.php b/libraries/blobstreaming.lib.php index d8616e9ff..d62e0c62f 100644 --- a/libraries/blobstreaming.lib.php +++ b/libraries/blobstreaming.lib.php @@ -95,7 +95,8 @@ function checkBLOBStreamingPlugins() // switch on BS field references if (strtolower($bs_variables[$PMA_Config->get('PBMS_NAME') . '_field_references']) == "off") - PMA_BS_SetFieldReferences('ON'); + if(!PMA_BS_SetFieldReferences('ON')) + return FALSE; // get BS server port $BS_PORT = $bs_variables[$PMA_Config->get('PBMS_NAME') . '_port']; @@ -437,10 +438,13 @@ function PMA_BS_SetFieldReferences($val) // set field references to value specified $query = "SET GLOBAL " . $PMA_Config->get('PBMS_NAME') . "_field_references=" . PMA_sqlAddslashes($val); - $result = PMA_DBI_query($query); + $result = PMA_DBI_try_query($query, null, 0); + + // get last known error (if applicable) + PMA_DBI_getError(); // return success of query execution - if ($result) + if ($result && 0 == $GLOBALS['errno']) return TRUE; else return FALSE;