Re: [sqlite] Any concept of row number in SQLite?

2009-02-19 Thread His Nerdship

Thanks Derrell,
I only need the ROWIDs for the duration of a user edit, and I won't be doing
a VACUUM while that is happening, so this sounds exactly what I need.
When I first populate the GUI grid I will make a separate array of ROWID's,
and these will be in the same order as the rows in the grid.  I can then
index into this array and do a SELECT based on that ROWID.

Problem solved.  Thanks a lot, guys.

Sholto
His Nerdship Pty Ltd


Derrell Lipman wrote:
> 
> On Thu, Feb 19, 2009 at 10:45 PM, His Nerdship
> wrote:
> 
>>
>> Thank you Thomas, that was most helpful.
>> I have just found the ROWID information
>> (http://sqlite.org/lang_createtable.html#rowid) - this is what I was
>> looking
>> for!  You have to know something exists before you can look for it
>> I take it this value will not change, even if the contents of its row
>> change?
>>
> 
> Be careful. Yes, that value *can* change if you depend on the implicit
> ROWID. Specifically, if you delete rows and then VACUUM the rows will be
> renumbered. You can avoid that with:
> 
>>
>> I can create my own INTEGER PRIMARY KEY column, which becomes an alias
>> for
>> the ROWID, but is there a way I can get the 'original' (I don't want to
>> add
>> a column at this stage)?
> 
> 
> If you use your own INTEGER PRIMARY KEY then it becomes the ROWID and it
> will not change upon vacuum.
> 
>>
>> If I call sqlite3_get_table(), it returns that ***result array (I'm using
>> C++), but AFAIK that doesn't contain the ROWID.
>>
> 
> Just request it explicitly:
> 
>   SELECT ROWID, * FROM table_name;
> 
> Derrell
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Any-concept-of-row-number-in-SQLite--tp22112862p22114498.html
Sent from the SQLite mailing list archive at Nabble.com.

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Any concept of row number in SQLite?

2009-02-19 Thread Derrell Lipman
On Thu, Feb 19, 2009 at 10:45 PM, His Nerdship
wrote:

>
> Thank you Thomas, that was most helpful.
> I have just found the ROWID information
> (http://sqlite.org/lang_createtable.html#rowid) - this is what I was
> looking
> for!  You have to know something exists before you can look for it
> I take it this value will not change, even if the contents of its row
> change?
>

Be careful. Yes, that value *can* change if you depend on the implicit
ROWID. Specifically, if you delete rows and then VACUUM the rows will be
renumbered. You can avoid that with:

>
> I can create my own INTEGER PRIMARY KEY column, which becomes an alias for
> the ROWID, but is there a way I can get the 'original' (I don't want to add
> a column at this stage)?


If you use your own INTEGER PRIMARY KEY then it becomes the ROWID and it
will not change upon vacuum.

>
> If I call sqlite3_get_table(), it returns that ***result array (I'm using
> C++), but AFAIK that doesn't contain the ROWID.
>

Just request it explicitly:

  SELECT ROWID, * FROM table_name;

Derrell
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Any concept of row number in SQLite?

2009-02-19 Thread His Nerdship

Thank you Thomas, that was most helpful.
I have just found the ROWID information
(http://sqlite.org/lang_createtable.html#rowid) - this is what I was looking
for!  You have to know something exists before you can look for it
I take it this value will not change, even if the contents of its row
change?

One more question though (there always is) - I see a ROWID is automatically
assigned to each row in the table.  How does one access this value?  I know
I can create my own INTEGER PRIMARY KEY column, which becomes an alias for
the ROWID, but is there a way I can get the 'original' (I don't want to add
a column at this stage)?
If I call sqlite3_get_table(), it returns that ***result array (I'm using
C++), but AFAIK that doesn't contain the ROWID.

As Mañuel would say, ¿qué?

Sholto


Thomas Briggs-2 wrote:
> 
>"It won't be too big..." famous last words.
> 
>I think the rowid is probably safe for what you're trying to do,
> despite the well-intentioned advice others have given you against it.
> 
>Also, if you think the underlying data may change, then I'm not
> sure what good reading the whole table will give you... if the
> underlying data changes, row #28 the first time around may not be row
> #28 the second time around.  Even if you use an ORDER BY clause, which
> you'll absolutely have to do if you go the read-whole-table route.
> 
>What you might want to do is build a map between row number in your
> grid and rowid in the database... that way you aren't relying on the
> rowids being set a certain way, nor relying on the rowids being
> returned to your app in a particular order.
> 
>-T
> 
> On Thu, Feb 19, 2009 at 9:09 PM, His Nerdship
>  wrote:
>>
>> OK, thanks for the info.
>> I will just do what I said before, namely read the whole table (it won't
>> be
>> too big) and extract the required row from the returned array.
>> The reason I wanted a row ID was that all the fields in the display grid
>> can
>> be edited, so by the time I come to process it, any of them might have
>> changed from the original in the database so I can't use them in a WHERE
>> clause.
>> At least I know now
>> Thanks again
>>
>>
>> P Kishor-3 wrote:
>>>
>>> On Thu, Feb 19, 2009 at 6:54 PM, His Nerdship
>>>  wrote:

 Hi,
 I am converting a program from Paradox (stop laughing, please) to
 SQLite.
 Paradox has a useful feature where you can specify the actual index of
 a
 row
 in the table.  This is handy when the table is displayed in a grid and
 you
 want the record corresponding to a row in that grid - you can just
 specify
 the index, say 28, of that grid row and it will get the record no 28
 from
 the table.  It spares the need for a SELECT statement, and is a lot
 more
 efficient.
 As a SQLite newbie, the only way I can see to do this is to read the
 whole
 table with sqlite3_get_table() and then get the required row from the
 returned array.  This seems overkill when I just want a single record.
>>>
>>> There is the rowid, but I am not sure what you want to do... are you
>>> expecting a database table to be a linear list of entries? Generally
>>> one uses a spreadsheet for that kind of stuff. A SQL database doesn't
>>> have an internal concept of order. You specify a criteria and the db
>>> returns a SET of rows or records. You can constrain the SET by
>>> specifying criteria (the WHERE clause), and you can impose an order on
>>> the returned rows by specifying an ORDER clause.
>>>
>>> If you want just one specific row, just do a
>>>
>>> SELECT cols FROM table WHERE some_primary_key = ?
>>>
>>> If you don't want to specify and control your own primary key, you can
>>> use the rowid which is something the db uses internally for its own
>>> shenanigans.
>>>
>>>
 Is there a more compact way of doing this?
 Thanks in advance etc.
 Sholto
>>>
>>>
>>>
>>> --
>>> Puneet Kishor http://www.punkish.org/
>>> Nelson Institute for Environmental Studies http://www.nelson.wisc.edu/
>>> Open Source Geospatial Foundation (OSGeo) http://www.osgeo.org/
>>> Sent from: Madison Wisconsin United States.
>>> ___
>>> sqlite-users mailing list
>>> sqlite-users@sqlite.org
>>> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>>>
>>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Any-concept-of-row-number-in-SQLite--tp22112862p22113562.html
>> Sent from the SQLite mailing list archive at Nabble.com.
>>
>> ___
>> sqlite-users mailing list
>> sqlite-users@sqlite.org
>> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>>
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Any-concept-of-row-number-in-SQLite--tp22112862p22114364.html
S

Re: [sqlite] Any concept of row number in SQLite?

2009-02-19 Thread John Stanton
Use the Sqlite row id.

His Nerdship wrote:
> Hi,
> I am converting a program from Paradox (stop laughing, please) to SQLite. 
> Paradox has a useful feature where you can specify the actual index of a row
> in the table.  This is handy when the table is displayed in a grid and you
> want the record corresponding to a row in that grid - you can just specify
> the index, say 28, of that grid row and it will get the record no 28 from
> the table.  It spares the need for a SELECT statement, and is a lot more
> efficient.
> As a SQLite newbie, the only way I can see to do this is to read the whole
> table with sqlite3_get_table() and then get the required row from the
> returned array.  This seems overkill when I just want a single record.
> Is there a more compact way of doing this?
> Thanks in advance etc.
> Sholto

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Any concept of row number in SQLite?

2009-02-19 Thread Billy Gray
Might I suggest using MD5 (or other) hashing algorithms in your application
as a way to check whether data in your application's memory is different
from what's in the database?

There are also locking mechanisms you can use to avoid (or create!)
concurrency problems.  If you're not worried about two processes operating
on the same row(s), this all shouldn't really be much of an issue for you.
In any event, I think you're looking to implement some means for your
application to tell whether the data is dirty or not, and ROWNUM or a
similar feature would not be more helpful than a primary key.

For the record, you can do a lot of convenient things using ROWNUM in Oracle
:-)

Cheers,
Billy

On Thu, Feb 19, 2009 at 9:09 PM, His Nerdship wrote:

>
> OK, thanks for the info.
> I will just do what I said before, namely read the whole table (it won't be
> too big) and extract the required row from the returned array.
> The reason I wanted a row ID was that all the fields in the display grid
> can
> be edited, so by the time I come to process it, any of them might have
> changed from the original in the database so I can't use them in a WHERE
> clause.
> At least I know now
> Thanks again
>
>
> P Kishor-3 wrote:
> >
> > On Thu, Feb 19, 2009 at 6:54 PM, His Nerdship
> >  wrote:
> >>
> >> Hi,
> >> I am converting a program from Paradox (stop laughing, please) to
> SQLite.
> >> Paradox has a useful feature where you can specify the actual index of a
> >> row
> >> in the table.  This is handy when the table is displayed in a grid and
> >> you
> >> want the record corresponding to a row in that grid - you can just
> >> specify
> >> the index, say 28, of that grid row and it will get the record no 28
> from
> >> the table.  It spares the need for a SELECT statement, and is a lot more
> >> efficient.
> >> As a SQLite newbie, the only way I can see to do this is to read the
> >> whole
> >> table with sqlite3_get_table() and then get the required row from the
> >> returned array.  This seems overkill when I just want a single record.
> >
> > There is the rowid, but I am not sure what you want to do... are you
> > expecting a database table to be a linear list of entries? Generally
> > one uses a spreadsheet for that kind of stuff. A SQL database doesn't
> > have an internal concept of order. You specify a criteria and the db
> > returns a SET of rows or records. You can constrain the SET by
> > specifying criteria (the WHERE clause), and you can impose an order on
> > the returned rows by specifying an ORDER clause.
> >
> > If you want just one specific row, just do a
> >
> > SELECT cols FROM table WHERE some_primary_key = ?
> >
> > If you don't want to specify and control your own primary key, you can
> > use the rowid which is something the db uses internally for its own
> > shenanigans.
> >
> >
> >> Is there a more compact way of doing this?
> >> Thanks in advance etc.
> >> Sholto
> >
> >
> >
> > --
> > Puneet Kishor http://www.punkish.org/
> > Nelson Institute for Environmental Studies http://www.nelson.wisc.edu/
> > Open Source Geospatial Foundation (OSGeo) http://www.osgeo.org/
> > Sent from: Madison Wisconsin United States.
> > ___
> > sqlite-users mailing list
> > sqlite-users@sqlite.org
> > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Any-concept-of-row-number-in-SQLite--tp22112862p22113562.html
> Sent from the SQLite mailing list archive at Nabble.com.
>
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>



-- 
Billy Gray
wg...@zetetic.net
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Any concept of row number in SQLite?

2009-02-19 Thread Thomas Briggs
   "It won't be too big..." famous last words.

   I think the rowid is probably safe for what you're trying to do,
despite the well-intentioned advice others have given you against it.

   Also, if you think the underlying data may change, then I'm not
sure what good reading the whole table will give you... if the
underlying data changes, row #28 the first time around may not be row
#28 the second time around.  Even if you use an ORDER BY clause, which
you'll absolutely have to do if you go the read-whole-table route.

   What you might want to do is build a map between row number in your
grid and rowid in the database... that way you aren't relying on the
rowids being set a certain way, nor relying on the rowids being
returned to your app in a particular order.

   -T

On Thu, Feb 19, 2009 at 9:09 PM, His Nerdship
 wrote:
>
> OK, thanks for the info.
> I will just do what I said before, namely read the whole table (it won't be
> too big) and extract the required row from the returned array.
> The reason I wanted a row ID was that all the fields in the display grid can
> be edited, so by the time I come to process it, any of them might have
> changed from the original in the database so I can't use them in a WHERE
> clause.
> At least I know now
> Thanks again
>
>
> P Kishor-3 wrote:
>>
>> On Thu, Feb 19, 2009 at 6:54 PM, His Nerdship
>>  wrote:
>>>
>>> Hi,
>>> I am converting a program from Paradox (stop laughing, please) to SQLite.
>>> Paradox has a useful feature where you can specify the actual index of a
>>> row
>>> in the table.  This is handy when the table is displayed in a grid and
>>> you
>>> want the record corresponding to a row in that grid - you can just
>>> specify
>>> the index, say 28, of that grid row and it will get the record no 28 from
>>> the table.  It spares the need for a SELECT statement, and is a lot more
>>> efficient.
>>> As a SQLite newbie, the only way I can see to do this is to read the
>>> whole
>>> table with sqlite3_get_table() and then get the required row from the
>>> returned array.  This seems overkill when I just want a single record.
>>
>> There is the rowid, but I am not sure what you want to do... are you
>> expecting a database table to be a linear list of entries? Generally
>> one uses a spreadsheet for that kind of stuff. A SQL database doesn't
>> have an internal concept of order. You specify a criteria and the db
>> returns a SET of rows or records. You can constrain the SET by
>> specifying criteria (the WHERE clause), and you can impose an order on
>> the returned rows by specifying an ORDER clause.
>>
>> If you want just one specific row, just do a
>>
>> SELECT cols FROM table WHERE some_primary_key = ?
>>
>> If you don't want to specify and control your own primary key, you can
>> use the rowid which is something the db uses internally for its own
>> shenanigans.
>>
>>
>>> Is there a more compact way of doing this?
>>> Thanks in advance etc.
>>> Sholto
>>
>>
>>
>> --
>> Puneet Kishor http://www.punkish.org/
>> Nelson Institute for Environmental Studies http://www.nelson.wisc.edu/
>> Open Source Geospatial Foundation (OSGeo) http://www.osgeo.org/
>> Sent from: Madison Wisconsin United States.
>> ___
>> sqlite-users mailing list
>> sqlite-users@sqlite.org
>> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>>
>>
>
> --
> View this message in context: 
> http://www.nabble.com/Any-concept-of-row-number-in-SQLite--tp22112862p22113562.html
> Sent from the SQLite mailing list archive at Nabble.com.
>
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Any concept of row number in SQLite?

2009-02-19 Thread Rich Shepard
On Thu, 19 Feb 2009, His Nerdship wrote:

> I will just do what I said before, namely read the whole table (it won't
> be too big) and extract the required row from the returned array. The
> reason I wanted a row ID was that all the fields in the display grid can
> be edited, so by the time I come to process it, any of them might have
> changed from the original in the database so I can't use them in a WHERE
> clause.

   I've no idea what language you're using for your application, but what you
describe is not always the case. I've an application written in python that
uses the pysqlite2 middleware. I can fetch a single row, examine it to
determine if it meets the criteria for selection, then fetch the next
record. Records meeting selection criteria are added to a list and displayed
in the appropriate widgets.

Rich

-- 
Richard B. Shepard, Ph.D.   |  IntegrityCredibility
Applied Ecosystem Services, Inc.|Innovation
 Voice: 503-667-4517  Fax: 503-667-8863
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Any concept of row number in SQLite?

2009-02-19 Thread His Nerdship

OK, thanks for the info.
I will just do what I said before, namely read the whole table (it won't be
too big) and extract the required row from the returned array.
The reason I wanted a row ID was that all the fields in the display grid can
be edited, so by the time I come to process it, any of them might have
changed from the original in the database so I can't use them in a WHERE
clause.
At least I know now
Thanks again


P Kishor-3 wrote:
> 
> On Thu, Feb 19, 2009 at 6:54 PM, His Nerdship
>  wrote:
>>
>> Hi,
>> I am converting a program from Paradox (stop laughing, please) to SQLite.
>> Paradox has a useful feature where you can specify the actual index of a
>> row
>> in the table.  This is handy when the table is displayed in a grid and
>> you
>> want the record corresponding to a row in that grid - you can just
>> specify
>> the index, say 28, of that grid row and it will get the record no 28 from
>> the table.  It spares the need for a SELECT statement, and is a lot more
>> efficient.
>> As a SQLite newbie, the only way I can see to do this is to read the
>> whole
>> table with sqlite3_get_table() and then get the required row from the
>> returned array.  This seems overkill when I just want a single record.
> 
> There is the rowid, but I am not sure what you want to do... are you
> expecting a database table to be a linear list of entries? Generally
> one uses a spreadsheet for that kind of stuff. A SQL database doesn't
> have an internal concept of order. You specify a criteria and the db
> returns a SET of rows or records. You can constrain the SET by
> specifying criteria (the WHERE clause), and you can impose an order on
> the returned rows by specifying an ORDER clause.
> 
> If you want just one specific row, just do a
> 
> SELECT cols FROM table WHERE some_primary_key = ?
> 
> If you don't want to specify and control your own primary key, you can
> use the rowid which is something the db uses internally for its own
> shenanigans.
> 
> 
>> Is there a more compact way of doing this?
>> Thanks in advance etc.
>> Sholto
> 
> 
> 
> -- 
> Puneet Kishor http://www.punkish.org/
> Nelson Institute for Environmental Studies http://www.nelson.wisc.edu/
> Open Source Geospatial Foundation (OSGeo) http://www.osgeo.org/
> Sent from: Madison Wisconsin United States.
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Any-concept-of-row-number-in-SQLite--tp22112862p22113562.html
Sent from the SQLite mailing list archive at Nabble.com.

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Any concept of row number in SQLite?

2009-02-19 Thread Alex Mandel
P Kishor wrote:
> On Thu, Feb 19, 2009 at 6:54 PM, His Nerdship
>  wrote:
>> Hi,
>> I am converting a program from Paradox (stop laughing, please) to SQLite.
>> Paradox has a useful feature where you can specify the actual index of a row
>> in the table.  This is handy when the table is displayed in a grid and you
>> want the record corresponding to a row in that grid - you can just specify
>> the index, say 28, of that grid row and it will get the record no 28 from
>> the table.  It spares the need for a SELECT statement, and is a lot more
>> efficient.
>> As a SQLite newbie, the only way I can see to do this is to read the whole
>> table with sqlite3_get_table() and then get the required row from the
>> returned array.  This seems overkill when I just want a single record.
> 
> There is the rowid, but I am not sure what you want to do... are you
> expecting a database table to be a linear list of entries? Generally
> one uses a spreadsheet for that kind of stuff. A SQL database doesn't
> have an internal concept of order. You specify a criteria and the db
> returns a SET of rows or records. You can constrain the SET by
> specifying criteria (the WHERE clause), and you can impose an order on
> the returned rows by specifying an ORDER clause.
> 
> If you want just one specific row, just do a
> 
> SELECT cols FROM table WHERE some_primary_key = ?
> 
> If you don't want to specify and control your own primary key, you can
> use the rowid which is something the db uses internally for its own
> shenanigans.
> 
> 
>> Is there a more compact way of doing this?
>> Thanks in advance etc.
>> Sholto
> 
> 
> 

The behavior you want sounds to me like a table is treated as an object,
and the object has a cursor or specific property for each record. It
would make sense if you want to reference a record in this way that you
would need to load the whole table into some type of array or list and
cursor your way to that object.

My guess is the application you used before abstracted the table to an
object in the way that SQL Alchemy turns tables into objects for python.
This is the object oriented programming approach to the issue, the most
efficient sql way would be to do a SELECT statement which for some
reason you don't want to do.

Alex
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Any concept of row number in SQLite?

2009-02-19 Thread Rich Shepard
On Thu, 19 Feb 2009, P Kishor wrote:

> There is the rowid, but I am not sure what you want to do... are you
> expecting a database table to be a linear list of entries? Generally one
> uses a spreadsheet for that kind of stuff. A SQL database doesn't have an
> internal concept of order. You specify a criteria and the db returns a SET
> of rows or records. You can constrain the SET by specifying criteria (the
> WHERE clause), and you can impose an order on the returned rows by
> specifying an ORDER clause.

   And, there is no particular order of rows in the table. They can be
re-ordered behind the scenes when the db engine determines benefits to the
change. That's why it's never a good idea to use row IDs.

Rich

-- 
Richard B. Shepard, Ph.D.   |  IntegrityCredibility
Applied Ecosystem Services, Inc.|Innovation
 Voice: 503-667-4517  Fax: 503-667-8863
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Any concept of row number in SQLite?

2009-02-19 Thread P Kishor
On Thu, Feb 19, 2009 at 6:54 PM, His Nerdship
 wrote:
>
> Hi,
> I am converting a program from Paradox (stop laughing, please) to SQLite.
> Paradox has a useful feature where you can specify the actual index of a row
> in the table.  This is handy when the table is displayed in a grid and you
> want the record corresponding to a row in that grid - you can just specify
> the index, say 28, of that grid row and it will get the record no 28 from
> the table.  It spares the need for a SELECT statement, and is a lot more
> efficient.
> As a SQLite newbie, the only way I can see to do this is to read the whole
> table with sqlite3_get_table() and then get the required row from the
> returned array.  This seems overkill when I just want a single record.

There is the rowid, but I am not sure what you want to do... are you
expecting a database table to be a linear list of entries? Generally
one uses a spreadsheet for that kind of stuff. A SQL database doesn't
have an internal concept of order. You specify a criteria and the db
returns a SET of rows or records. You can constrain the SET by
specifying criteria (the WHERE clause), and you can impose an order on
the returned rows by specifying an ORDER clause.

If you want just one specific row, just do a

SELECT cols FROM table WHERE some_primary_key = ?

If you don't want to specify and control your own primary key, you can
use the rowid which is something the db uses internally for its own
shenanigans.


> Is there a more compact way of doing this?
> Thanks in advance etc.
> Sholto



-- 
Puneet Kishor http://www.punkish.org/
Nelson Institute for Environmental Studies http://www.nelson.wisc.edu/
Open Source Geospatial Foundation (OSGeo) http://www.osgeo.org/
Sent from: Madison Wisconsin United States.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Any concept of row number in SQLite?

2009-02-19 Thread His Nerdship

Hi,
I am converting a program from Paradox (stop laughing, please) to SQLite. 
Paradox has a useful feature where you can specify the actual index of a row
in the table.  This is handy when the table is displayed in a grid and you
want the record corresponding to a row in that grid - you can just specify
the index, say 28, of that grid row and it will get the record no 28 from
the table.  It spares the need for a SELECT statement, and is a lot more
efficient.
As a SQLite newbie, the only way I can see to do this is to read the whole
table with sqlite3_get_table() and then get the required row from the
returned array.  This seems overkill when I just want a single record.
Is there a more compact way of doing this?
Thanks in advance etc.
Sholto
-- 
View this message in context: 
http://www.nabble.com/Any-concept-of-row-number-in-SQLite--tp22112862p22112862.html
Sent from the SQLite mailing list archive at Nabble.com.

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users