Re: [sqlite] Suspected bug in SELECT EXCEPT ORDER COLLATE

2013-05-06 Thread Keith Medcalf
So you are saying that: Select a from t1 except select a from t2 order by a collate nocase; Should internally be computed as Select a from (select a from t1 except select a from t2) order by a collate nocase; ? --- () ascii ribbon campaign against html e-mail /\ www.asciiribbon.org >

Re: [sqlite] Suspected bug in SELECT EXCEPT ORDER COLLATE

2013-05-06 Thread Richard Hipp
On Mon, May 6, 2013 at 10:29 PM, Simon Slavin wrote: > > The problem, I think, is that a COLLATE shouldn't change any value anyhow, > no matter which SELECT the ORDER clause is attached to. The COLLATE > modifier is part of the ORDER BY clause. It is there to change the

Re: [sqlite] Suspected bug in SELECT EXCEPT ORDER COLLATE

2013-05-06 Thread Keith Medcalf
> I read this: > > SELECT a FROM t1 EXCEPT SELECT a FROM t2 ORDER BY a; > > as saying "select all a from t1 that are not in t2, *then* order that > by that a". No, that is not what it says, actually. The translation of your statement into SQL Declarative would be: select a from t1 where

Re: [sqlite] Suspected bug in SELECT EXCEPT ORDER COLLATE

2013-05-06 Thread Simon Slavin
On 7 May 2013, at 2:35am, Nico Williams wrote: > I read this: > >SELECT a FROM t1 EXCEPT SELECT a FROM t2 ORDER BY a; > > as saying "select all a from t1 that are not in t2, *then* order that > by that a". > > I read this: > >SELECT a FROM t1 EXCEPT SELECT a

Re: [sqlite] Suspected bug in SELECT EXCEPT ORDER COLLATE

2013-05-06 Thread Nico Williams
On Mon, May 6, 2013 at 4:22 PM, Keith Medcalf wrote: > It is difficult to determine what is correct behaviour. I would think that > the "order by" clause applies to the set operation, therefore any collation > being applied has to be applied also to the component sets

Re: [sqlite] Update statement

2013-05-06 Thread James K. Lowden
On Mon, 6 May 2013 23:53:40 +0100 Simon Slavin wrote: > > How do I create this kind of update statement? > > > > UPDATE T SET a=0.5*(a+b), b=0.5*(b-a); > > > > The RHS should always be used with the values of a and b before the > > assignment. > > > > I think that the

Re: [sqlite] How do sqlite3_reset_last_insert_rowid() or functionalequivalent?

2013-05-06 Thread James K. Lowden
On Mon, 6 May 2013 20:55:01 +0300 Mikael wrote: > Currently in the absence of a sqlite3_reset_last_insert_rowid(), the > closest you can do to figure out what ID was actually inserted by the > most recent SQLite query is: > > * Lock mutex > * Get sqlite*'s last insert

Re: [sqlite] Is there a way to select a precision?

2013-05-06 Thread James K. Lowden
On Mon, 6 May 2013 07:42:43 -0500 "Michael Black" wrote: > Yes...other databases do respect NUMBER(10,2) on SELECT's. ... > Can you simply use round to do what you want? > CREATE TABLE stuff(f number(10,2)); > INSERT INTO "stuff" VALUES(1.0/3.0); > sqlite> select f from

Re: [sqlite] Update statement

2013-05-06 Thread Simon Slavin
On 6 May 2013, at 11:53pm, Simon Slavin wrote: > On 6 May 2013, at 11:48pm, skywind mailing lists > wrote: > >> UPDATE T SET a=0.5*(a+b), b=0.5*(b-a); >> >> The RHS should always be used with the values of a and b before the >> assignment. >>

Re: [sqlite] Update statement

2013-05-06 Thread Simon Slavin
On 6 May 2013, at 11:48pm, skywind mailing lists wrote: > How do I create this kind of update statement? > > UPDATE T SET a=0.5*(a+b), b=0.5*(b-a); > > The RHS should always be used with the values of a and b before the > assignment. > > I think that the result of

[sqlite] Update statement

2013-05-06 Thread skywind mailing lists
Hi, How do I create this kind of update statement? UPDATE T SET a=0.5*(a+b), b=0.5*(b-a); The RHS should always be used with the values of a and b before the assignment. I think that the result of this kind of statement is undefined, or? Regards, Hartwig

Re: [sqlite] Suspected bug in SELECT EXCEPT ORDER COLLATE

2013-05-06 Thread Keith Medcalf
Richard, sqlite> CREATE TABLE t1(a); sqlite> INSERT INTO t1 VALUES('abc'); sqlite> INSERT INTO t1 VALUES('def'); sqlite> CREATE TABLE t2(a); sqlite> INSERT INTO t2 VALUES('DEF'); sqlite> sqlite> SELECT a FROM t1 EXCEPT SELECT a FROM t2 ORDER BY a; abc def sqlite> SELECT '-';

