Re: [sqlite] Question on Blobs

2008-02-29 Thread Fred J. Stephens
Dennis Cote wrote: > If you are using the command line sqlite3 program rather than the > library, then all your input must be text that can appear on the command > line or be redirected from stdin. Handling binary data this way will be > difficult. Thanks Dennis, You cleared up allot for me. I t

Re: [sqlite] Question on Blobs

2008-02-29 Thread Dennis Cote
Fred J. Stephens wrote: > Thanks John & Dennis; > Looks like I am getting ahead of myself here. I'm just doing a simple > PIM app as a BASH script that uses SQLite to store data. Probably I > can't do this in a script as you could in C. > > I find the formating of the text from a file is not sav

Re: [sqlite] Question on Blobs

2008-02-28 Thread Fred J. Stephens
Thanks John & Dennis; Looks like I am getting ahead of myself here. I'm just doing a simple PIM app as a BASH script that uses SQLite to store data. Probably I can't do this in a script as you could in C. I find the formating of the text from a file is not saved if I read it and insert it into

Re: [sqlite] Question on Blobs

2008-02-28 Thread John Stanton
Just get a pointer to the data in the file and the number of bytes and use the sqlite API call to transfer it into the DB. You can get the pointer by either reading the file into local memory or by mmap'ing it. Also look at the API calls which let you process a blob in chunks. A BLOB is call

Re: [sqlite] Question on Blobs

2008-02-28 Thread Peter A. Friend
On Feb 27, 2008, at 7:35 PM, Mike McGonagle wrote: > Wow, Peter, didn't expect that anyone would go to the trouble of > writing a > program on the spot I didn't. :-) That was just a snippet of something I wrote for myself when I first started playing with SQLite. > Just curious, but fro

Re: [sqlite] Question on Blobs

2008-02-28 Thread John Stanton
Rather than doing malloc you can mmap the file and then copy it into the blob. Peter A. Friend wrote: > On Feb 27, 2008, at 4:48 PM, Mike McGonagle wrote: > >> Hello all, >> I was hoping that someone might share some tips on working with >> Blobs? I >> would like to be able to store some image

Re: [sqlite] Question on Blobs

2008-02-28 Thread Dennis Cote
Fred J. Stephens wrote: > For instance, how can I store a file in a table? > Not read the file and store the text, but the binary file itself? Fred, You can't do anything with the contents of a file until you read in into memory. To store a 1MB file in a database you need to decide if you will

Re: [sqlite] Question on Blobs

2008-02-27 Thread Neville Franks
Hi Mike, The data in this example happens to come from file, but that isn't relevant. The line: rc = sqlite3_bind_blob(stmt, 2, data, sb.st_size, SQLITE_STATIC); is binding a chunk of data on the heap to the blob column and inserting that into the database. Where this chunk of data comes from

Re: [sqlite] Question on Blobs

2008-02-27 Thread Fred J. Stephens
Mike McGonagle wrote: > Hello all, > I was hoping that someone might share some tips on working with Blobs? I am also curious about this. For instance, how can I store a file in a table? Not read the file and store the text, but the binary file itself? Thanks. _

Re: [sqlite] Question on Blobs

2008-02-27 Thread Mike McGonagle
Wow, Peter, didn't expect that anyone would go to the trouble of writing a program on the spot Just curious, but from those few things that I have seen, it appears that you can only put a Blob into the DB if it is already on disc, right? All three examples I have seen passed the filename to the

Re: [sqlite] Question on Blobs

2008-02-27 Thread Igor Tandetnik
"Mike McGonagle" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > My impression from what I have seen is that Blobs are dealt with in a > different way than other data types. Am I correct in assuming that > Blobs need to be created explicitly, and then you repeatedly call > 'sqlite3_bl

Re: [sqlite] Question on Blobs

2008-02-27 Thread Peter A. Friend
On Feb 27, 2008, at 4:48 PM, Mike McGonagle wrote: > Hello all, > I was hoping that someone might share some tips on working with > Blobs? I > would like to be able to store some images and sound files in a > database, > but never having dealt with them, I am kind of at a loss for some > ex

[sqlite] Question on Blobs

2008-02-27 Thread Mike McGonagle
Hello all, I was hoping that someone might share some tips on working with Blobs? I would like to be able to store some images and sound files in a database, but never having dealt with them, I am kind of at a loss for some examples. I have looked on the web, and there are few examples that were of