Re: [sqlite] sqlite3_step and ORDER BY random() question.

2017-04-11 Thread Keith Medcalf
ɹoʇıuoɯ ɹnoʎ 'sıɥʇ pɐǝɹ uɐɔ noʎ ɟı > -Original Message- > From: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] > On Behalf Of Reid Thompson > Sent: Tuesday, 11 April, 2017 07:17 > To: sqlite-users@mailinglists.sqlite.org > Subject: Re: [sqlite] sqlite3_step and ORDER

Re: [sqlite] sqlite3_step and ORDER BY random() question.

2017-04-11 Thread Richard Hipp
On 4/11/17, Reid Thompson wrote: > > I/and the original implementer, am/were more familiar with PostgreSQL's > MVCC. So I think the issue was the assumption that the query being > stepped through would only ever see the rows as they were at the start > of the query and

Re: [sqlite] sqlite3_step and ORDER BY random() question.

2017-04-11 Thread Simon Slavin
On 11 Apr 2017, at 2:16pm, Reid Thompson wrote: > I/and the original implementer, am/were more familiar with PostgreSQL's > MVCC. So I think the issue was the assumption that the query being > stepped through would only ever see the rows as they were at the start > of

Re: [sqlite] sqlite3_step and ORDER BY random() question.

2017-04-11 Thread Reid Thompson
On Tue, 2017-04-11 at 13:17 +0100, Simon Slavin wrote: > On 11 Apr 2017, at 12:33pm, Reid Thompson wrote: >  > > Does 'more complicated' in the below scenario mean that there is > > potential for records to be returned more than once if I use random()? >  > The problem is

Re: [sqlite] sqlite3_step and ORDER BY random() question.

2017-04-11 Thread Reid Thompson
>  > Thank you.  I'll make adjustments to my process.  One follow on > question.  This would be a concern regardless of whether random() is > used or not in the ORDER BY clause?  >  > reid sorry - I posted this before receiving/seeing Simon's response. reid

Re: [sqlite] sqlite3_step and ORDER BY random() question.

2017-04-11 Thread Reid Thompson
On Tue, 2017-04-11 at 07:39 -0400, Richard Hipp wrote: > On 4/11/17, Reid Thompson wrote: > > On Mon, 2017-04-10 at 21:39 +0100, Simon Slavin wrote: > > > On 10 Apr 2017, at 9:28pm, Reid Thompson wrote: > > >  > > > > my questions are, if I prepare

Re: [sqlite] sqlite3_step and ORDER BY random() question.

2017-04-11 Thread Simon Slavin
On 11 Apr 2017, at 12:33pm, Reid Thompson wrote: > Does 'more complicated' in the below scenario mean that there is > potential for records to be returned more than once if I use random()? The problem is not to do with random(). The problem is to do with modifying a

Re: [sqlite] sqlite3_step and ORDER BY random() question.

2017-04-11 Thread Richard Hipp
On 4/11/17, Reid Thompson wrote: > On Mon, 2017-04-10 at 21:39 +0100, Simon Slavin wrote: >> On 10 Apr 2017, at 9:28pm, Reid Thompson wrote: >> >> > my questions are, if I prepare and utilize a statement for a result set >> > in the tens of

Re: [sqlite] sqlite3_step and ORDER BY random() question.

2017-04-11 Thread Reid Thompson
On Mon, 2017-04-10 at 21:39 +0100, Simon Slavin wrote: > On 10 Apr 2017, at 9:28pm, Reid Thompson wrote: >  > > my questions are, if I prepare and utilize a statement for a result set > > in the tens of thousands (or more) using a where clause along the lines > > of > >    

Re: [sqlite] sqlite3_step and ORDER BY random() question.

2017-04-10 Thread Simon Slavin
On 10 Apr 2017, at 9:28pm, Reid Thompson wrote: > my questions are, if I prepare and utilize a statement for a result set > in the tens of thousands (or more) using a where clause along the lines > of >"ORDER BY batch_id, due_datetime, random()" > > 1) As I

[sqlite] sqlite3_step and ORDER BY random() question.

2017-04-10 Thread Reid Thompson
hi, and thanks. my questions are, if I prepare and utilize a statement for a result set in the tens of thousands (or more) using a where clause along the lines of    "ORDER BY batch_id, due_datetime, random()" 1) As I sqlite3_step through the result set, am I guaranteed to get each row only

Re: [sqlite] sqlite3_step and SQLITE_LOCKED/BUSY

2014-09-05 Thread Simon Slavin
On 5 Sep 2014, at 1:58pm, Jan Slodicka wrote: > 1) SQLITE_OK should not happen. (Official documentation allows /ANY/ result > code. I hope this not true.) > 2) If it happens, then this looks dangerous. You are correct. If you use this routine only for SELECT commands or

Re: [sqlite] sqlite3_step and SQLITE_LOCKED/BUSY

