2 Replies - 292 Views - Last Post: 02 June 2014 - 12:04 PM Rate Topic: -----

#1 piciurica  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 11-June 13

attach a file to SQLite DB c++

Posted 26 May 2014 - 12:38 AM

Hi all,

I want to create a standalone DB with all the books that I have, in such a manner that I can actually attach/include the *.pdf files to it. Doesn't matter if the size of the DB increases, as long as I would be able to copy the DB from one PC to another, without being necessary to manually copy the *.pdfs. I need to be able to search a book and directly open it from the DB, without searching through a folder. The only user would me.
I already did this with Microsoft Office Access, but since it has crashed, I thought it's time to try a more solid implementation.
Does anyone know if this is possible to be done in SQLite with c++? If not, are there any other suggestions? I prefer implementing this with a software library that has a c++ interface.

Thank you for your time and help,
Piciurica

Is This A Good Question/Topic? 0
  • +

Replies To: attach a file to SQLite DB c++

#2 ArtificialSoldier  Icon User is online

  • D.I.C Lover
  • member icon

Reputation: 383
  • View blog
  • Posts: 1,385
  • Joined: 15-January 14

Re: attach a file to SQLite DB c++

Posted 02 June 2014 - 10:30 AM

It looks like SQLite can store blobs, although it might not be that fast:

http://www.sqlite.or...xtern-blob.html

If you want to search through the text in each book then you'll need a way to convert the PDF to searchable text. You might need to store both the searchable text and the PDF.
Was This Post Helpful? 0
  • +
  • -

#3 piciurica  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 11-June 13

Re: attach a file to SQLite DB c++

Posted 02 June 2014 - 12:04 PM

Thanks for your reply, ArtificialSoldier.

What I managed to do so far, for the file storing part, is to open the *.pdf as a binary file and write it into DB as a blob.
As for getting back the file, I simply take the block of memory from the blob, write it into a *.pdf file and open it with Adobe.

Regarding the searching issue that you mentioned about, I did a couple of tests on the retrieved file and it seems to work.


Thanks again for the link. Actually, I found a lot of useful information on the sqlite website.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1