[sqlite] SQLITE_BUSY/SQLITE_LOCKED

2014-07-23 Thread Paul Joyce
Hi, I just thought I'd point out something that confused me, in the hope of helping others. from the source, where the constants are defined: #define SQLITE_BUSY 5 /* The database file is locked */ #define SQLITE_LOCKED 6 /* A table in the database is locked */ and from

Re: [sqlite] YACC/Bison vs. Lemon vs. standard input

2014-07-23 Thread Gabriel Corneanu
Hi, From the old time in school, Bison is a LL parser and I have see that Lemon is LR (LALR(1) ). That's it, Bison reduces as soon as it can while Lemon shifts as much as it can. You have to force Lemon to reduce prog rule, i.e. newline should be part of another rule: E.g. modified ladd.y:

[sqlite] Hexadecimal integer literals

2014-07-23 Thread Richard Hipp
We are looking into adding hexadecimal integer literals to SQLite. In other words, we are looking to enhance SQLite to understand 0x1234 as another way of writing 4660. Hex literals are useful in conjunction with the bit-wise AND and OR operators ( and |) and in applications that make use of bit

Re: [sqlite] Hexadecimal integer literals

2014-07-23 Thread Dominique Devienne
On Wed, Jul 23, 2014 at 1:07 PM, Richard Hipp d...@sqlite.org wrote: (6) Do not support hexadecimal integer literals for casts and affinity coercions. Only support hex literals in the SQL parser, and throw errors for oversized hex literals in that context. +1. --DD

Re: [sqlite] Hexadecimal integer literals

2014-07-23 Thread Clemens Ladisch
Richard Hipp wrote: Hex literals are useful in conjunction with the bit-wise AND and OR operators ( and |) and in applications that make use of bit fields. The question is what to do with hex literals that are larger than 64 bits. There are no bit operations on values larger than 64 bits, so

[sqlite] Passing parameter to SQlite query

2014-07-23 Thread shweta gk
Hi SQlite Support Team, I have queries to generate csv file written in a export.sql file. I'm calling export.sql from a batch file. One of the queries in export.sql has where clause , to which i have to send a value from batch file. Which syntax is used for this functionality. I need to send

[sqlite] Send parameter from batch file to sqlite

2014-07-23 Thread shweta gk
Hi SQlite Support Team, I have queries to generate csv file written in a export.sql file. I'm calling export.sql from a batch file. One of the queries in export.sql has where clause , to which i have to send a value from batch file. Which syntax is used for this functionality. I need to send

[sqlite] Fwd: Send parameter from batch file to sqlite

2014-07-23 Thread shweta gk
Hi SQlite Support Team, I have queries to generate csv file written in a export.sql file. I'm calling export.sql from a batch file. One of the queries in export.sql has where clause , to which i have to send a value from batch file. Which syntax is used for this functionality. I need to send

[sqlite] Fwd: Passing parameter to SQlite query

2014-07-23 Thread shweta gk
Hi SQlite Support Team, I have queries to generate csv file written in a export.sql file. I'm calling export.sql from a batch file. One of the queries in export.sql has where clause , to which i have to send a value from batch file. Which syntax is used for this functionality. I need to send

[sqlite] Fwd: confirm 6a309b27ca3b749c401faa299d168c6aff685d4b

2014-07-23 Thread shweta gk
Thanks Regards, Shweta.G.K -- Forwarded message -- From: shweta gk shwetag...@gmail.com Date: Wed, Jul 23, 2014 at 4:09 PM Subject: Re: confirm 6a309b27ca3b749c401faa299d168c6aff685d4b To: sqlite-users-requ...@sqlite.org Thanks Regards, Shweta.G.K On Wed, Jul 23, 2014 at

[sqlite] Fwd: Send parameter from batch file to sqlite

2014-07-23 Thread shweta gk
Thanks Regards, Shweta.G.K -- Forwarded message -- From: shweta gk shwetag...@gmail.com Date: Wed, Jul 23, 2014 at 4:05 PM Subject: Fwd: Send parameter from batch file to sqlite To: sqlite-dev sqlite-...@sqlite.org Hi SQlite Support Team, I have queries to generate csv file

Re: [sqlite] Hexadecimal integer literals

2014-07-23 Thread Stephan Beal
On Wed, Jul 23, 2014 at 1:07 PM, Richard Hipp d...@sqlite.org wrote: The current SQLite implementation (on the hex-literal branch) works by converting hex literals of 64 bits or less into a signed 64-bit integer. Overflow/underflow are unspecified for signed types, and the / ops could