2014-09-05 Thread Jan Slodicka
Thanks, Simon, perhaps I did not formulate may question clearly enough. The class of course works as you wrote, the only problem relates to the error handling. If you are interested, the C# wrapper (original code) is here

Re: [sqlite] sqlite3_step and SQLITE_LOCKED/BUSY

2014-09-04 Thread Simon Slavin
> On 4 Sep 2014, at 4:21pm, Jan Slodicka wrote: > > Our C# wrapper (inspired by system.data.sqlite) uses this quasi-code: > > bool Step(stmt) > { > while(true) > { >start time measurement >rc = sqlite3_step(stmt); >if( rc == SQLITE_ROW) return true;// ...

[sqlite] sqlite3_step and SQLITE_LOCKED/BUSY

2014-09-04 Thread Jan Slodicka
I don't have any real problem this time, just wondered if our C# wrapper is programmed correctly/efficiently. Suppose we prepared a statement using sqlite3_prepare_v2(). Could please anybody explain how to treat above mentioned error codes returned by sqlite3_step()? Our C# wrapper (inspired by

Re: [sqlite] sqlite3_step getting core dumbed.

2012-02-10 Thread Tim Streater
On 10 Feb 2012 at 07:55, bhaskarReddy wrote: > PRAGMA table_info(yourtablename); will display colNumber, colName, colType, > > ex: 0|slotId|INTEGER|0||0 > 1|ponChannelId|INTEGER|0||0 > 2|onuType|INTEGER|0||0 > 3|onuSerialNumber|TEXT|0||0 > 4|onuId|INTEGER|0||0 >

Re: [sqlite] sqlite3_step getting core dumbed.

2012-02-09 Thread bhaskarReddy
PRAGMA table_info(yourtablename); will display colNumber, colName, colType, ex: 0|slotId|INTEGER|0||0 1|ponChannelId|INTEGER|0||0 2|onuType|INTEGER|0||0 3|onuSerialNumber|TEXT|0||0 4|onuId|INTEGER|0||0 5|plannedSwVersion|TEXT|0||0 6|adminStatus|INTEGER|0||0 In that how can we extract

Re: [sqlite] sqlite3_step getting core dumbed.

2012-02-09 Thread Kees Nuyt
On Thu, 9 Feb 2012 05:07:05 -0800 (PST), bhaskarReddy wrote: > >Is it possible to find the data type, even if the table doesn't have data. >That means, my requirement is, > >1. I want to find the number of columns in the table. ( I already done.) >2. I want to find the names

Re: [sqlite] sqlite3_step getting core dumbed.

2012-02-09 Thread bhaskarReddy
Is it possible to find the data type, even if the table doesn't have data. That means, my requirement is, 1. I want to find the number of columns in the table. ( I already done.) 2. I want to find the names of the columns. (I already done.) 3. I want to find the data types. Because, if it is

Re: [sqlite] sqlite3_step getting core dumbed.

2012-02-09 Thread Marcus Grimm
On 09.02.2012 13:12, bhaskarReddy wrote: Thank you. Its working. But why i am getting sqlite3_column_type returning 5. I can only guess: a) because you have no data in that table. b) probably you have no known type defined in table definition and sqlite does a conversion anyhow. c)

Re: [sqlite] sqlite3_step getting core dumbed.

2012-02-09 Thread bhaskarReddy
Thank you. Its working. But why i am getting sqlite3_column_type returning 5. Marcus Grimm wrote: > > try changing this: > > colNames = (char **)malloc(sizeof(char)); > > into something like > > colNames = (char **)malloc(sizeof(char * ) * noOfColumns); > > > On 09.02.2012 11:21,

Re: [sqlite] sqlite3_step getting core dumbed.

2012-02-09 Thread Marcus Grimm
try changing this: colNames = (char **)malloc(sizeof(char)); into something like colNames = (char **)malloc(sizeof(char * ) * noOfColumns); On 09.02.2012 11:21, bhaskarReddy wrote: HI Friends, I dont know why the sqlite3_step getting core dumped. #include #include

Re: [sqlite] sqlite3_step getting core dumbed.