Re: [sqlite] Is there a way to select a precision?

2013-05-06 Thread Keith Medcalf
You could also store the precision in the datatype and the client can retrieve the column declaration so that it can fiddle with the data before displaying it. This is a client issue, not a database issue. --- () ascii ribbon campaign against html e-mail /\ www.asciiribbon.org >

Re: [sqlite] How do sqlite3_reset_last_insert_rowid() or functionalequivalent?

2013-05-06 Thread Mikael
2013/5/6 Mikael > Dear Simon, Günter and list, > > The issue goes like this: > > Currently in the absence of a sqlite3_reset_last_insert_rowid(), the > closest you can do to figure out what ID was actually inserted by the most > recent SQLite query is: > > * Lock mutex >

Re: [sqlite] How do sqlite3_reset_last_insert_rowid() or functionalequivalent?

2013-05-06 Thread Mikael
Dear Simon, Günter and list, The issue goes like this: Currently in the absence of a sqlite3_reset_last_insert_rowid(), the closest you can do to figure out what ID was actually inserted by the most recent SQLite query is: * Lock mutex * Get sqlite*'s last insert row ID * Perform the query

Re: [sqlite] Anyone can decipher this so i can try to figure out how to debug it? Thanks

2013-05-06 Thread Michael Black
It's a lousy error message from some application which ay be using sqlite underneath the covers. Sqlite isn't even mentioned in the error so not sure why you think it's involved. It's getting an error on its own rename code and has nothing to do with sqlite. And it's not telling you what the

Re: [sqlite] How to read log file format into sqlite database?

2013-05-06 Thread Jay A. Kreibich
On Sun, May 05, 2013 at 01:50:41AM -0700, Newbie89 scratched on the wall: > let say is .txt file 99+% of log files are text files. This tells us nothing useful. Is it an Apache log file? Or some other well-known format that someone might have already written a parser for? Does it

Re: [sqlite] Suspected bug in SELECT EXCEPT ORDER COLLATE

2013-05-06 Thread Staffan Tylen
Richard's script seems to confirm that something is buggy, so I hold fire trying to produce something else that only shows the same thing. Staffan On Mon, May 6, 2013 at 5:00 PM, Richard Hipp wrote: > On Mon, May 6, 2013 at 10:56 AM, Simon Slavin >

Re: [sqlite] Suspected bug in SELECT EXCEPT ORDER COLLATE

2013-05-06 Thread Richard Hipp
On Mon, May 6, 2013 at 10:56 AM, Simon Slavin wrote: > > Unless you include your collation code, it's hard to reproduce your > behaviour. Can you please try to find a demonstration with a collation > order that's native to SQLite ? Perhaps a three-row example using

Re: [sqlite] SEE + CEROD

2013-05-06 Thread Mohit Sindhwani
On 6/5/2013 7:24 PM, Richard Hipp wrote: Yes. SEE and CEROD can be combined to work together. Remember how with CEROD you append some code to the end of the sqlite3.c amalgamation file? SEE works the same way. To use them both, you just append both additions to the amalgamation. Thanks

Re: [sqlite] Suspected bug in SELECT EXCEPT ORDER COLLATE

2013-05-06 Thread Simon Slavin
On 6 May 2013, at 3:47pm, Staffan Tylen wrote: > I've got a SELECT clause in the following format: > > SELECT a FROM t1 > EXCEPT > SELECT a FROM t2 > ORDER BY a COLLATE myorder; > > All a's in t1 get selected (not expected). > > SELECT a FROM t1 > EXCEPT > SELECT a

[sqlite] Suspected bug in SELECT EXCEPT ORDER COLLATE

2013-05-06 Thread Staffan Tylen
I've got a SELECT clause in the following format: SELECT a FROM t1 EXCEPT SELECT a FROM t2 ORDER BY a COLLATE myorder; All a's in t1 get selected (not expected). SELECT a FROM t1 EXCEPT SELECT a FROM t2 ORDER BY a; All a's in t1 except the a's in t2 get selected (as expected). I haven't

Re: [sqlite] Is there a way to select a precision?

2013-05-06 Thread Simon Slavin
On 6 May 2013, at 2:10pm, Simon Slavin wrote: > You can format them after retrieving them from the database, or you can > format them before retrieving them from the database before putting them in > the database, in which case you should consider that you're storing

Re: [sqlite] How do sqlite3_reset_last_insert_rowid() or functionalequivalent?

2013-05-06 Thread Hick Gunter
I use a separate SQLite connection for each thread to avoid such issues. When does the "last inserted rowid" become obsolete? In your example, do you mean to imply that the last inserted rowid may be retrieved once and once only? Why not just: (lock mutex) (execute query) if sqlite3_changes()

Re: [sqlite] Is there a way to select a precision?

