Re: [sqlite] [sqlite-dev] Bad performance with foreign key contraint

2012-05-14 Thread Dan Kennedy
On 05/14/2012 10:39 AM, Jonas Malaco Filho wrote: I found this on the docs : If this SELECT returns any rows at all, then SQLite concludes that deleting the row from the parent table would violate the foreign key constraint and returns an error. Similar

Re: [sqlite] Is it possible to insert UTF-8 strings in SQLITE3.EXE?

2012-05-14 Thread Kit
2012/5/13, Frank Chang : > Here is another way I found out how insert UTF-8 strings in SQLITE3.EXE. > > F:\sqlite3_6_16>sqlite3.exe mdName.dat > SQLite version 3.6.16 > Enter ".help" for instructions > Enter SQL statements terminated with a ";" > sqlite> INSERT INTO

[sqlite] sqlite3_finalize

2012-05-14 Thread Baruch Burstein
If sqlite3_prepare_v2 didn't return SQLITE_OK, do I need to call sqlite3_finalize on the statement pointer? -- Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far,

Re: [sqlite] sqlite3_finalize

2012-05-14 Thread Richard Hipp
On Mon, May 14, 2012 at 7:55 AM, Baruch Burstein wrote: > If sqlite3_prepare_v2 didn't return SQLITE_OK, do I need to call > sqlite3_finalize on the statement pointer? > No. If sqlite3_prepare_v2() returns anything other than SQLITE_OK then the statement pointer will be

[sqlite] SQLite version 3.7.12

2012-05-14 Thread D . Richard Hipp
SQLite version 3.7.12 is now available on the SQLite website: http://www.sqlite.org/ An overview of the enhancements in this release can be seen here: http://www.sqlite.org/releaselog/3_7_12.html Please send email to the sqlite-users@sqlite.org mailing list if you encounter any

[sqlite] parameters

2012-05-14 Thread Baruch Burstein
Are text parameters bound with sqlite3_bind_text automatically escaped and quoted, just escaped, just quoted, or neither? -- Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better

[sqlite] Is it possible to accurately retrieve UTF-8 String stored in SQLite 3.7.11 databases using sqlite3_column_text?

2012-05-14 Thread Frank Chang
Good morning, Is it possible to accurately retrieve UTF-8 String stored in SQLite 3.7.11 databases using sqlite3_column_text? If not, what sqlite3 C/C++ api should we use? Thank you. ___ sqlite-users

Re: [sqlite] parameters

2012-05-14 Thread Richard Hipp
On Mon, May 14, 2012 at 9:49 AM, Baruch Burstein wrote: > Are text parameters bound with sqlite3_bind_text automatically escaped and > quoted, just escaped, just quoted, or neither? > Both. And neither. The content of the parameter is not modified in any way. It is

Re: [sqlite] Is it possible to accurately retrieve UTF-8 String stored in SQLite 3.7.11 databases using sqlite3_column_text?

2012-05-14 Thread Richard Hipp
On Mon, May 14, 2012 at 9:48 AM, Frank Chang wrote: > > Good morning, Is it possible to accurately retrieve UTF-8 String stored > in SQLite 3.7.11 databases using sqlite3_column_text? > Yes. That is the default behavior. In fact, I do not know of a way to get it to

Re: [sqlite] parameters

2012-05-14 Thread Baruch Burstein
Thank you for the quick answer. On Mon, May 14, 2012 at 4:55 PM, Richard Hipp wrote: > On Mon, May 14, 2012 at 9:49 AM, Baruch Burstein >wrote: > > > Are text parameters bound with sqlite3_bind_text automatically escaped > and > > quoted, just escaped,

[sqlite] a couple of questions

2012-05-14 Thread Baruch Burstein
1. Can a use the expression 'WHERE b IN (SELECT ...)' if b is a blob column? Does the 'IN' comparison work with blobs? 2. How "static" does data have to be to be bound with SQLITE_STATIC? If it won't change until the call to sqlite3_step, is that enough? How about until sqlite3_reset or

Re: [sqlite] a couple of questions

2012-05-14 Thread Richard Hipp
On Mon, May 14, 2012 at 10:35 AM, Baruch Burstein wrote: > 1. Can a use the expression 'WHERE b IN (SELECT ...)' if b is a blob > column? Does the 'IN' comparison work with blobs? > IN works with blobs. > > 2. How "static" does data have to be to be bound with

Re: [sqlite] a couple of questions

2012-05-14 Thread Baruch Burstein
On Mon, May 14, 2012 at 5:45 PM, Richard Hipp wrote: > On Mon, May 14, 2012 at 10:35 AM, Baruch Burstein >wrote: > > > > > 2. How "static" does data have to be to be bound with SQLITE_STATIC? If > it > > won't change until the call to sqlite3_step, is

Re: [sqlite] Trouble importing hex encoded blob

2012-05-14 Thread Jim Morris
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.

Re: [sqlite] a couple of questions

2012-05-14 Thread Black, Michael (IS)
If you do a periodic commit and use SQLITE_TRANSIENT wouldn't that work? One the data is commited surely it doesn't need to be retained, does it? Michael D. Black Senior Scientist Advanced Analytics Directorate Advanced GEOINT Solutions Operating Unit Northrop Grumman Information Systems

Re: [sqlite] a couple of questions

2012-05-14 Thread Pavel Ivanov
> One the data is commited surely it doesn't need to be retained, does it? If you called sqlite3_reset() on a statement and then didn't call sqlite3_clear_bindings() then all bindings will surely be needed on the next statement execution in some subsequent transaction. Pavel On Mon, May 14,