2012-02-09 Thread bhaskarReddy
No, that is not problem. Taleeb Anwar wrote: > > /* A Query to find types of each column. */ > str = (char *)malloc(sizeof(char) * 255); > memset(str, 0, 255); > strcat(str, "SELECT "); > for(loopVar = 0; loopVar < noOfColumns; loopVar++) > { > strcat(str,

Re: [sqlite] sqlite3_step getting core dumbed.

2012-02-09 Thread Taleeb Anwar
/* A Query to find types of each column. */ str = (char *)malloc(sizeof(char) * 255); memset(str, 0, 255); strcat(str, "SELECT "); for(loopVar = 0; loopVar < noOfColumns; loopVar++) { strcat(str, colNames[loopVar]); if(loopVar < (noOfColumns -1))

[sqlite] sqlite3_step getting core dumbed.

2012-02-09 Thread bhaskarReddy
HI Friends, I dont know why the sqlite3_step getting core dumped. #include #include #include "sqlitedb1.h" #include #include #include #include #include int db_retrieve_row(char *db_name, char *table_name, int num_of_keys, char * col_names[],column_value_t *

Re: [sqlite] Sqlite3_step

2011-10-17 Thread Igor Tandetnik
Sreekumar TP wrote: > I do not have a ORDER BY , only a WHERE clause. So sorting should not be > the cause for the overhead. Show your query, and the output of EXPLAIN QUERY PLAN on it. -- Igor Tandetnik ___ sqlite-users

Re: [sqlite] Sqlite3_step

2011-10-17 Thread Igor Tandetnik
Simon Slavin wrote: > The first step has to make a lot of decisions about what plan to follow in > retrieving the rows: Which index is the best to use ? > Is it going to be necessary to sort the rows even after that index ? These > things do take some extra time. These

Re: [sqlite] Sqlite3_step

2011-10-16 Thread Sreekumar TP
Hi, I do not have a ORDER BY , only a WHERE clause. So sorting should not be the cause for the overhead. -Sreekumar On Mon, Oct 17, 2011 at 9:08 AM, Simon Slavin wrote: > > On 17 Oct 2011, at 4:22am, Sreekumar TP wrote: > > > In case of a prepared statement that uses

Re: [sqlite] Sqlite3_step

2011-10-16 Thread Simon Slavin
On 17 Oct 2011, at 4:22am, Sreekumar TP wrote: > In case of a prepared statement that uses SELECT > , the first sqlite3_step statement consumes a lot of time (order of > magnitude can be 100 or more) > when compared to the subsequent executions of step used to iterate through > the results. Does

Re: [sqlite] Sqlite3_step

2011-10-16 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 16/10/11 20:22, Sreekumar TP wrote: > Does the first execution of step cache the entire result set and tje > subsequent steps get the results from the cache? No, the first execution does the minimum amount of work necessary in order to get you the

[sqlite] Sqlite3_step

2011-10-16 Thread Sreekumar TP
Hi, In case of a prepared statement that uses SELECT , the first sqlite3_step statement consumes a lot of time (order of magnitude can be 100 or more) when compared to the subsequent executions of step used to iterate through the results. Does the first execution of step cache the entire result

Re: [sqlite] sqlite3_step causing Segmentation Fault

2011-09-01 Thread Black, Michael (IS)
users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] on behalf of Rafael Toledo [rafaeldtol...@gmail.com] Sent: Wednesday, August 31, 2011 1:31 PM To: sqlite-users@sqlite.org Subject: EXT :[sqlite] sqlite3_step causing Segmentation Fault Hello! I'm coding a simple method in C++ to insert a t

Re: [sqlite] sqlite3_step causing Segmentation Fault

2011-09-01 Thread Igor Tandetnik
Rafael Toledo wrote: > rc = sqlite3_prepare_v2(mydb, "INSERT INTO users (name, isadmin, > photo) VALUES (?, 1, ?)", -1, , NULL); > if (rc != SQLITE_OK) { > sqlite3_finalize(statement); If prepare fails, statement is never updated. So you are passing garbage to

[sqlite] sqlite3_step causing Segmentation Fault

2011-09-01 Thread Rafael Toledo
Hello! I'm coding a simple method in C++ to insert a tuple in a small database. The database has a table called 'user', with 3 fields (id - the primary key, name, and a image). I mapped these fields in a class - id is an int, name is a std::string and image is a std::vector of unsigned char. In

Re: [sqlite] Sqlite3_step problem

2011-08-02 Thread Stephan Beal
On Tue, Aug 2, 2011 at 12:49 PM, Prasanth R Kosigi Shroff < prasanth@globaledgesoft.com> wrote: > i am trying to run a compiled query and i am passing it through > sqlite3_step API the return value is SQLITE_DONE. But the same query > works fine when i execute the same query using command

[sqlite] Sqlite3_step problem

2011-08-02 Thread Prasanth R Kosigi Shroff
hi i am trying to run a compiled query and i am passing it through sqlite3_step API the return value is SQLITE_DONE. But the same query works fine when i execute the same query using command line tool. #sqlite3 tmp.db SQLite version 3.4.2 Enter ".help" for instructions sqlite>select name from

Re: [sqlite] sqlite3_step hold about 0.5sec in iphone.

2011-05-21 Thread Simon Slavin
On 20 May 2011, at 12:33pm, Hyoseok Kim wrote: > I develop a app on iphone. I use SQLite for about 120,000 data. In my code, > sqlite3_step hold 0.5~1.0 sec. > Please give me a hint to escape sqlite3_step method rapidly. > [snip] > >// 0.5~1.0 sec hold after read last row data.

Re: [sqlite] sqlite3_step hold about 0.5sec in iphone.

2011-05-21 Thread Kees Nuyt
On Fri, 20 May 2011 20:33:04 +0900, Hyoseok Kim wrote: >Hi, I'm Hyoseok Kim from Korea. > >I develop a app on iphone. I use SQLite for about 120,000 data. In my code, >sqlite3_step hold 0.5~1.0 sec. >Please give me a hint to escape sqlite3_step method rapidly. > >Please help

[sqlite] sqlite3_step hold about 0.5sec in iphone.

2011-05-21 Thread Hyoseok Kim
Hi, I'm Hyoseok Kim from Korea. I develop a app on iphone. I use SQLite for about 120,000 data. In my code, sqlite3_step hold 0.5~1.0 sec. Please give me a hint to escape sqlite3_step method rapidly. Please help me. Thank you so much. My code is below... if (sqlite3_prepare_v2(db,

[sqlite] Sqlite3_step

2011-04-09 Thread Guilherme Batista
Hi, since sqlite does a nested loop to evaluate queries, is it possible to know how many interactions have each loop, i.e. how many rows in the table that loop will interact, and which table is that? And how can I use the WHERETRACE function that prints the optimization steps? Thanks! --

Re: [sqlite] sqlite3_step() error and constraints

2011-03-31 Thread Simon Slavin
On 31 Mar 2011, at 7:08pm, Igor Tandetnik wrote: > For reasons described in the documentation: > http://sqlite.org/c3ref/step.html . See "Goofy Interface Alert" section > at the bottom. Simon. ___ sqlite-users mailing list sqlite-users@sqlite.org

Re: [sqlite] sqlite3_step() error and constraints

2011-03-31 Thread Igor Tandetnik
On 3/31/2011 2:12 PM, Pavel Ivanov wrote: >> http://sqlite.org/c3ref/step.html . See "Goofy Interface Alert" section >> at the bottom. > > I believe it was changed with recent versions of SQLite. Is call to > sqlite3_extended_result_codes > (http://www.sqlite.org/c3ref/extended_result_codes.html)

Re: [sqlite] sqlite3_step() error and constraints

2011-03-31 Thread Pavel Ivanov
> http://sqlite.org/c3ref/step.html . See "Goofy Interface Alert" section > at the bottom. I believe it was changed with recent versions of SQLite. Is call to sqlite3_extended_result_codes (http://www.sqlite.org/c3ref/extended_result_codes.html) not needed anymore? Pavel On Thu, Mar 31, 2011

Re: [sqlite] sqlite3_step() error and constraints

2011-03-31 Thread Julien Laffaye
On 03/31/2011 19:08, Igor Tandetnik wrote: > On 3/31/2011 2:02 PM, Julien Laffaye wrote: > >> When sqlite3_step() fail because a UNIQUE constraint is not satisfied, >> it returns SQLITE_ERROR. >> I see that there is an error code named SQLITE_CONSTRAINT. Why >> sqlite3_step() does not return

Re: [sqlite] sqlite3_step() error and constraints

2011-03-31 Thread Igor Tandetnik
On 3/31/2011 2:02 PM, Julien Laffaye wrote: > When sqlite3_step() fail because a UNIQUE constraint is not satisfied, > it returns SQLITE_ERROR. > I see that there is an error code named SQLITE_CONSTRAINT. Why > sqlite3_step() does not return this one? For reasons described in the documentation:

[sqlite] sqlite3_step() error and constraints

2011-03-31 Thread Julien Laffaye
Hi, When sqlite3_step() fail because a UNIQUE constraint is not satisfied, it returns SQLITE_ERROR. I see that there is an error code named SQLITE_CONSTRAINT. Why sqlite3_step() does not return this one? Having a specific error code would be useful to warn the user that the data he submitted

Re: [sqlite] sqlite3_step behavior on empty set

2011-03-28 Thread Black, Michael (IS)
sqlite.org [sqlite-users-boun...@sqlite.org] on behalf of Igor Tandetnik [itandet...@mvps.org] Sent: Sunday, March 27, 2011 8:11 PM To: sqlite-users@sqlite.org Subject: EXT :Re: [sqlite] sqlite3_step behavior on empty set Sam Carleton <scarle...@miltonstreet.com> wrote: > Is my impressio

Re: [sqlite] sqlite3_step behavior on empty set

2011-03-27 Thread Igor Tandetnik
Sam Carleton wrote: > Is my impression correct that when calling sqlite3_step() on a query > that returns no rows, the result will be [SQLITE_DONE]? Yes. > If that is the case, might that be added to the documentation? "SQLITE_DONE means that the statement has

Re: [sqlite] sqlite3_step behavior on empty set

2011-03-27 Thread Simon Slavin
On 27 Mar 2011, at 9:24pm, Sam Carleton wrote: > Is my impression correct that when calling sqlite3_step() on a query > that returns no rows, the result will be [SQLITE_DONE]? If that is > the case, might that be added to the documentation? The SQLite documentation would profit greatly from a

[sqlite] sqlite3_step behavior on empty set

2011-03-27 Thread Sam Carleton
Is my impression correct that when calling sqlite3_step() on a query that returns no rows, the result will be [SQLITE_DONE]? If that is the case, might that be added to the documentation? ___ sqlite-users mailing list sqlite-users@sqlite.org

Re: [sqlite] sqlite3_step to select and update the same table

2010-11-09 Thread Stephen Chrzanowski
Well, with your 5 gig table, the select statement needs to still compile a set of results somehow, be it data or pointers to the data, and remember which row has been read. As I said, I've never looked or traced the code, but something has be be created somewhere that says "This is the next

Re: [sqlite] sqlite3_step to select and update the same table

2010-11-08 Thread Woody & Yuni Ho
ct: Re: [sqlite] sqlite3_step to select and update the same table SQL will not do the trick for me because I based on the select I have to perform other operations(queries on other tables) and only then can I update the table in question. Kees Nuyt wrote: > > There is no need to do th

Re: [sqlite] sqlite3_step to select and update the same table

2010-11-08 Thread cricketfan
SQL will not do the trick for me because I based on the select I have to perform other operations(queries on other tables) and only then can I update the table in question. Kees Nuyt wrote: > > There is no need to do this in a loop with a cursor. > Whenever possible, use the power of SQL set

Re: [sqlite] sqlite3_step to select and update the same table

2010-11-08 Thread Simon Slavin
On 8 Nov 2010, at 9:27pm, Stephen Chrzanowski wrote: > I don't know how the code works, but logically speaking, if I'm at row B, > and I update row B to E, row B physically remains B but has its data content > changed to E. From there on in, it should go on to C then D then F, etc. And

Re: [sqlite] sqlite3_step to select and update the same table

2010-11-08 Thread Kees Nuyt
On Sun, 7 Nov 2010 10:14:29 -0800 (PST), cricketfan wrote: >Just to make things clearer >the value being fetched into ref from the database, is also the value being >changed(ghi) in the update statement. When I change my query (just to debug) >to update some other column

Re: [sqlite] sqlite3_step to select and update the same table

2010-11-08 Thread Stephen Chrzanowski
I don't know how the code works, but logically speaking, if I'm at row B, and I update row B to E, row B physically remains B but has its data content changed to E. From there on in, it should go on to C then D then F, etc. Since the full rowset results already exist somewhere, it shouldn't show

Re: [sqlite] sqlite3_step to select and update the same table

2010-11-07 Thread Simon Slavin
On 8 Nov 2010, at 2:02am, cricketfan wrote: > Simon, As per my understanding I am getting the result set and trying to > change values in the table based on what I read from the result set up to > that point. I see no reason why I should be stopped from updating the row I > have already read in

Re: [sqlite] sqlite3_step to select and update the same table

2010-11-07 Thread cricketfan
Simon, As per my understanding I am getting the result set and trying to change values in the table based on what I read from the result set up to that point. I see no reason why I should be stopped from updating the row I have already read in the result set. Simon Slavin-3 wrote: > > > On 7

Re: [sqlite] sqlite3_step to select and update the same table

2010-11-07 Thread Simon Slavin
On 7 Nov 2010, at 6:14pm, cricketfan wrote: > Just to make things clearer > the value being fetched into ref from the database, is also the value being > changed(ghi) in the update statement. When I change my query (just to debug) > to update some other column in the table the whole thing runs

Re: [sqlite] sqlite3_step to select and update the same table

2010-11-07 Thread cricketfan
Just to make things clearer the value being fetched into ref from the database, is also the value being changed(ghi) in the update statement. When I change my query (just to debug) to update some other column in the table the whole thing runs fine and runs only once! Can someone throw some light

Re: [sqlite] sqlite3_step to select and update the same table

2010-11-07 Thread Kees Nuyt
On Sat, 6 Nov 2010 21:29:58 -0700 (PDT), cricketfan wrote: >I am trying to select some columns from a table and use that to >update another column in the same table using prepare/step/reset/finalize >methods. However, when I use the update statement while stepping

Re: [sqlite] sqlite3_step to select and update the same table

2010-11-07 Thread Simon Slavin
On 7 Nov 2010, at 4:29am, cricketfan wrote: >I am trying to select some columns from a table and use that to > update another column in the same table using prepare/step/reset/finalize > methods. However, when I use the update statement while stepping it is > executing the flow 2 times.

[sqlite] sqlite3_step to select and update the same table

2010-11-06 Thread cricketfan
Hello, I am trying to select some columns from a table and use that to update another column in the same table using prepare/step/reset/finalize methods. However, when I use the update statement while stepping it is executing the flow 2 times. In order to clarify, I am pasting some pseudo

Re: [sqlite] sqlite3_step returns sqlite_busy

2010-07-07 Thread Pavel Ivanov
t;Pavel Ivanov" <paiva...@gmail.com> > To: "General Discussion of SQLite Database" <sqlite-users@sqlite.org> > Sent: Wednesday, July 07, 2010 6:40 PM > Subject: Re: [sqlite] sqlite3_step returns sqlite_busy > > >>> one thread is preparing an "INSERT&

Re: [sqlite] sqlite3_step returns sqlite_busy

2010-07-07 Thread Lloyd
So it means we can have mor than one valid db handle? Thanks, Lloyd - Original Message - From: "Pavel Ivanov" <paiva...@gmail.com> To: "General Discussion of SQLite Database" <sqlite-users@sqlite.org> Sent: Wednesday, July 07, 2010 6:40 PM Subject: R

Re: [sqlite] sqlite3_step returns sqlite_busy

2010-07-07 Thread Pavel Ivanov
> one thread is preparing an "INSERT" statement (It returns SQLITE_OK), > then it is executed using sqlite3_step. sqlite3_step returns an > SQLITE_BUSY! Is there any possibility for this? Sure. Preparing INSERT statement doesn't acquire any "write" locks on the database. It's executing the INSERT

[sqlite] sqlite3_step returns sqlite_busy

2010-07-07 Thread Lloyd
Hi, We have a multi-threaded application (I know "threads are evil", but this is a small server application). Each thread tries to access the SQLite database. When trying to get a DB handle (sqlite3_open), if it returns SQLITE_BUSY, then the thread will wait for some time and try to open it

Re: [sqlite] sqlite3_step() transaction

2010-04-09 Thread Simon Slavin
On 9 Apr 2010, at 11:57am, Igor Tandetnik wrote: > Christoph Walser, ETH Zurich wrote: >> Is there a way to do all the 5000 rows in one transaction to minimize >> database locking time? I know I can do a sqlite3_exec with "BEGIN >> TRANSACTION", then do the inserts and then "COMMIT TRANSACTIONS"

Re: [sqlite] sqlite3_step() transaction

2010-04-09 Thread Igor Tandetnik
Christoph Walser, ETH Zurich wrote: > I have a C application which generates around 1000 rows of data per > second to insert in an SQLite database. > What I now do is to collect 5000 rows in a buffer and then for each row, > execute sqlite3_bind_*, sqlite3_step, sqlite3_reset. > > I wonder now

[sqlite] sqlite3_step() transaction

2010-04-09 Thread Christoph Walser, ETH Zurich
Hi everybody, I have a C application which generates around 1000 rows of data per second to insert in an SQLite database. What I now do is to collect 5000 rows in a buffer and then for each row, execute sqlite3_bind_*, sqlite3_step, sqlite3_reset. I wonder now how sqlite does this internaly:

Re: [sqlite] sqlite3_step()

2010-01-16 Thread Max Vlasov
Mike, as the docs on the page http://www.sqlite.org/c3ref/stmt.html says: 1. sqlite3_prepare_v2() 2. sqlite3_bind_*() 3. sqlite3_step() one or more times 4. sqlite3_reset() 5. goto 2 or sqlite3_finalize(). As you may know sqlite3_prepare_* compiles your SQL query into a VDBE micro-program with

Re: [sqlite] sqlite3_step()

2010-01-16 Thread Simon Davies
2010/1/16 Mike Johnston : > Using sqlite 3.6.22.  Here's my sql > SELECT sno, lname, fname FROM addressbook where sno>? > Suppose your stepping through a 100 row result set.  I'm calling > sqlite3_step(), getting my values all good.  If I were to call > sqlite3_bind_int()

[sqlite] sqlite3_step()

2010-01-16 Thread Mike Johnston
Using sqlite 3.6.22.  Here's my sql SELECT sno, lname, fname FROM addressbook where sno>? Suppose your stepping through a 100 row result set.  I'm calling sqlite3_step(), getting my values all good.  If I were to call sqlite3_bind_int() function with a new value for my where clause at row 50,

Re: [sqlite] sqlite3_step performance degredation

2009-06-15 Thread Jim Wilcoxson
occasional write operation in the midst of these reads > cause any permanent slow down to the read time? Thanks. > > Mike Borland > > -Original Message- > From: Nuno Lucas [mailto:ntlu...@gmail.com] > Sent: Friday, June 12, 2009 7:16 PM > To: General Discussion of SQLi

Re: [sqlite] sqlite3_step performance degredation

2009-06-15 Thread Simon Slavin
On 15 Jun 2009, at 10:11pm, Mike Borland wrote: > > When I start the 900 read iterations (always in the same order), the > first one generally reads in about 50ms and by the last read, it's > taking roughly 1000ms. Sometimes it slows down immediately, > sometimes after the 100th

Re: [sqlite] sqlite3_step performance degredation

2009-06-15 Thread Ken
Also is there an index on the table B.ID field? --- On Mon, 6/15/09, Mike Borland <mike.borl...@cygnetscada.com> wrote: > From: Mike Borland <mike.borl...@cygnetscada.com> > Subject: Re: [sqlite] sqlite3_step performance degredation > To: "General Discussion of SQLi

Re: [sqlite] sqlite3_step performance degredation

2009-06-15 Thread Ken
all of table A? I think that would be faster overall and prevent any locking issues. --- On Mon, 6/15/09, Mike Borland <mike.borl...@cygnetscada.com> wrote: > From: Mike Borland <mike.borl...@cygnetscada.com> > Subject: Re: [sqlite] sqlite3_step performance degredation > To

Re: [sqlite] sqlite3_step performance degredation

2009-06-15 Thread Mike Borland
ailto:ntlu...@gmail.com] Sent: Friday, June 12, 2009 7:16 PM To: General Discussion of SQLite Database Subject: Re: [sqlite] sqlite3_step performance degredation On Sat, Jun 13, 2009 at 1:52 AM, Mike Borland<mike.borl...@cygnetscada.com> wrote: > I have a fairly complex program where I am s

Re: [sqlite] sqlite3_step performance degredation

2009-06-12 Thread Nuno Lucas
On Sat, Jun 13, 2009 at 1:52 AM, Mike Borland wrote: > I have a fairly complex program where I am seeing a performance > degradation of the sqlite3_step() function.  Basically I'm iterating > roughly 200 rows at a time, over and over.  The only work happening > during

Re: [sqlite] sqlite3_step performance degredation

2009-06-12 Thread Mike Borland
e Database Subject: Re: [sqlite] sqlite3_step performance degredation On 13 Jun 2009, at 1:52am, Mike Borland wrote: > I have a fairly complex program where I am seeing a performance > degradation of the sqlite3_step() function. Basically I'm iterating > roughly 200 rows at a time, over

Re: [sqlite] sqlite3_step performance degredation

2009-06-12 Thread Simon Slavin
On 13 Jun 2009, at 1:52am, Mike Borland wrote: > I have a fairly complex program where I am seeing a performance > degradation of the sqlite3_step() function. Basically I'm iterating > roughly 200 rows at a time, over and over. The only work happening > during the iteration is I'm copying the

[sqlite] sqlite3_step performance degredation

2009-06-12 Thread Mike Borland
Hi all! I have a fairly complex program where I am seeing a performance degradation of the sqlite3_step() function. Basically I'm iterating roughly 200 rows at a time, over and over. The only work happening during the iteration is I'm copying the record into an array. At first, sqlite3_step()

Re: [sqlite] sqlite3_step() returning SQLITE_OK

2009-04-06 Thread Dan
On Apr 3, 2009, at 8:03 PM, Radcon Entec wrote: > According to the documentation, assuming I'm reading it correctly, > and assuming there are no locks on the database, and assuming the > query sent to sqlite3_prepare_v2() was valid, sqlite3_step() should > return either SQLITE_ROW or

Re: [sqlite] sqlite3_step() returning SQLITE_OK

2009-04-05 Thread Lukhnos D. Liu
On Apr 3, 2009, at 9:03 PM, Radcon Entec wrote: > According to the documentation, assuming I'm reading it correctly, > and assuming there are no locks on the database, and assuming the > query sent to sqlite3_prepare_v2() was valid, sqlite3_step() should > return either SQLITE_ROW or

[sqlite] sqlite3_step() returning SQLITE_OK

2009-04-03 Thread Radcon Entec
According to the documentation, assuming I'm reading it correctly, and assuming there are no locks on the database, and assuming the query sent to sqlite3_prepare_v2() was valid, sqlite3_step() should return either SQLITE_ROW or SQLITE_DONE.  I am seeing a different result after executing a

[sqlite] sqlite3_step and column name

2008-10-09 Thread Shaun R.
I'm trying to understand a bit how this works. For my example i just simply want to set a column value to a char. If i know the name of the column how can id o this. For example the column name i want is 'fname'. I know the section below with setting myname and then printing it doesnt

[sqlite] sqlite3_step returns SQLITE_OK

2008-08-04 Thread Julian Qian
** In the legacy interface, the return value will be either [SQLITE_BUSY], ** [SQLITE_DONE], [SQLITE_ROW], [SQLITE_ERROR], or [SQLITE_MISUSE]. ** With the "v2" interface, any of the other [SQLITE_OK | result code] ** or [SQLITE_IOERR_READ | extended result code] might be returned as ** well. the

RE: [sqlite] sqlite3_step() returning SQLITE_DONE for query that should return results

2008-01-19 Thread Joe Cosby
but not the later part where the problem is, so when I went to verify that the value was actually in the column it had been rolled back.) I hate it when I do that. > From: [EMAIL PROTECTED] > To: sqlite-users@sqlite.org > Date: Fri, 18 Jan 2008 17:01:56 -0800 > Subject: [sqlite]

[sqlite] sqlite3_step() returning SQLITE_DONE for query that should return results

2008-01-18 Thread Joe Cosby
I have a query that should return results and sqlite3_step is, sometimes, returning SQLITE_DONE instead of SQLITE_ROW. I have a table, meta_data, with two columns id INTEGER primary key, Soundid INTEGER which I know at the time of execution has the rows ID SOUNDID 38 39 39

Re: [sqlite] sqlite3_step() crash if didn't use sqlite3_bind_int before it

2007-12-01 Thread Ken
You Need to bind for each insert, Sqlite does not bind by address it does a copy. You'll need to populate your variables inside the loop then bind then step: prepare_v2 for(i = ...) { assign Variables to be bound. sqlite bind for each variable/column

[sqlite] sqlite3_step() crash if didn't use sqlite3_bind_int before it

2007-11-30 Thread Joanne Pham
Hi All, I have the following code: bool insert(Uccls *_uccls, TCPAcclBucket *tcpAcclBucket){ int nextCol; memcpy(, tcpAcclBucket, sizeof (TCPAcclBucket)); bindColumns for tcpAcclRec //Execute statement

[sqlite] sqlite3_step returns different error codes depending on PRAGMA cache_size

2007-07-11 Thread Srebrenko Sehic
I have an application that does bulk INSERTS into a table. Simplified pseudo code is below: sqlite3_open(dbh); sqlite3_prepare(stmt); for (i=0; i < 10; i++) { sqlite3_bind(i); sqlite3_step(stmt); sqlite3_reset(stmt); } sqlite3_close(dbh); While the bulk INSERTs are being

Re: [sqlite] sqlite3_step

2007-07-06 Thread Dan Kennedy
On Thu, 2007-07-05 at 18:26 -0300, Bruno S. Oliveira wrote: > Hi all, > > I'm having problems with the sqlite3_step function. > I have a table with only one record and then I execute the > sqlite3_step twice (with some processing in between). In the first run > of the function everything goes

[sqlite] sqlite3_step

2007-07-05 Thread Bruno S. Oliveira
Hi all, I'm having problems with the sqlite3_step function. I have a table with only one record and then I execute the sqlite3_step twice (with some processing in between). In the first run of the function everything goes fine, but, in the second one, it returns SQLITE_ROW even with only one

[sqlite] sqlite3_step error code confusion

2007-05-09 Thread Emerson Clarke
Ive been getting SQLITE_MISUSE errors after calling sqlite3_step one more time than required. Im using sqlite3_prepare_v2 so im expecting detailed error messages, but when i call sqlite3_errmsg all i seem to get is "not an error". So my question is this. What is an error ? It seems a little

Re: [sqlite] sqlite3_step() vs. get_tables() - CPU-Usage

2006-08-15 Thread John Stanton
A. Klitzing wrote: Hello, I need some information about the sqlite3_step() function. How much CPU-usage does it need in comparison with sqlite3_get_tables()? I have to implement functions like next(), prev(), last(), first(), relative(int) and absolute(int). #1 Way - sqlite3_step() I can

[sqlite] sqlite3_step() vs. get_tables() - CPU-Usage

2006-08-15 Thread A. Klitzing
Hello, I need some information about the sqlite3_step() function. How much CPU-usage does it need in comparison with sqlite3_get_tables()? I have to implement functions like next(), prev(), last(), first(), relative(int) and absolute(int). #1 Way - sqlite3_step() I can only step forward with

RE: [sqlite] sqlite3_step crash?

2006-03-29 Thread Boris Popov
h 29, 2006 6:40 AM To: sqlite-users@sqlite.org Subject: Re: [sqlite] sqlite3_step crash? On Wed, 29 Mar 2006 [EMAIL PROTECTED] wrote: >"Boris Popov" <[EMAIL PROTECTED]> wrote: >> >> Does this help at all? >> > >No. A stack trace, especially one witho

Re: [sqlite] sqlite3_step crash?

2006-03-29 Thread Christian Smith
On Wed, 29 Mar 2006 [EMAIL PROTECTED] wrote: >"Boris Popov" <[EMAIL PROTECTED]> wrote: >> >> Does this help at all? >> > >No. A stack trace, especially one without line number >information, is of no help whatsoever. I beg to differ. Any stack trace that includes malloc or free is almost

Re: [sqlite] sqlite3_step crash?

2006-03-29 Thread drh
"Boris Popov" <[EMAIL PROTECTED]> wrote: > > Does this help at all? > No. A stack trace, especially one without line number information, is of no help whatsoever. If you think the problem is in SQLite and not in your own code, then you should do as much of the following as you can: (1)

  1   2   >