Prev | Current Page 103 | Next

Marc Delisle

"Mastering phpMyAdmin 2.11 for Effective MySQL Management"


BLOB (Binary Large Object) Fields
BLOB fields are usually used to hold binary data (such as images and sounds), even
though the MySQL documentation implies that TEXT fields could be used for this
purpose. The MySQL 5.1 manual says "In some cases, it may be desirable to store
binary data such as media files in BLOB or TEXT columns" but another phrase,
"BLOB columns are treated as binary strings (byte strings)" seems to indicate that
binary data should really be stored in BLOB fields. Thus, phpMyAdmin's intention
is to work with BLOB fields to hold all binary data.
We will see in Chapter 16, MIME-Based Transformations that there are special
mechanisms available to go further with BLOB fields, including being able to view
some images directly from within phpMyAdmin.
First we add a BLOB field, cover_photo, to our book table:
Changing Table Structures
[ 102 ]
If we now browse the table, we can see the field length information, [BLOB ??“ 0 B],
for each BLOB field:
This is because the $cfg['ShowBlob'] configuration directive is set to FALSE by
default, thus blocking the display of BLOB contents in Browse and Edit modes (and
showing a Binary - do not edit warning). This behavior is intentional??”usually we
cannot do anything with binary data represented in plain text.
Binary Contents Uploads
If we now edit one row, we see the warning and a Browse??¦ button.


Pages:
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115