I strongly recommend that you store a SHA-256 hash (or pick a better hash algorithm if there is one) of the file content as a blob in the database as the canonical way to identify the file. This is much more reliable than doing it with the file's name, and any filename info can then be metadata without having to be a unique identifier. This way you don't confuse 2 files with the same name but different content or vice-versa, and you gain other benefits. -- Darren Duncan
On 2016-04-28 3:43 PM, R Smith wrote: > On 2016/04/28 8:27 PM, deltagamma1 at gmx.net wrote: >> What is a convenient way to store the path from a external blob (jpg, >> pdf) ? >> How can I retrieve this blob ? >> Is there a Frontend which opens the jpg directly from the listed >> table-content ? >> >> If I store the blob directly in the sqlite, is there a way to open the >> blob directly with the respective programm (e.g. irfanview or a pdf with >> acroread) ? I just discovered recently sqlitespeed, but do not know how >> to handle the problems described above. > > A blob is just a set of bytes to the DB engine, it usually knows nothing about > what those bytes represent. Some DB admin tools or GUIs may include ways to > display the bytes (if they can detect that they are some standard format). > Some > other programs, such as Irfanview, might happily display images from a DB, but > it would likely need a very specific schema to go on. > > Typically, you would be writing a program that uses the SQLite API to store > blobs and retrieve them from some byte or stream you choose, into and from the > formats you choose. > > What I do is save both the blob and the file name (and perhaps the original > path > if you want to treat it as a backup) in separate columns (fields) and then, > once > I would like to open it, I just recreate the file (in whatever destination I > would like, the TEMP folder is a good idea) with the correct file name, and > then > execute/open it - which should have your system open it with whatever program > is > registered to open such a file. > > SQLite is not really concerned with what is in your blobs - just how to best > store and retrieve them. Your program can do all kinds of magic with the blobs > and SQLite will ensure you can save and load them fast and easy. > > Best of luck, > Ryan > > _______________________________________________ > sqlite-users mailing list > sqlite-users at mailinglists.sqlite.org > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users >