New topic: 

Inserting Images into an SQL Database

<http://forums.realsoftware.com/viewtopic.php?t=45769>

         Page 1 of 1
   [ 4 posts ]                 Previous topic | Next topic          Author  
Message        Stuart J Sykes          Post subject: Inserting Images into an 
SQL DatabasePosted: Wed Oct 31, 2012 5:43 am                         
Joined: Fri Oct 26, 2012 6:24 am
Posts: 10                Has anybody had any experience of this?
I'm using SQLite Database Browser to create the database which has a field type 
BLOB which i'm assured is a way of storing images (Binary Large OBject)
SQLite doesn't seem to want to store a JPG image in this type of field though.
Do the JPGs need to be converted to something else first?
Maybe I need to do the whole thing in Real Studio?
Anybody had any luck with this?   
                             Top                amitavak          Post subject: 
Re: Inserting Images into an SQL DatabasePosted: Wed Oct 31, 2012 8:07 am       
                          
Joined: Mon Jan 02, 2012 1:51 am
Posts: 331
Location: India                Stuart J Sykes wrote:Anybody had any luck with 
this?

I did not tried that. As per I know, Storing the image in the database field is 
not a good idea. You can just sore the file name(say Flower.jpg) in the 
database and keep the images in a specific folder. Or store the absolute path 
of the image file.      
_________________
Amitava Karan
Real Studio 2012 Release 1
Windows 7 (32 bit)
Mac OS X Version 10.7  
                             Top                Jason_Adams          Post 
subject: Re: Inserting Images into an SQL DatabasePosted: Wed Oct 31, 2012 8:56 
am                                 
Joined: Fri Nov 10, 2006 4:10 pm
Posts: 1697
Location: Michigan, USA                As always, it depends on your 
application, but it is generally advised that you store the path of your 
images, rather than the images themselves. The reason for this is that bulk 
quantities of massive fields can slow down the database as a whole. How much it 
slows it down I don't know.

Regardless, I've stored images in SQLite before, and you're doing the right 
thing: use a Blob field, save to is using DatabaseField.PictureValue = 
YourPicture — this converts the picture to a string and sends it (a feature 
introduced a year or two ago that made me happy). You can then recreate the 
picture from the Picture.FromData shared method.

Hope this helps.     
_________________
Windows 7 Ultimate x64
Windows XP Pro SP3
Ubuntu 11.04 via Virtual Box
RS Enterprise 2012r1.1

Programming Tutorials & Free Projects: http://www.JasonTheAdams.com
"Christianity has not been tried and found wanting; it has been found difficult 
and not tried." - G.K. Chesterton  
                             Top                Jym          Post subject: Re: 
Inserting Images into an SQL DatabasePosted: Wed Oct 31, 2012 1:16 pm           
              
Joined: Sat Oct 01, 2005 5:19 pm
Posts: 3175                If you're attempting to do it in SQLite Database 
Browser, you'll have to show us what you are attempting to do as nobody will 
have a clue from just the question.

If you need to use RS to do it b/c AFAIK it's kind of complicated to do it with 
SDB (though possible) you can find an example I posted somewhere in this forum. 
  
                             Top             Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 4 posts ]      
-- 
Over 1500 classes with 29000 functions in one REALbasic plug-in collection. 
The Monkeybread Software Realbasic Plugin v9.3. 
http://www.monkeybreadsoftware.de/realbasic/plugins.shtml

[email protected]

Reply via email to