On 7/24/06, Kiril Dzolev <[EMAIL PROTECTED]> wrote:
Hello and thanks for quick reply,

can you give an example how to bind my data using prepared statements. for
example this data who is in diferent rows:

Look into

http://www.sqlite.org/capi3ref.html#sqlite3_bind_int
and
http://www.sqlite.org/capi3ref.html#sqlite3_column_blob

and also into:

http://www.sqlite.org/lang_expr.html

for how to write the SQL expression.

Key     binary_data
----------------------------
1            -3.210000e-4
2            123

and how can I read the binary_data, for example, on the first row.

I answered above for the C API, but if you want to use simple SQL (or
the sqlite shell), use:

INSERT INTO <table> VALUES( 3, x'00112233445566778899AABBCCDDEEFF' );

to insert a BLOB (in hexadecimal format) and:

SELECT Key, quote(binary_data) FROM <table>;

To get it in the same hexadecimal format.

For example:

[EMAIL PROTECTED]:~$ sqlite3
SQLite version 3.2.8
Enter ".help" for instructions
sqlite> create table x(i,b);
sqlite> insert into x values(1,x'00123456789ABCDEF0' );
sqlite> select * from x;
1|
sqlite> select i,quote(b) from x;
1|X'00123456789ABCDEF0'
sqlite>

Notice the first select which didn't return nothing for the value
because it starts with a NULL, but if you use the quote() function, it
appears as it should.

One piece of warning, don't use sqlite to store big BLOBs. You will
waste a lot of memory and probably will be slow. For big BLOBs, just
store a link to the data on the filesystem.

Regards,
~Nuno Lucas

I am sorry for this basic questions, but I am really new at this.

Thank you,

Kiril

Reply via email to