Re: [sqlite] Hexadecimal integer literals

2014-07-23 Thread Paul
(6) Do not support hexadecimal integer literals for casts and affinity coercions. Only support hex literals in the SQL parser, and throw errors for oversized hex literals in that context. I vote for (6) as for being the most predictable behaviour that has no possibility to break any

Re: [sqlite] Hexadecimal integer literals

2014-07-23 Thread Simon Slavin
On 23 Jul 2014, at 12:07pm, Richard Hipp d...@sqlite.org wrote: (3) Convert hex literals of 63-bits or less into integers and convert 64-bit or larger hex literals into a floating-point approximation. BLOBs. Anything longer than 64 bits should be BLOBs. Code which compares two values for

Re: [sqlite] Fwd: Send parameter from batch file to sqlite

2014-07-23 Thread Simon Slavin
We don't know what operating system or command shell you're using. So our advice is to write your own editor which takes your export.sql file and the output of your batch file and puts them together to make a new .sql file with the commands you want. Simon.

Re: [sqlite] Fwd: Send parameter from batch file to sqlite

2014-07-23 Thread shweta gk
Operating system : Windows I am using DOS command shell. Thanks Regards, Shweta.G.K On Wed, Jul 23, 2014 at 5:48 PM, Simon Slavin slav...@bigfraud.org wrote: We don't know what operating system or command shell you're using. So our advice is to write your own editor which takes your

Re: [sqlite] Hexadecimal integer literals

2014-07-23 Thread Dominique Devienne
On Wed, Jul 23, 2014 at 2:15 PM, Simon Slavin slav...@bigfraud.org wrote: (3) Convert hex literals of 63-bits or less into integers and convert 64-bit or larger hex literals into a floating-point approximation. BLOBs. Anything longer than 64 bits should be BLOBs. Code which compares two

Re: [sqlite] Hexadecimal integer literals

2014-07-23 Thread Markus Schaber
Hi, Von: Im Auftrag von Dominique Devienne On Wed, Jul 23, 2014 at 1:07 PM, Richard Hipp d...@sqlite.org wrote: (6) Do not support hexadecimal integer literals for casts and affinity coercions. Only support hex literals in the SQL parser, and throw errors for oversized hex literals in

Re: [sqlite] Hexadecimal integer literals

2014-07-23 Thread Doug Currie
There is this range of negative values smack in the middle of an otherwise uniformly increasing sequence of positive numbers. That negative range seems discombobulating. Why are hex literals interpreted as signed at all? You could simply consider all hex literals as unsigned values. If you

Re: [sqlite] Hexadecimal integer literals

2014-07-23 Thread Richard Hipp
On Wed, Jul 23, 2014 at 9:59 AM, Doug Currie doug.cur...@gmail.com wrote: There is this range of negative values smack in the middle of an otherwise uniformly increasing sequence of positive numbers. That negative range seems discombobulating. Why are hex literals interpreted as signed

[sqlite] [Spellfix] Avoiding exact duplicates

2014-07-23 Thread Philip Bennefall
Hi all, Is it possible to tell the spellfix extension not to accept duplicate words if the rank and langid are exactly the same? I am collecting words from many different sources and after inserting them I very often get the same word back several times. Thanks in advance for any tips.

Re: [sqlite] Hexadecimal integer literals

2014-07-23 Thread Doug Currie
Why are hex literals interpreted as signed at all? You could simply consider all hex literals as unsigned values. If you need a negative value, prefix it with the - operator, e.g., -0x77. With this approach (a) there is no discombobulating segment, (b) all 64 bit bit-masks are

Re: [sqlite] Hexadecimal integer literals

2014-07-23 Thread Richard Hipp
On Wed, Jul 23, 2014 at 10:22 AM, Doug Currie doug.cur...@gmail.com wrote: Why are hex literals interpreted as signed at all? You could simply consider all hex literals as unsigned values. If you need a negative value, prefix it with the - operator, e.g., -0x77. With this approach

Re: [sqlite] Hexadecimal integer literals

2014-07-23 Thread Doug Currie
Here's an analogy: a sequence of decimal digits is unsigned; it only becomes negative when you put a - in front of it. Why shouldn't hex work the same way? (to eliminate the discombobulating segment) Because then you would not be able to write (in hex) a 64-bit bitmap that had the

Re: [sqlite] Hexadecimal integer literals

