Hey Jim,

I downloaded the source or 3.7.12 from sqlite.org and can't find that code.

$ ls
shell.c  sqlite3.c  sqlite3ext.h  sqlite3.h
$ head -n3 sqlite3.c
/******************************************************************************
** This file is an amalgamation of many separate C source files from SQLite
** version 3.7.12.  By combining all the individual C code files into this
$ grep blobBuffer *
$


On Mon, May 14, 2012 at 8:24 AM, Jim Morris <jmor...@bearriver.com> wrote:
> We added blob import on an old version of the shell, 3.5.9. Using a simple
> HexToByte function.
>
> To function: static int do_meta_command(char *zLine, struct callback_data
> *p){
>
> Added:            unsigned char * blobBuffer = NULL;
>
> In the loop // ***** Bind cached values to prepared statement.  *****
> we added
>                else if( nColType[i] == SQLITE_BLOB )
>                {
>                    textLen = strlen(azCol[i]);
>                    // Convert from Hex to Binary.
>                    blobLen = HexToByte( &blobBuffer,    azCol[i], textLen );
>
>                    // Have sqlite make an internal copy since we may have
> multiple blobs...
>                    rc = sqlite3_bind_blob(pStmt, i+1, blobBuffer, blobLen,
> SQLITE_TRANSIENT);
>                }
>
> with a free(blobBuffer); done for each row after the reset.
>
>
>
> On 5/11/2012 10:22 PM, Joshua Shanks wrote:
>>
>> I peeked at the source code real quick and it looks like it just
>> converts the contents of the file into a bunch of SQL that is
>> essentially opening a transaction and doing an insert for each row
>> followed by a commit. This suggest I just need to format it
>> differently so I'll play around with that tomorrow and report back on
>> if I make an progress. It looks to be using prepared statements
>> instead of straight inserts which is what i tried to convert out of.
>>
>> On Fri, May 11, 2012 at 7:22 PM, Richard Hipp<d...@sqlite.org>  wrote:
>>>
>>> On Fri, May 11, 2012 at 10:13 PM, Joshua Shanks<jjsha...@gmail.com>
>>>  wrote:
>>>
>>>> I set the separator to tab and then in the file it is
>>>>
>>>> X'somevalue'\tX'someothervalue'\n
>>>> X'morestuff'\tX'evenmore'\n
>>>>
>>>> but with real hex values
>>>>
>>>> According to the documentation
>>>>
>>> That document you quote is describing the SQL langauge, not CSV.  There
>>> is
>>> no way to enter BLOBs using CSV, that I know of.
>>>
>>> The ".import" command operatos on CSV, not SQL.
>>>
>>>
>>>> BLOB literals are string literals containing hexadecimal data and
>>>> preceded by a single "x" or "X" character. For example:
>>>>
>>>>    X'53514C697465'
>>>>
>>>> On Fri, May 11, 2012 at 6:16 PM, Simon Slavin<slav...@bigfraud.org>
>>>> wrote:
>>>>>
>>>>> On 12 May 2012, at 2:01am, Joshua Shanks<jjsha...@gmail.com>  wrote:
>>>>>
>>>>>> But when I try to use the .import method the values get imported as
>>>>>> the string "X'...." instead of the hex blob value and don't get pulled
>>>>>> out correctly.
>>>>>
>>>>> .import is for .csv files.  What are you putting in the .csv file to
>>>>
>>>> express a value in hex ?  I don't think there's a way to do it.
>>>>>
>>>>> Simon.
>>>>> _______________________________________________
>>>>> sqlite-users mailing list
>>>>> sqlite-users@sqlite.org
>>>>> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>>>>
>>>> _______________________________________________
>>>> sqlite-users mailing list
>>>> sqlite-users@sqlite.org
>>>> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>>>>
>>>
>>>
>>> --
>>> D. Richard Hipp
>>> d...@sqlite.org
>>> _______________________________________________
>>> sqlite-users mailing list
>>> sqlite-users@sqlite.org
>>> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>>
>> _______________________________________________
>> sqlite-users mailing list
>> sqlite-users@sqlite.org
>> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>>
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to