How to using BLOB by Rev2.0 & MySQL4.1

Jan Schenkel janschenkel at yahoo.com
Wed Jun 18 07:02:02 EDT 2003


--- Rev <rev at forest-e.co.jp> wrote:
> Hi all,
> 
> I'd like to insert a graphic data (jpg,tiff...) into
> MySQL4.1 databases.
> 
> How to using BLOB ?
> 1) Insert to database
> 2) Display on the Rev
> 
> Client OSX and Windows2000 with Rev2.01
> Server FreeBSD 4.8 & MySQL 4.1
> 
> Regards,
> 
> 

Hi there,

Though I usually don't work with images, I do work
with databases ; here's what I would try.
- create a new stack
- now we will add a query
 + menu 'Tools' > item 'Database Query Builder'
 + click the '+' button to create a new query
 + fill in the connection data in the first tab
 + click the 'Connect' button
 + now proceed to the second tab
 + use the table option menu to select the table
containing the images (say myimages)
 + the builder has assumed that you want everything
from the table
      select * from myimages
 + since you're using MySQL, click on the "Cache
result set" checkbox
 + since you're exchanging BLOBs, click on the
"Display large binary data" checkbox
 + since you'll want to update, you better select the
primary field as well
- the next thing is to create an image and hook it up
to the query we just created
 + go back to the stack
 + use the 'Tool' palette to create an image control
(the appropriate tool is on the bottomleft of the
palette)
 + now open the 'Inspector' Palette, make sure it's
inspecting the newly created image control and go to
the 'Database' panel
 + use the 'Query' option menu to select the query we
just created
 + and use the 'Column' option menu to select the
correct column in the database-table
- you'll need a way to go through the records, so
create a series of buttons (First, Prev,Next,Last)
 + when you create the 'First' button, use the
'Inspector' palette and go to the 'Database' panel.
 + use the 'Query' option menu to select the query
 + use the 'Action' option menu to tell it to go to
the first record
 + ... the other buttons are similar ...
- now you can view all the images in your table
- you may have noticed that when you set the necessary
information in the 'Database' panel in the 'Inspector'
palette for your image control, there was also a
checkbox 'Update after editing'
 + if you check that, and make changes to the image,
these ought to be updated back to the database

Hope this helped. And if you're stuck somewhere, don't
hesitate to post another question on this list :-)

Jan Schenkel.

=====
"As we grow older, we grow both wiser and more foolish at the same time."  (La Rochefoucauld)

__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com



More information about the use-livecode mailing list