On 13 Jun 2012, at 2:42pm, deltagam...@gmx.net wrote:

> is it possible to save images or pdf in sqlite ?
> 
> Is it possible to just save the path to an image/ binary object
> an sqlite gets the object then at runtime ?

You can save image/PDF data any number of ways:

A) Save the full path to the file as a TEXT value in your SQLite database.  So 
you could have a column in a table which contains strings like

C:\USERS\DG\PICTURES\CarPhoto16.jpeg

Of course, you can be referring to .pdf files instead of .jpeg files.  Or any 
other filetype.

B) Save the data from the file in a BLOB value in your SQlite database.  But 
SQLite deosn't understand anything about what a BLOB means: it's just a run of 
bytes to it.  So when someone tells your application which file they want to 
associate with the new row of data your application does this:

Find that file.
Open it and read the bytes into memory.
Save those bytes in a BLOB field of the record it's making.

Then when someone looks up that record and wants the associated 
image/PDF/whatever, it's your application's job to do whatever's necessary to 
present that data in an acceptable way: it might be possible to draw it 
directly on the screen, or it might have to make a new file with those bytes in.


One method makes small databases but requires all the files to remain where 
they are on that computer.  The other makes bigger databases that can be 
archived or transferred from one computer to another without losing their 
images.

Simon.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to