Temporary fix applied for issue regarding BLOBStreaming support requiring SUPER privilege

This commit is contained in:
Raj Kissu Rajandran
2008-11-28 18:55:28 +00:00
parent e079480672
commit 4a0c232707
3 changed files with 14 additions and 10 deletions

View File

@@ -43,13 +43,13 @@
// if BS plugins exist // if BS plugins exist
if ($PMA_Config->get('BLOBSTREAMING_PLUGINS_EXIST')) if ($PMA_Config->get('BLOBSTREAMING_PLUGINS_EXIST'))
{ {
$mybs_ref_tbl = $PMA_Config->get('PBMS_NAME') . '_reference'; $pbms_ref_tbl = $PMA_Config->get('PBMS_NAME') . '_reference';
$mybs_cust_content_type_tbl = $PMA_Config->get('PBMS_NAME') . '_custom_content_type'; $pbms_cust_content_type_tbl = $PMA_Config->get('PBMS_NAME') . '_custom_content_type';
// if specified DB is selected // if specified DB is selected
if (PMA_DBI_select_db($bsDB)) 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) . "'"; $query .= " WHERE Blob_url='" . PMA_sqlAddslashes($bsReference) . "'";
$result = PMA_DBI_query($query); $result = PMA_DBI_query($query);
@@ -57,7 +57,7 @@
// if record exists // if record exists
if ($data = PMA_DBI_fetch_assoc($result)) 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) . "'"; $query .= " WHERE Blob_url='" . PMA_sqlAddslashes($bsReference) . "'";
$result = PMA_DBI_query($query); $result = PMA_DBI_query($query);
@@ -67,12 +67,12 @@
{ {
if (1 == $data['count(*)']) 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) . "'"; $query .= PMA_sqlAddslashes($bsNewMIMEType) . "' WHERE Blob_url='" . PMA_sqlAddslashes($bsReference) . "'";
} }
else 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) . "')"; $query .= " VALUES('" . PMA_sqlAddslashes($bsReference) . "', '" . PMA_sqlAddslashes($bsNewMIMEType) . "')";
} }

View File

@@ -95,7 +95,8 @@ function checkBLOBStreamingPlugins()
// switch on BS field references // switch on BS field references
if (strtolower($bs_variables[$PMA_Config->get('PBMS_NAME') . '_field_references']) == "off") 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 // get BS server port
$BS_PORT = $bs_variables[$PMA_Config->get('PBMS_NAME') . '_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 // set field references to value specified
$query = "SET GLOBAL " . $PMA_Config->get('PBMS_NAME') . "_field_references=" . PMA_sqlAddslashes($val); $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 // return success of query execution
if ($result) if ($result && 0 == $GLOBALS['errno'])
return TRUE; return TRUE;
else else
return FALSE; return FALSE;