Re: [sqlite] Rowid After Sorting

2008-03-25 Thread Mahalakshmi.m
Dennis Cote wrote: >Then you should add an index on the Name column and use that to process >your queries in Name order more quickly. >create index on MyTable(Name); Thanks a lot Dennis. My process is more fast by means indexing. Dennis Cote wrote: >If you really insist on reordering your

[sqlite] finding rows within a certain time interval of another row

2008-03-25 Thread P Kishor
Given a table t (name, date) I want to find all rows within, say, 6 months of a specific row, say name = 'foo'. So, I am doing SELECT name FROM t WHERE (SELECT julianday(date) FROM t WHERE name = 'foo') - julianday(date) < 180 OR julianday(date) - (SELECT julianday(date) FROM

Re: [sqlite] Multithreads access the same database resultingin database is locked error

2008-03-25 Thread Xuanvinh Vu
I didnt realize that it could cause livelocks. Thank you for bringing that to my attention. It still doesnt explain why the database stays locked. I could just ignore the error and wait to update the database the next time the thread runs again. What I want to know is why once I got the

Re: [sqlite] resetting a column back to its default value

2008-03-25 Thread Dennis Cote
Alex Katebi wrote: > > I was woundering how I can update a column in my table back to its default > value. > > For example: > > create table t1 (value integer default 55, name text); > insert into t1(name) values('hello'); > update t1 set value=default; /* for illustration only */ > This

Re: [sqlite] Problems Compiling Sqlite

2008-03-25 Thread Dennis Cote
Jus GoodFun wrote: > > Thanks for the info but before I embark on a huge coding excercise > could you give me a vague clue as to how much work would be involved > to get up and running? > Well that depends upon how similar uC/OS is to one of the supported OS. If it is quite similar you can

Re: [sqlite] Trigger Steps

2008-03-25 Thread drh
"Noah Hart" <[EMAIL PROTECTED]> wrote: > The documentation for Triggers defines a trigger step as follows: > > trigger-step ::= update-statement | insert-statement | > delete-statement | select-statement > > What would be an example of the select-statement? > SELECT statements are useful

Re: [sqlite] Trigger Steps

2008-03-25 Thread Igor Tandetnik
Noah Hart <[EMAIL PROTECTED]> wrote: > The documentation for Triggers defines a trigger step as follows: > > trigger-step ::= update-statement | insert-statement | > delete-statement | select-statement > > What would be an example of the select-statement? Just your plain old SELECT statement.

[sqlite] Trigger Steps

2008-03-25 Thread Noah Hart
The documentation for Triggers defines a trigger step as follows: trigger-step ::=update-statement | insert-statement | delete-statement | select-statement What would be an example of the select-statement? Regards, Noah Hart CONFIDENTIALITY NOTICE: This message may contain

Re: [sqlite] Problems Compiling Sqlite

2008-03-25 Thread drh
Jus GoodFun <[EMAIL PROTECTED]> wrote: > > I tried the DSQLITE_MUTEX_NOOP and then a rebuild but still > got the following compile errors, I'm sure I'm missing something > simple... Try compiling with -DSQLITE_THREADSAFE=0 -- D. Richard Hipp <[EMAIL PROTECTED]>

Re: [sqlite] Problems Compiling Sqlite

2008-03-25 Thread Jus GoodFun
Hi Dennis, Thanks for the info but before I embark on a huge coding excercise could you give me a vague clue as to how much work would be involved to get up and running? Is there any documentation which will help me in implementing ur suggested changes? Sqlite would be

Re: [sqlite] Multithreads access the same database resultingin database is locked error

2008-03-25 Thread Igor Tandetnik
Xuanvinh Vu <[EMAIL PROTECTED]> wrote: > I did check and I have all the BEGINs and COMMITs. I understand that > by default the sqlite busy signal is given right away so what I do is > I wait till the next interval elapses to try to update the DB again > by that time whatever the transaction that

Re: [sqlite] Multithreads access the same database resulting in database is locked error

2008-03-25 Thread Ken
I don't see any error handling in your code for SQLITE_BUSY... Also, Depending upon the odbc driver your using, you might want to change the begin to a "begin immediate" causing the lock to be taken out at the begin vs later on... Xuanvinh Vu <[EMAIL PROTECTED]> wrote: I did check and I

Re: [sqlite] [C] Getting results doesn't work properly

2008-03-25 Thread Igor Tandetnik
"Severin Müller" <[EMAIL PROTECTED]> wrote: > Hi Folks > > I have the following C funtion: > > void get_acc(char *src,int ac,char **av) > { >char *buf = "SELECT accmask FROM testtable;"); > sqlite3 *db; > struct sqlite3_stmt *oStmt; > int rc; >

Re: [sqlite] [C] Getting results doesn't work properly

2008-03-25 Thread Clark Christensen
Well, I'm no C programmer, so I might be full of crap, but it looks like you're closing the db connection inside your while block (after you get the first row's data). Not sure about the exact usage for reset() and finalize(), but they don't seem proper inside a loop like yours. Last, it

Re: [sqlite] Multithreads access the same database resulting in database is locked error

2008-03-25 Thread Xuanvinh Vu
I did check and I have all the BEGINs and COMMITs. I understand that by default the sqlite busy signal is given right away so what I do is I wait till the next interval elapses to try to update the DB again by that time whatever the transaction that causes the DB to block me before should

[sqlite] [C] Getting results doesn't work properly

2008-03-25 Thread Severin Müller
Hi Folks I have the following C funtion: void get_acc(char *src,int ac,char **av) { char *buf = "SELECT accmask FROM testtable;"); sqlite3 *db; struct sqlite3_stmt *oStmt; int rc; if(sqlite3_prepare_v2(db,buf,strlen(buf),,NULL)==SQLITE_OK) {

Re: [sqlite] Multithreads access the same database resulting in database is locked error

2008-03-25 Thread Igor Tandetnik
Xuanvinh Vu <[EMAIL PROTECTED]> wrote: > Here is what the error looks like... > > [1436] 25 Mar 16:24:24 OnEveryHour: Failure occurred while updating > the OneMonth table. Exception: System.Data.Odbc.OdbcException: ERROR > [HY000] database is locked (5) > What does the error code 5 stands for?

[sqlite] Multithreads access the same database resulting in database is locked error

2008-03-25 Thread Xuanvinh Vu
Here is what the error looks like... [1436] 25 Mar 16:24:24 OnEveryHour: Failure occurred while updating the OneMonth table. Exception: System.Data.Odbc.OdbcException: ERROR [HY000] database is locked (5) What does the error code 5 stands for? Also I started getting the errors when I

Re: [sqlite] SELECTing calls < last two weeks?

2008-03-25 Thread Gilles Ganault
On Tue, 25 Mar 2008 11:09:55 -0400, "Derrell Lipman" <[EMAIL PROTECTED]> wrote: >http://www.sqlite.org/cvstrac/wiki?p=DateAndTimeFunctions Thanks guys. For those interested, here's a way to do it: $sql = "SELECT * FROM calls "; $sql .= "WHERE (julianday('now') - julianday(calls_date)) < 15";

Re: [sqlite] resetting a column back to its default value

2008-03-25 Thread P Kishor
On 3/25/08, Alex Katebi <[EMAIL PROTECTED]> wrote: > Hi, > > I was woundering how I can update a column in my table back to its default > value. > > For example: > > create table t1 (value integer default 55, name text); > insert into t1(name) values('hello'); > update t1 set value=default;

[sqlite] resetting a column back to its default value

2008-03-25 Thread Alex Katebi
Hi, I was woundering how I can update a column in my table back to its default value. For example: create table t1 (value integer default 55, name text); insert into t1(name) values('hello'); update t1 set value=default; /* for illustration only */ How can I achive the desired behavior short

Re: [sqlite] how can I find source of sqlite V 2.x

2008-03-25 Thread Dennis Cote
Russell wrote: > > My project had to use Qt 3.3.8, which supports sqlite V2 only. How > can I get the source of V2? > You can use the CVS repository as described at the bottom of the download page http://www.sqlite.org/download.html Or you can modify the links shown on the download page. For

Re: [sqlite] Issue with LEFT JOIN, index, and literal in ON clause

2008-03-25 Thread Dennis Cote
Daniel Ring wrote: > The following behavior when using LEFT OUTER JOIN with an indexed column > and literals in the ON clause is, I'm pretty sure, wrong. SQLite seems > to convert the join to an INNER JOIN in some cases. > > The capture is from SQLite 3.4.2, but I get the same results with

[sqlite] Test insert4-2.4.1 in insert4.test

2008-03-25 Thread Noah Hart
I don't have TCL, so I'm trying to validate sqlite by running some of the tests by hand. In insert4.test, there is a sub-test do_test insert4-2.4.1 { execsql { DELETE FROM t3; INSERT INTO t3 SELECT DISTINCT * FROM t2; SELECT * FROM t3; } } {9 1 1 9} I can run this test by

Re: [sqlite] Problems Compiling Sqlite

2008-03-25 Thread Dennis Cote
Jus GoodFun wrote: > > I develop in 'C' within the Windows version of the Eclipse > Environement producing embedded systems focused on the Motorola > ColdFire Processors specifically the MCF5282. > > The target operating system is The uC/OS which is a preemptive > multitasking RTOS. > You will

Re: [sqlite] SQL error: SQL logic error or missing database

2008-03-25 Thread P Kishor
On 3/25/08, Prabowo Murti <[EMAIL PROTECTED]> wrote: > BanuPrakash G wrote: > > Hi, > > > > I have used the latest verision of sqlite i.e. sqlite-3.5.7 > > Amalgamation release > > for PPC Arch. > > > > I was able to cross compile it successfull and when i use the db to > > create

Re: [sqlite] SQL error: SQL logic error or missing database

2008-03-25 Thread Prabowo Murti
BanuPrakash G wrote: > Hi, > > I have used the latest verision of sqlite i.e. sqlite-3.5.7 > Amalgamation release > for PPC Arch. > > I was able to cross compile it successfull and when i use the db to > create tables > I see on the SQLITE shell the ERROR message as "SQL error: SQL logic >

Re: [sqlite] SQL error: SQL logic error or missing database

2008-03-25 Thread Ken
Try ./sqlite3 BanuPrakash G <[EMAIL PROTECTED]> wrote: Hi, I have used the latest verision of sqlite i.e. sqlite-3.5.7 Amalgamation release for PPC Arch. I was able to cross compile it successfull and when i use the db to create tables I see on the SQLITE shell the ERROR message as

[sqlite] SQL error: SQL logic error or missing database

2008-03-25 Thread BanuPrakash G
Hi, I have used the latest verision of sqlite i.e. sqlite-3.5.7 Amalgamation release for PPC Arch. I was able to cross compile it successfull and when i use the db to create tables I see on the SQLITE shell the ERROR message as "SQL error: SQL logic error or missing database". i.e.

Re: [sqlite] how to reply?

2008-03-25 Thread Dennis Cote
L B wrote: > Sorry for this post, but I can't find a way to reply to a post. It seems that > I can only reply via email to the person who answered me. > How to reply and see my answer on this site? > Your email client must be using the From header rather than the Reply-To header field when

Re: [sqlite] SELECTing calls < last two weeks?

2008-03-25 Thread Griggs, Donald
Regarding: In MySQL, I used the following to only get calls received in the last two weeks: WHERE calls_date > DATE_SUB(CURRENT_DATE, INTERVAL 15 DAY) Is there an equivalent in SQLite, or should I perform this test in PHP? === Hi Giles, The sqlite

Re: [sqlite] SELECTing calls < last two weeks?

2008-03-25 Thread Derrell Lipman
On Tue, Mar 25, 2008 at 11:02 AM, Gilles Ganault <[EMAIL PROTECTED]> wrote: > Hello > > In MySQL, I used the following to only get calls received in the last > two weeks: > > WHERE calls_date > DATE_SUB(CURRENT_DATE, INTERVAL 15 DAY) > > Is there an equivalent in SQLite, or should I

Re: [sqlite] paged query in sqlite

2008-03-25 Thread John Stanton
Do a SELECT, read 100 rows, then read another 100. Your program controls it. Shailesh Madhukar Birari wrote: > Does Sqlite support Paged query? what I mean is on doing select* it should > return me first, say 100, rows and then subsequent calls should return me > successive rows. > Is this

[sqlite] SELECTing calls < last two weeks?

2008-03-25 Thread Gilles Ganault
Hello In MySQL, I used the following to only get calls received in the last two weeks: WHERE calls_date > DATE_SUB(CURRENT_DATE, INTERVAL 15 DAY) Is there an equivalent in SQLite, or should I perform this test in PHP? Thank you. ___

Re: [sqlite] Rowid After Sorting

2008-03-25 Thread Dennis Cote
Mahalakshmi.m wrote: > > I wish to perform all operations in my code with sorted order of the Name > field. > Then you should add an index on the Name column and use that to process your queries in Name order more quickly. create index on MyTable(Name); If you really insist on reordering

Re: [sqlite] paged query in sqlite

2008-03-25 Thread Emilio Platzer
another aproach is to use OFFSET and LIMIT in your select queries: select * from table limit 100 offset 1 then select * from table limit 100 offset 101 then select * from table limit 100 offset 201 etc. Shailesh Madhukar Birari escribió: > Does Sqlite support Paged query? what I mean is on

Re: [sqlite] paged query in sqlite

2008-03-25 Thread Igor Tandetnik
"Shailesh Madhukar Birari" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Does Sqlite support Paged query? what I mean is on doing select* it > should return me first, say 100, rows and then subsequent calls > should return me successive rows. Do a select for all rows. Call

[sqlite] paged query in sqlite

2008-03-25 Thread Shailesh Madhukar Birari
Does Sqlite support Paged query? what I mean is on doing select* it should return me first, say 100, rows and then subsequent calls should return me successive rows. Is this supported in sqlite:? If yes, what are the interfaces? If not, is there an easy way to add this functionality using existing