2014-07-23 Thread Tim Streater
On 23 Jul 2014 at 12:07, Richard Hipp d...@sqlite.org wrote: We are looking into adding hexadecimal integer literals to SQLite. In other words, we are looking to enhance SQLite to understand 0x1234 as another way of writing 4660. Hex literals are useful in conjunction with the bit-wise AND

Re: [sqlite] Hexadecimal integer literals

2014-07-23 Thread Gerry Snyder
I can think of situations where I would want the result to be truncated to 64 bits. I can think of situations where I would want SQLite to raise an error. I cannot imagine wanting a floating point result. Gerry Snyder -

[sqlite] Memory ownership for sqlite3_temp_directory

2014-07-23 Thread Nicolás Brailovsky
Is the memory used by sqlite3_temp_directory freed by sqlite or should it be freed by the user? From the documentation for sqlite3_temp_directory: ** the [temp_store_directory pragma] always assumes that any string ** that this variable points to is held in memory obtained from **

Re: [sqlite] Memory ownership for sqlite3_temp_directory

2014-07-23 Thread Richard Hipp
On Wed, Jul 23, 2014 at 11:31 AM, Nicolás Brailovsky nicolasbra...@gmail.com wrote: Is the memory used by sqlite3_temp_directory freed by sqlite or should it be freed by the user? From the documentation for sqlite3_temp_directory: ** the [temp_store_directory pragma] always assumes that

Re: [sqlite] Memory ownership for sqlite3_temp_directory

2014-07-23 Thread Richard Hipp
Document updated here: http://www.sqlite.org/draft/c3ref/temp_directory.html On Wed, Jul 23, 2014 at 11:36 AM, Richard Hipp d...@sqlite.org wrote: On Wed, Jul 23, 2014 at 11:31 AM, Nicolás Brailovsky nicolasbra...@gmail.com wrote: Is the memory used by sqlite3_temp_directory freed by

Re: [sqlite] Hexadecimal integer literals

2014-07-23 Thread Jean-Christophe Deschamps
Conversion of oversized hex into FP would break easily and reveal hardly reproductible across many platforms. Being a support for some languages fora I observe daily how FP inaccuracies is a real-world problem in simple-looking code. The only reasonable thing I can foresee is treat hex as

Re: [sqlite] Memory ownership for sqlite3_temp_directory

