Re: [sqlite] library routine called out of sequence

2011-12-23 Thread Michael Stephenson
Assuming that you are calling reset after each use of a prepared statement and/or that the error occurs on the very first bind... This sounds like in the working case the statements are prepared, bound, and then reset by the same thread each time these steps are done, but perhaps in the

Re: [sqlite] Parameters are not allowed in views

2011-12-23 Thread Petite Abeille
On Dec 23, 2011, at 2:31 PM, Chris Mets wrote: > A parameterized view allows me to do that just fine in other SQL engines, Well, MSSQL sports so-called parameterized views, but that's about it. > but apparently not SQLite. If you insist on that approach, you could rewrite your view in term

Re: [sqlite] : about add sqlite database cloumn

2011-12-23 Thread Kit
2011/12/23 YAN HONG YE : > I have a question about C binding for sqlite, I have a table like this: > > Name    Price1  Price2  Sum > A1      23      231 > A2      22      12 > A3      21      223 > > how to use functin >  int  myfunc() { > int tt=0; > if (price1>2) tt++; > if

Re: [sqlite] Parameters are not allowed in views

2011-12-23 Thread Peter Aronson
Another possibility might be to create a parameters table, say: CREATE TABLE tabparams (p1,p2,p2,p4,p5); INSERT INTO tabparams VALUES (null,null,null,null,null); And when creating the view, access tabparams.p1, tabparams.p2, etc. instead of variables (with an appropriate join clause). Then,

Re: [sqlite] Parameters are not allowed in views

2011-12-23 Thread Chris Mets
Hi Kees, Thank you for the input. I had your first workaround in mind if I cannot get the real parameterized views to work. It still achieves the goal of keeping the sql logic in the database, and only make the logic in the code a little less elegant (string substitution instead of sql

Re: [sqlite] : about add sqlite database cloumn

2011-12-23 Thread Kees Nuyt
On Fri, 23 Dec 2011 04:40:53 +, YAN HONG YE wrote: >I have a question about C binding for sqlite, I have a table like this: > >Name Price1 Price2 Sum >A1 23 231 >A2 22 12 >A3 21 223 > >how to use functin > int myfunc()

Re: [sqlite] Parameters are not allowed in views

2011-12-23 Thread Kees Nuyt
On Fri, 23 Dec 2011 06:31:33 -0700, Chris Mets wrote: > > Thanks for the response. In the solution you propose, > the view is no longer a parameterized view. I assume > you suggest putting the select statement with the > paramterized where clause in the code. In my

Re: [sqlite] library routine called out of sequence

2011-12-23 Thread Sreekumar TP
I am 99% certain that it is the very first call. unless the step and reset executed once before.(the bind , step, reset is in a loop). I will double check this. Sreekumar ___ sqlite-users mailing list sqlite-users@sqlite.org

Re: [sqlite] library routine called out of sequence

2011-12-23 Thread Dan Kennedy
On 12/23/2011 09:06 PM, Sreekumar TP wrote: Hi, yes, I know. I have a multithreaded app. One db conection.I will try to reproduce the problem with a simple app. However, the difference between the working and non working case is that in the working case statements are prepared each time. In

Re: [sqlite] library routine called out of sequence

2011-12-23 Thread Pavel Ivanov
On Fri, Dec 23, 2011 at 9:06 AM, Sreekumar TP wrote: > Hi, > > yes, I know. I have a multithreaded app. One db conection.I will try to > reproduce the problem with a simple app. > > However, the difference between the working and non working case is that in > the working

Re: [sqlite] Parameters are not allowed in views

2011-12-23 Thread Simon Slavin
On 23 Dec 2011, at 1:31pm, Chris Mets wrote: > Thanks for the response. In the solution you propose, the view is no longer > a parameterized view. I asume you suggest putting the select statement with > the paramterized where clause in the code. In my question, I simplified the > query. In

Re: [sqlite] library routine called out of sequence

2011-12-23 Thread Sreekumar TP
Hi, yes, I know. I have a multithreaded app. One db conection.I will try to reproduce the problem with a simple app. However, the difference between the working and non working case is that in the working case statements are prepared each time. In the non working case, its reused. The very

[sqlite] canonical new u1db and sqlite

2011-12-23 Thread sqlite-us...@h-rd.org
Hi, Canonical ha released a first prototype of u1db, a sqlite based document db which is syncable. Somehow this reminds me of a combination of the fossil db model and unql and unqlspec. Is there a relation between the projects? thanks, ___

Re: [sqlite] library routine called out of sequence

2011-12-23 Thread Pavel Ivanov
Devil is in the details. What you described in general is okay. But I guess the exact code you have has some problems. To find them we should see the code. An just some first check: do you have a single-threaded application accessing database? Pavel On Fri, Dec 23, 2011 at 3:32 AM, Sreekumar

Re: [sqlite] Parameters are not allowed in views

2011-12-23 Thread Chris Mets
Thanks for the response. In the solution you propose, the view is no longer a parameterized view. I asume you suggest putting the select statement with the paramterized where clause in the code. In my question, I simplified the query. In reality, it is a huge query (view with left join to two

Re: [sqlite] SQL help

2011-12-23 Thread Paul Sanderson
Thanks all, dates are stored internally as integers -- Paul ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

[sqlite] library routine called out of sequence

2011-12-23 Thread Sreekumar TP
Hi , I have a strange problem. I do the following in sequence - 1. open database 2. set pragmas 3.create table 4. prepare a paremetrised statement ( SELECT ..) 5. bind values to the statement 6. step At 5, I get the error "library routine called out of sequence". If I replace the