Re: [sqlite] a couple of questions

2012-05-14 Thread Baruch Burstein
I rebind them on every iteration. On Mon, May 14, 2012 at 6:46 PM, Pavel Ivanov wrote: > > One the data is commited surely it doesn't need to be retained, does it? > > If you called sqlite3_reset() on a statement and then didn't call > sqlite3_clear_bindings() then all

Re: [sqlite] Trouble importing hex encoded blob

2012-05-14 Thread Black, Michael (IS)
I updated my csvimport utility to allow hex fields. So hex fields like X'01020304' will get imported as blobs if the option is enabled. Sooo test.csv: X'0001063500',X'00' X'0001063501',X'01' csvimport test.csv test.db t csvimport -x test.csv test.db

Re: [sqlite] Trouble importing hex encoded blob

2012-05-14 Thread Joshua Shanks
Seems like with or without the X it doesn't do the same thing as an import $ cat sample.tsv import X'1234' X'1234' import 1234 1234 CREATE TABLE samples ( method varchar(64), value blob ); insert INTO samples (method, value) VALUES ("insert - null", null); insert INTO samples (method,

Re: [sqlite] Trouble importing hex encoded blob

2012-05-14 Thread Joshua Shanks
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

Re: [sqlite] Trouble importing hex encoded blob

2012-05-14 Thread Jim Morris
Joshua, It doesn't exist in the standard version. We added it in-house to aid development and testing. The code I posted was the changes we made to the 3.5.9 shell.c in addition to adding an existing hex to byte function from our libraries. If you can compile a new shell the existing

Re: [sqlite] Trouble importing hex encoded blob

2012-05-14 Thread Black, Michael (IS)
Looks like it goes inside this loop in 3.7.12 at line 1883 of shell.c. Could we get maybe a pragma ".mode csvblob" or such and have this made a permanet part of the shell? for(i=0; i

Re: [sqlite] Trouble importing hex encoded blob

2012-05-14 Thread Black, Michael (IS)
And do you want to do the blob_bind when the column type is blob? Or when the field is X'' format?. I can imagine an extension where you use the column type and then have URL qualifiers available too. Added:unsigned char * blobBuffer = NULL; else if(

Re: [sqlite] how to write line feed "\n\r" when output a txt file

2012-05-14 Thread Kees Nuyt
On Mon, 14 May 2012 05:41:08 +, YAN HONG YE wrote: >when I use : > >.output akk.txt >select * from dhq where qph>0; >.output stdout > > command to write a txt file,I found no "\n\r" in the each line, Are you sure? By the way, common lineendings are platform dependent

Re: [sqlite] how to write line feed "\n\r" when output a txt file

2012-05-14 Thread Black, Michael (IS)
Under windows: SQLite version 3.7.9 2011-11-01 00:52:41 Enter ".help" for instructions Enter SQL statements terminated with a ";" sqlite> create table t(a,b); sqlite> insert into t values(1,2); sqlite> insert into t values(3,4); sqlite> .output akk.txt sqlite> select * from t; sqlite> .output

[sqlite] proposal for api

2012-05-14 Thread Baruch Burstein
Assuming that sqlite knows how many rows are in a result set without having to sqlite3_step over each row, can there be an api like: sqlite3_in64 sqlite3_rows(sqlite3_stmt *stmt) which would run the query (if sqlite3_step has not been called on this stmt object yet), and return the number of

Re: [sqlite] proposal for api

2012-05-14 Thread Jay A. Kreibich
On Mon, May 14, 2012 at 10:55:35PM +0300, Baruch Burstein scratched on the wall: > Assuming that sqlite knows how many rows are in a result set without having > to sqlite3_step over each row, It doesn't. -j -- Jay A. Kreibich < J A Y @ K R E I B I.C H > "Intelligence is like underwear:

Re: [sqlite] Is it possible to insert UTF-8 strings in SQLITE3.EXE?

2012-05-14 Thread Yuriy Kaminskiy
Kit wrote: > 2012/5/13, Frank Chang : >> Here is another way I found out how insert UTF-8 strings in SQLITE3.EXE. >> >> F:\sqlite3_6_16>sqlite3.exe mdName.dat >> SQLite version 3.6.16 >> Enter ".help" for instructions >> Enter SQL statements terminated with a ";" >>

[sqlite] SQLite 3.7.12 64-bit Binary

2012-05-14 Thread Rafael Trevisan
Someone tell me where I get the dll SQLite 3.7.12 for Windows 64-bit? I do not develop in C + + and I can not compile. []s, Rafael Trevisan raf...@trevis.com.br ___ sqlite-users mailing list sqlite-users@sqlite.org

Re: [sqlite] SQLite 3.7.12 64-bit Binary

2012-05-14 Thread Joshua Shanks
The 32 bit version should run fine on Windows 64 bit. Do you specifically need the 64 bit compiled version? On Mon, May 14, 2012 at 5:39 PM, Rafael Trevisan wrote: > Someone tell me where I get the dll SQLite 3.7.12 for Windows 64-bit? I do > not develop in C + + and I can

Re: [sqlite] SQLite 3.7.12 64-bit Binary

2012-05-14 Thread Rafael Trevisan
Unfortunately I need a specific version for 64-bit. []s, Rafael Trevisan raf...@trevis.com.br On Mon, May 14, 2012 at 9:43 PM, Joshua Shanks wrote: > The 32 bit version should run fine on Windows 64 bit. Do you > specifically need the 64 bit compiled version? > > On Mon,