2014-07-23 Thread Nicolás Brailovsky
Thanks for your reply Richard * 1. Is the memory for sqlite3_temp_directory ever cleaned up? * Not by SQLite. That memory is the responsibility of the application that allocated it. Given the memory may be cleaned up by sqlite itself in some cases: 1. Freeing it after calling shutdown (ie

[sqlite] Addressing columns in an attached db

2014-07-23 Thread jose isaias cabrera
Greetings. I have two DB identical and I am copying data from one to another. When I attach a DB, i.e.. ATTACH 'c:\db\mydb.sqlite' as client; how do I address the names of the column? for example, both DBs connected and disconnected have the columns: id,ProjID, Date, code, login. When I

Re: [sqlite] Memory ownership for sqlite3_temp_directory

2014-07-23 Thread Richard Hipp
On Wed, Jul 23, 2014 at 12:10 PM, Nicolás Brailovsky nicolasbra...@gmail.com wrote: How would you suggest to implement the cleanup for sqlite3_temp_directory? Don't. Set sqlite3_temp_directory once when the process starts (and then only if you really need it) then leave it alone for the

Re: [sqlite] Hexadecimal integer literals

2014-07-23 Thread Klaas V
Like some others I vote for solution 6. In general accepting hexadecimal notation for floating point values exceeding 64 bits is too developer/scientist friendly. Who needs so much precision use Fortran or another specialized language rather than SQL of any flavor. My € 2E-2

Re: [sqlite] Addressing columns in an attached db

2014-07-23 Thread Richard Hipp
On Wed, Jul 23, 2014 at 12:32 PM, jose isaias cabrera cabr...@wrc.xerox.com wrote: Greetings. I have two DB identical and I am copying data from one to another. When I attach a DB, i.e.. ATTACH 'c:\db\mydb.sqlite' as client; how do I address the names of the column? for example, both

Re: [sqlite] [Spellfix] Avoiding exact duplicates

2014-07-23 Thread Klaas V
Philip wrote: Is it possible to tell the spellfix extension not to accept duplicate  words if the rank and langid are exactly the same? I am collecting words  from many different sources and after inserting them I very often get  the same word back several times. Add a 'unique' constraint in

Re: [sqlite] Memory ownership for sqlite3_temp_directory

2014-07-23 Thread Nicolás Brailovsky
Set sqlite3_temp_directory once when the process starts (and then only if you really need it) then leave it alone for the remainder of the live of the process. Do not try to reclaim memory. Fair enough. Would you recommend any alternatives to replace temp_directory altogether? Cheers

Re: [sqlite] Memory ownership for sqlite3_temp_directory

2014-07-23 Thread Richard Hipp
On Wed, Jul 23, 2014 at 1:20 PM, Nicolás Brailovsky nicolasbra...@gmail.com wrote: Set sqlite3_temp_directory once when the process starts (and then only if you really need it) then leave it alone for the remainder of the live of the process. Do not try to reclaim memory. Fair enough.

Re: [sqlite] Memory ownership for sqlite3_temp_directory

2014-07-23 Thread Nicolás Brailovsky
What platform are you running on that you feel like you need to specify a temporary directory other than the system default? Android. If I don't specify the temp dir, I end up triggering a bunch of bugs in fuse :) Cheers Nicolás Brailovsky - Tech blog http://monoinfinito.wordpress.com On

Re: [sqlite] Addressing columns in an attached db

2014-07-23 Thread jose isaias cabrera
Richard Hipp wrote... On Wed, Jul 23, 2014 at 12:32 PM, jose isaias cabrera cabr...@wrc.xerox.com wrote: Greetings. I have two DB identical and I am copying data from one to another. When I attach a DB, i.e.. ATTACH 'c:\db\mydb.sqlite' as client; how do I address the names of the

Re: [sqlite] Memory ownership for sqlite3_temp_directory

2014-07-23 Thread Richard Hipp
On Wed, Jul 23, 2014 at 1:29 PM, Nicolás Brailovsky nicolasbra...@gmail.com wrote: What platform are you running on that you feel like you need to specify a temporary directory other than the system default? Android. If I don't specify the temp dir, I end up triggering a bunch of bugs in

[sqlite] Announcement: sqlite3 vfs layer for RAMCloud

2014-07-23 Thread Jakob Blomer
Dear all, I’d like to announce an sqlite3 vfs layer [1,2] that uses the RAMCloud [3] distributed key-value store as backing storage. RAMCloud provides distributed, durable (replicated) storage with low-latency access. The VFS driver is still under development but the basic operations,

Re: [sqlite] Sometimes when my process restarts, it returns error database is locked

2014-07-23 Thread Mayank Kumar (mayankum)
[Resending to see if someone has insight here ...] I was able to get the error logging callback working. But I am curious as I am just seeing the same error details as the sqlite3 api itself returns. For e.g. SQLITE_LOG: sqlite errcode=26, sqlite errmsg=file is encrypted or is not a database

Re: [sqlite] Sometimes when my process restarts, it returns error database is locked

2014-07-23 Thread Simon Slavin
On 23 Jul 2014, at 7:27pm, Mayank Kumar (mayankum) mayan...@cisco.com wrote: SQLITE_LOG: sqlite errcode=26, sqlite errmsg=file is encrypted or is not a database The same error code I get in the return value of sqlite3_step. Just wondering if there is a way I can get this error logging

Re: [sqlite] Sometimes when my process restarts, it returns error database is locked

2014-07-23 Thread Tim Streater
On 23 Jul 2014 at 19:43, Simon Slavin slav...@bigfraud.org wrote: -what line number or when was this issue first detected SQLite does not know how your application is organised. One particular API call returns the error, so you know where the error was found: it was by that call. I needed

Re: [sqlite] Sometimes when my process restarts, it returns error database is locked

2014-07-23 Thread Mayank Kumar (mayankum)
Thanks Simon, I have already enabled extended error codes but I am not seeing any extended error codes being returned. I also enabled the error logging callback which just prints the errorcode and the error message which I was already getting when the sqlite3 api was failing. I know this error

Re: [sqlite] Sometimes when my process restarts, it returns error database is locked

2014-07-23 Thread Simon Slavin
On 23 Jul 2014, at 8:56pm, Mayank Kumar (mayankum) mayan...@cisco.com wrote: I have already enabled extended error codes but I am not seeing any extended error codes being returned. I also enabled the error logging callback which just prints the errorcode and the error message which I was

[sqlite] [Spellfix] Searching for short words is very slow

2014-07-23 Thread Philip Bennefall
Hi all, I have been running some tests with spellfix using a table containing about 30 words, extracted from the Moby project's single word list as well as names and places. Moby can be found at: http://icon.shef.ac.uk/Moby/ I have noticed that searching for medium length to very long

Re: [sqlite] Hexadecimal integer literals

2014-07-23 Thread Zsbán Ambrus
Hello! Just like the others in this conversation, I also believe that you must not change the rules how strings are converted to integers by type affinity, or by type conversions of arithmetic operators. Thus, you must not add hexadecimal representation to conversions (nor hex floats or 'inf'

Re: [sqlite] [Spellfix] Searching for short words is very slow

2014-07-23 Thread Philip Bennefall
I have to amend my last message. The timings I just gave was for looking up that word 10 times, not 1. So the longest time I've seen would be about 150 ms. However, if you have a document with a few thousand words we would still be looking at a significant total searching time. Is this to be

Re: [sqlite] [Spellfix] Searching for short words is very slow

2014-07-23 Thread Richard Hipp
On Wed, Jul 23, 2014 at 6:18 PM, Philip Bennefall phi...@blastbay.com wrote: I have to amend my last message. The timings I just gave was for looking up that word 10 times, not 1. So the longest time I've seen would be about 150 ms. However, if you have a document with a few thousand words we

Re: [sqlite] [Spellfix] Searching for short words is very slow

2014-07-23 Thread Philip Bennefall
Hi Richard, My application is basically just to take a text file as a command line argument and run the spellchecker on it, showing an alert for each word that is not found in the dictionary and giving the user some options. After a bit of experimentation I concluded that one way to speed

Re: [sqlite] Hexadecimal integer literals

2014-07-23 Thread James K. Lowden
On Wed, 23 Jul 2014 07:07:25 -0400 Richard Hipp d...@sqlite.org wrote: Hex literals are useful in conjunction with the bit-wise AND and OR operators ( and |) and in applications that make use of bit fields. ... The current SQLite implementation (on the hex-literal branch) works by converting

Re: [sqlite] Addressing columns in an attached db

2014-07-23 Thread Keith Medcalf
BEGIN; INSERT OR REPLACE INTO LSOpenProjects SELECT * FROM client.LSOpenProjects as A WHERE A.ProjID = 133560 AND Date != A.Date AND A.login = 'user1'; END; I presume that LSOpenProjects in both databases has a unique constraint on ProjID, Date, and login ...

Re: [sqlite] Hexadecimal integer literals

2014-07-23 Thread Eric Rubin-Smith
So far no one has raised the idea of using a big int layer to implement proper integer arithmetic past 64 bits. The fact that it hasn't been mentioned makes me worry that it's a blatantly silly idea for SQLite for some reason -- but I'm tossing it out there on the off chance that it's useful.

Re: [sqlite] Addressing columns in an attached db

2014-07-23 Thread James K. Lowden
On Wed, 23 Jul 2014 20:00:52 -0600 Keith Medcalf kmedc...@dessus.com wrote: BEGIN; INSERT OR REPLACE INTO LSOpenProjects SELECT * FROM client.LSOpenProjects as A WHERE A.ProjID = 133560 AND Date != A.Date AND A.login = 'user1'; END; I presume that

Re: [sqlite] Hexadecimal integer literals

2014-07-23 Thread J Decker
Seems like adding hex interpreting is just adding code for the sake of adding code. Unless the data is coming from some pre written text file, isn't just just as easy to format an into into decimal as it is for hex without having to add extra characters for the prefix?

Re: [sqlite] Addressing columns in an attached db

2014-07-23 Thread jose isaias cabrera
Keith Medcalf wrote... BEGIN; INSERT OR REPLACE INTO LSOpenProjects SELECT * FROM client.LSOpenProjects as A WHERE A.ProjID = 133560 AND Date != A.Date AND A.login = 'user1'; END; I presume that LSOpenProjects in both databases has a unique constraint on

Re: [sqlite] Addressing columns in an attached db

2014-07-23 Thread jose isaias cabrera
James K. Lowden wrote... On Wed, 23 Jul 2014 20:00:52 -0600 Keith Medcalf kmedc...@dessus.com wrote: BEGIN; INSERT OR REPLACE INTO LSOpenProjects SELECT * FROM client.LSOpenProjects as A WHERE A.ProjID = 133560 AND Date != A.Date AND A.login = 'user1';

Re: [sqlite] Hexadecimal integer literals

2014-07-23 Thread Scott Robison
On Wed, Jul 23, 2014 at 9:46 PM, J Decker d3c...@gmail.com wrote: Seems like adding hex interpreting is just adding code for the sake of adding code. Unless the data is coming from some pre written text file, isn't just just as easy to format an into into decimal as it is for hex without