2013-05-06 Thread Simon Slavin
On 6 May 2013, at 1:14pm, Paul van Helden wrote: > My point was about not storing binary junk - the part of a number that has > no meaning because the accuracy of the inputs is limited. When you have a > generic db manager that can show any table or if you are looking at

Re: [sqlite] How do sqlite3_reset_last_insert_rowid() or functional equivalent?

2013-05-06 Thread Simon Slavin
On 6 May 2013, at 1:39pm, Mikael wrote: > It'd be a great thing to be able to produce a general mechanism for > retrieving this value with regard to the most recently performed query only > right after a query has been made, as programming aimed at getting this > value

Re: [sqlite] Is there a way to select a precision?

2013-05-06 Thread Michael Black
What you are talking about would be feature creep for SQLite. Yes...other databases do respect NUMBER(10,2) on SELECT's. SQLite is "light weight" and does no such magic for you. So it does take an extra step. You'll note that SQLite does provide a GUI for you to play with. If it did it would

[sqlite] How do sqlite3_reset_last_insert_rowid() or functional equivalent?

2013-05-06 Thread Mikael
Dear list, After having made an SQLite statement the ID of a newly inserted row can be retrieved with sqlite3_last_insert_rowid . It'd be a great thing to be able to produce a general mechanism for retrieving this value with regard to the most recently performed query only right after a query

[sqlite] Bug: Random crashes while preparing a statement (Valgrind always complains, reproducing code)

2013-05-06 Thread Jerome St-Louis
Hi guys, I found this crash in SQLite. Tested with latest amalgamation ( sqlite-autoconf-307160 ). Please assist. Thanks, Jerome #include #include #include int main() { sqlite3_stmt * stmt = NULL; sqlite3 * db = NULL;

Re: [sqlite] Is there a way to select a precision?

2013-05-06 Thread veneff
You could always store the precision info in another column or two. Vance on May 06, 2013, Paul van Helden wrote: > >> A delared type of NUMBER(10,2) has NUMERIC affinity, which means that >> SQLite will attempt to store (string) values as integers first and floats >>

Re: [sqlite] Is there a way to select a precision?

2013-05-06 Thread Paul van Helden
> A delared type of NUMBER(10,2) has NUMERIC affinity, which means that > SQLite will attempt to store (string) values as integers first and floats > second before giving up and storing strings. > This has nothing to do with my reply and I understand how it works. > > You do realize that there

Re: [sqlite] Anyone can decipher this so i can try to figure out how to debug it? Thanks

2013-05-06 Thread Clemens Ladisch
Mike wrote: > May 3 16:29:56 syncd: [ERROR] db-api.cpp:3738 rename from > '/volume1/@tmp/jUH4Ti' -> '/volume1/@cloudstation/@sync/repo/d/0/V/.Z' How is db-api.cpp related with SQLite? ___ sqlite-users mailing list sqlite-users@sqlite.org

Re: [sqlite] SEE + CEROD

2013-05-06 Thread Richard Hipp
On Mon, May 6, 2013 at 12:08 AM, Mohit Sindhwani wrote: > Hi Guys, > > We already have a license for CEROD and are now contemplating getting a > license for SEE to use within our products. I notice that both products > are separately provided as amalgamation sqlite3.c files. Is

Re: [sqlite] Is there a way to select a precision?

2013-05-06 Thread Hick Gunter
Maybe you should check out http://www.sqlite.org/datatype3.html A delared type of NUMBER(10,2) has NUMERIC affinity, which means that SQLite will attempt to store (string) values as integers first and floats second before giving up and storing strings. You do realize that there are decimal

Re: [sqlite] How to read log file format into sqlite database?

2013-05-06 Thread fnoyanisi
Why don't you try to do yourself and ask the points you stuck? I provided a link which has an example, and there is Sqlite C/C++ Api doc. I don't know the others, but I will not do your job/homework. On 06/05/2013, at 6:02 PM, Newbie89 wrote: > Can you show me a simple

Re: [sqlite] How to read log file format into sqlite database?

2013-05-06 Thread Eduardo Morras
On Mon, 6 May 2013 01:32:18 -0700 (PDT) Newbie89 wrote: > Can you show me a simple tutorial?urgent...please... > Is it the library u create I need to include only can function? http://www.cprogramming.com/ You should run this code while(!understand()){ yourself =

Re: [sqlite] How to read log file format into sqlite database?

2013-05-06 Thread Newbie89
Can you show me a simple tutorial?urgent...please... Is it the library u create I need to include only can function? Fehmi Noyan ISI wrote > To read txt, use fread() or fgets() . This is the most convenient answer I > think. > > It is up to your programming skills to read the file line by

Re: [sqlite] Is there a way to select a precision?

2013-05-06 Thread Paul van Helden
> > > What do you mean, select precision? The double value you pass to > sqlite3_bind_double() will be used as is. Are you saying you want to round > it first? Then go ahead and do that - I'm not sure what that has to do with > SQLite. > -- > It is an issue with SQLite because the values in