Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Viewing Content Of Blob In phpMyAdmin

Sorry for the Noob Question, but what does the circled button mean, and how can I view the content of a blob? alt text
(source: rigel222.com)

like image 259
Joshua Avatar asked Feb 02 '10 22:02

Joshua


People also ask

What is BLOB phpmyadmin?

Most of the uses of blobs are for storing digital files in the database. This button allows you to upload a new file into the database. If you select a file and click "go" it will try to stuff the contents of that file into the blob column for you.

How can I change BLOB data in MySQL?

BLOB Editor is invoked from data grid of any table editor or the result tab of SQL Editor and Visual Query Builder by double clicking of the BLOB field to be edited or with the Edit BLOB link of the field's popup menu. The editor also can be called from BLOB Viewer with the Edit current BLOB button.


2 Answers

earlier versions of phpmyadmin had a setting called

$cfg['ShowBlob']              = TRUE; 

That would allow you to view the contents of blobs in the browser. You should note that this would cause chaos if you were storing binary files in blobs, since you would see endless gobblygok in the browser window. There are some people (like me) who decided that their application needed to use BLOB types to store text (seemed like a good decision at the time, and as I recall there was some thinking on my part that went into the decision). However phpmyadmin decided to discourage this by deprecating this config setting. Understandable since doing this might cause quite a support request. Apparently the thinking was to move people over the TEXT field types.

Happily displaying the contents of blobs has been moved into the user interface rather than the configuration.

The simplest way to see the contents of blobs when you are browsing is to click the link:

+ Options

Happily your screenshot already shows the + Options in the top part of the top image.

Which will display a form that will allow you to display blobs (and binaries). Click that and it will add it to your choice to the session, ensuring that you see the contents from then on.

You can also get the same result using print view:

Print view (with full texts)

Which lives at the bottom of the page.

Sadly both of these techniques are not helpful if you always want to display the blob, since it appears to reset frequently. You can fix this by adding the line

$_GET['display_blob'] = true; 

At the beginning of the sql.php file. I think there might be a better way to do this, and I hope someone else might bring it up...

(note: as Rodrigo pointed out you can manually achieve this effect by appending &display_bob=true on the URL)

Your specific question about the "Choose File" button is simple. Most of the uses of blobs are for storing digital files in the database. This button allows you to upload a new file into the database. If you select a file and click "go" it will try to stuff the contents of that file into the blob column for you.

Just to note, simply displaying the contents of the blob is probably not what other users want. When I look at the "blob summary" before I use this option to display the blobs I see blob sizes of 55 bytes max. Your example has bigger values, because it looks like you are storing very small text files, which I assume means paragraphs of text. If the size is bigger then 10's of kilo-bytes it is probably a binary file that will just display gooblegok.

If you want to download binary files intelligently (rather than displaying them as text) I think you need to look into what phpmyadmin calls blobstreaming.

like image 89
ftrotter Avatar answered Sep 24 '22 01:09

ftrotter


Put &display_blob=true on the end of your URL.

like image 38
Rodrigo Avatar answered Sep 22 '22 01:09

Rodrigo