Re: [sqlite] sth more then step()

2005-02-16 Thread Dennis Cote
ivan wrote:
Hi,
Is there any way to skip rows in prepared statement and jump to next,
sth like moveto (in sqlite3) ??
Kind of... you can use the sqlite3_step() function to skip result rows. If 
you call this function 10 times it will skip over 10 rows. Then you use the 
sqlite3_column_*() API functins to read the data from the rows you are 
interested in. There is no way to skip 10 records with a single call (to the 
best of my knowledge).

Why I have to use LIMIT in SELECT when I need use only OFFSET ?
Because thats how it is defined by the SQL language. ;-)
Actually it's not part of the standard, but it is a common extension 
supported by several RDMS. If you don't want to limit the number of rows 
returned then pass a negative limit value. For example:

SELECT * FROM table LIMIT -1 OFFSET 10
will return all rows of the table after skipping the first 10.
HTH
Dennis Cote 


Re: [sqlite] sth more then step()

2005-02-16 Thread Dennis Cote
ivan wrote:
Hi,
Is there any way to skip rows in prepared statement and jump to next,
sth like moveto (in sqlite3) ??
Use sqlite3_step(). You can call it anytime to skip to the next row of the 
result set. If you want to skip the first 10 rows simply call it 10 times 
then start looking at your results using the sqlite3_column_*() API 
functions.

Why I have to use LIMIT in SELECT when I need use only OFFSET ?
Because that's how it is defined in the SQL standards. ;-)
If you don't want an upper limit then use a negative limit valaue. For 
example:

SELECT * FROM table LIMIT -1 OFFSET 10
will return all the rows in table after skipping the first 10.
HTH
Dennis Cote 


[sqlite] sth more then step()

2005-02-15 Thread ivan

Hi,

Is there any way to skip rows in prepared statement and jump to next, sth
like moveto (in sqlite3) ??

Why I have to use LIMIT in SELECT when I need use only OFFSET ?

Thanks
 Iv