Re: [sqlite] upstreaming Chromium patches for file handle passing support

2010-08-27 Thread Paweł Hajdan , Jr .
On Fri, Aug 27, 2010 at 04:58, Richard Hipp  wrote:

> The VFS interface is published, stable, and documented.  I think the VFS is
> the interface you should be using.
>
> You do not have to patch os_unix.c.  Leave it unchanged.


Sounds good to me. This is one of my goals - to avoid those custom patches,
or send them upstream.


> Instead, create your own os_chromium.c based off of your patched os_unix.c
> (changing just a
> few identifiers to avoid conflicts) and link it with your process as a
> separate file.


I think this is the non-trivial step. Those chromium_sqlite3 functions use
some symbols that are declared static in os_unix.c, so they're not available
outside of it. That means we would have to copy a lot of os_unix.c file's
contents, and I'd prefer to avoid that.


> (You really should be using the SQLite amalgamation file
> sqlite3.c - not separate source files - since the amalgamation runs about
> 5%
> or 10% faster due to better compiler optimizations.)


At least currently Chromium isn't going to use the amalgamation because we
have a lot of custom patches. I'm trying to clean up this situation though.


> At start-time, simply call sqlite3_vfs_register() to register your
> customized VFS with SQLite.
>

That's what our implementation effectively does, see
http://trac.webkit.org/browser/trunk/WebCore/platform/sql/chromium/SQLiteFileSystemChromiumPosix.cpp
 .

Would it be possible to add a variant of the unix vfs inside of os_unix.c?
I'm still not sure if the current VFS interface would be sufficient for
that. It seems that the most needed exposed call is ability to transform a
file path into a file descriptor
(chromium_sqlite3_get_reusable_file_handle).
chromium_sqlite3_get_reusable_file_handle
currently needs access to things like unixFile, findReusableFd,
UnixUnusedFd, and sqlite3_malloc. Would you have any suggestions how to fit
that into the SQLite's VFS implementation?
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] rollback to savepoint regression / bug with journal_mode=off and locking_mode=exclusive

2010-08-27 Thread Ralf Junker
On 27.08.2010 18:58, Noah Hart wrote:

> http://www.sqlite.org/pragma.html#pragma_journal_mode states
> 
> The OFF journaling mode disables the atomic commit and rollback capabilities
> of SQLite. The ROLLBACK command no longer works; it behaves in an undefined
> way. Applications must avoid using the ROLLBACK command when the journal
> mode is OFF

I had read this, too, before posting my report, and that's why I
acknowledged that it might just be a regression and not a bug.

> I don't think this is a bug, just different undefined results.

But the fact that this is actually part of the test suite
(savepoint.test) where it works well with locking_mode=normal makes me
believe that it is not just some undefined behavior, even if the
documentation says so.

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


Re: [sqlite] rollback to savepoint regression / bug with journal_mode=off and locking_mode=exclusive

2010-08-27 Thread Noah Hart

http://www.sqlite.org/pragma.html#pragma_journal_mode states

The OFF journaling mode disables the atomic commit and rollback capabilities
of SQLite. The ROLLBACK command no longer works; it behaves in an undefined
way. Applications must avoid using the ROLLBACK command when the journal
mode is OFF


I don't think this is a bug, just different undefined results.

Regards,

Noah


SQLite 3.7.2 has a regression with journal_mode=off and
locking_mode=exclusive. Here is the SQL reproduce:


drop table if exists t1;

PRAGMA locking_mode=exclusive;
pragma locking_mode;

CREATE TABLE t1(a PRIMARY KEY, b);

PRAGMA journal_mode = off;

BEGIN;
  INSERT INTO t1 VALUES(13, 14);
  SAVEPOINT s1;
INSERT INTO t1 VALUES(15, 16);
  ROLLBACK TO s1;
ROLLBACK;

SELECT * FROM t1;
-

SQLite3 3.7.2 rolls back the savepoint insert and yields:

exclusive
exclusive
off
13|14

SQLite3 3.6.23.1 commits the savepoint insert and yields:

exclusive
exclusive
off
13|14
15|16

The SQL was shortened from savepoint.test. It works well in
locking_mode=normal so I dare say this is most likely a
locking_mode=exclusive bug.

Ralf

-- 
View this message in context: 
http://old.nabble.com/rollback-to-savepoint-regression---bug-with-journal_mode%3Doff-and-locking_mode%3Dexclusive-tp29554275p29554673.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] rollback to savepoint regression / bug with journal_mode=off and locking_mode=exclusive

2010-08-27 Thread Ralf Junker
SQLite 3.7.2 has a regression with journal_mode=off and
locking_mode=exclusive. Here is the SQL reproduce:


drop table if exists t1;

PRAGMA locking_mode=exclusive;
pragma locking_mode;

CREATE TABLE t1(a PRIMARY KEY, b);

PRAGMA journal_mode = off;

BEGIN;
  INSERT INTO t1 VALUES(13, 14);
  SAVEPOINT s1;
INSERT INTO t1 VALUES(15, 16);
  ROLLBACK TO s1;
ROLLBACK;

SELECT * FROM t1;
-

SQLite3 3.7.2 rolls back the savepoint insert and yields:

exclusive
exclusive
off
13|14

SQLite3 3.6.23.1 commits the savepoint insert and yields:

exclusive
exclusive
off
13|14
15|16

The SQL was shortened from savepoint.test. It works well in
locking_mode=normal so I dare say this is most likely a
locking_mode=exclusive bug.

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


Re: [sqlite] SQLite version 3.7.2

2010-08-27 Thread Richard Hipp
The problem is in Apple-contributed code to work with their NFS filesystem.
You can disable all of the Apple code by compiling with
-DSQLITE_ENABLE_LOCKING_STYLE=0

On Fri, Aug 27, 2010 at 10:03 AM, Jim Wilcoxson  wrote:

> Using the SQLite Encryption Edition rev 3.7.0.1, the latest released
> version, on OSX Tiger (10.4), results in an undefined reference to
> gethostuuid.  Is OSX 10.4 no longer supported?
>
> Thanks,
> Jim
> --
> HashBackup: easy onsite and offsite Unix backup
> http://sites.google.com/site/hashbackup
>
>
> On Mon, Aug 23, 2010 at 9:01 PM, Richard Hipp  wrote:
>
> > SQLite version 3.7.2 is now available on the SQLite website:
> > http://www.sqlite.org/
> >
> > SQLite version 3.7.2 fixes a single bug that was discovered just hours
> > after
> > the release of 3.7.1.  The bug can result in corruption of the database
> > free-list after an incremental vacuum.  The bug had nothing whatsoever to
> > do
> > with SQLite version 3.7.1 or any other recent release.  The problem had
> > been
> > in the code for over a year, since version 3.6.16.  The discovery of the
> > problem so soon after the release of version 3.7.1 was purely
> coincidental.
> >
> > The bug fixed in 3.7.2 can result in database corruption.  However, the
> > corruption caused by this bug can almost always be fixed simply by
> running
> > VACUUM on the database.  And the corruption will only occur in an
> > incrementally vacuumed database which at some point in time contains
> > hundreds of unused pages which are slowly released back to the operating
> > system by multiple calls to the incremental_vacuum PRAGMA.  Even then,
> one
> > must be particularly unlucky to hit the right combination of freed pages
> in
> > order to trigger the bug.  Hence the problem is quite obscure and was not
> > noticed for over a year.
> >
> > Hundreds of lines of code where changed for version 3.7.2, but most of
> > those
> > changes were to test procedures.  As is the custom with SQLite, not only
> > was
> > the specific bug fixed, but new tests where put in place to detect and
> > prevent similar kinds of bugs elsewhere in the code.  We believe that one
> > should not just fix the bug, but also fix the process that generated the
> > bug. The only 4 working lines of code were changed for version 3.7.2:
> >
> >
> > http://www.sqlite.org/src/fdiff?v1=2dff4076d3c994dc&v2=5047fb303cdf6806
> >
> > Special thanks to Filip Navara for finding and reporting the problem with
> > incremental vacuum.
> >
> > Please report any other problems to the sqlite-users@sqlite.org mailing
> > list, or directly to me.  Thanks.
> >
> > --
> > D. Richard Hipp
> > d...@sqlite.org
> > ___
> > 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
>



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


Re: [sqlite] SQLite version 3.7.2

2010-08-27 Thread Jim Wilcoxson
Using the SQLite Encryption Edition rev 3.7.0.1, the latest released
version, on OSX Tiger (10.4), results in an undefined reference to
gethostuuid.  Is OSX 10.4 no longer supported?

Thanks,
Jim
--
HashBackup: easy onsite and offsite Unix backup
http://sites.google.com/site/hashbackup


On Mon, Aug 23, 2010 at 9:01 PM, Richard Hipp  wrote:

> SQLite version 3.7.2 is now available on the SQLite website:
> http://www.sqlite.org/
>
> SQLite version 3.7.2 fixes a single bug that was discovered just hours
> after
> the release of 3.7.1.  The bug can result in corruption of the database
> free-list after an incremental vacuum.  The bug had nothing whatsoever to
> do
> with SQLite version 3.7.1 or any other recent release.  The problem had
> been
> in the code for over a year, since version 3.6.16.  The discovery of the
> problem so soon after the release of version 3.7.1 was purely coincidental.
>
> The bug fixed in 3.7.2 can result in database corruption.  However, the
> corruption caused by this bug can almost always be fixed simply by running
> VACUUM on the database.  And the corruption will only occur in an
> incrementally vacuumed database which at some point in time contains
> hundreds of unused pages which are slowly released back to the operating
> system by multiple calls to the incremental_vacuum PRAGMA.  Even then, one
> must be particularly unlucky to hit the right combination of freed pages in
> order to trigger the bug.  Hence the problem is quite obscure and was not
> noticed for over a year.
>
> Hundreds of lines of code where changed for version 3.7.2, but most of
> those
> changes were to test procedures.  As is the custom with SQLite, not only
> was
> the specific bug fixed, but new tests where put in place to detect and
> prevent similar kinds of bugs elsewhere in the code.  We believe that one
> should not just fix the bug, but also fix the process that generated the
> bug. The only 4 working lines of code were changed for version 3.7.2:
>
>
> http://www.sqlite.org/src/fdiff?v1=2dff4076d3c994dc&v2=5047fb303cdf6806
>
> Special thanks to Filip Navara for finding and reporting the problem with
> incremental vacuum.
>
> Please report any other problems to the sqlite-users@sqlite.org mailing
> list, or directly to me.  Thanks.
>
> --
> D. Richard Hipp
> d...@sqlite.org
> ___
> 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] EXTERNAL: Fwd: Conflicting table existence errors after SAVEPOINT & ROLLBACKs

2010-08-27 Thread Black, Michael (IS)
I confirmed this also is a bug in 3.7.2
 
Interesting thing thoughif you add one .schema statement the problem goes 
away.  I wanted to see what it thought about the schema along the way.
So after 
 
With bug:
SQLite version 3.7.2
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> select sqlite_source_id();
2010-08-23 18:52:01 42537b60566f288167f1b5864a5435986838e3a3
sqlite> begin;
sqlite> create table t(a);
sqlite> insert into t values (1);
sqlite> savepoint a;
sqlite> insert into t values (2);
sqlite> rollback to savepoint a;
sqlite> select * from t;
1
sqlite> .schema
CREATE TABLE t(a);
sqlite> rollback;
sqlite> begin;
sqlite> create table t(a);
Error: table t already exists

Without bug:
SQLite version 3.7.2
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> select sqlite_source_id();
2010-08-23 18:52:01 42537b60566f288167f1b5864a5435986838e3a3
sqlite> begin;
sqlite> create table t(a);
sqlite> insert into t values (1);
sqlite> savepoint a;
sqlite> insert into t values (2);
sqlite> rollback to savepoint a;
sqlite> select * from t;
1
sqlite> .schema
CREATE TABLE t(a);
sqlite> rollback;
sqlite> begin;
sqlite> create table t(a);
Error: table t already exists< gee -- I thought the rollback should have 
dropped the schema
sqlite> create table t(a);
Error: table t already exists< try again -- yes, it thinks schema is there
sqlite> .schema   < schema indeed looks empty
sqlite> create table t(a);  < let's try again -- this time it works!
sqlite> .schema
CREATE TABLE t(a);

 
 
Michael D. Black
Senior Scientist
Advanced Analytics Directorate
Northrop Grumman Information Systems
 



From: sqlite-users-boun...@sqlite.org on behalf of Simon Davies
Sent: Fri 8/27/2010 8:28 AM
To: General Discussion of SQLite Database
Subject: EXTERNAL:[sqlite] Fwd: Conflicting table existence errors after 
SAVEPOINT & ROLLBACKs



Repost after being bounced - if the moderator hasn't looked at this in
16 days, perhaps he never will...

> Your mail to 'sqlite-users' with the subject
>
>Conflicting table existence errors after SAVEPOINT & ROLLBACKs
>
> Is being held until the list moderator can review it for approval.
>
> The reason it is being held:
>
>Post by non-member to a members-only list
>
> Either the message will get posted to the list, or you will receive
> notification of the moderator's decision.  If you would like to cancel
> this posting, please visit the following URL:
>
>
> http://sqlite.org:8080/cgi-bin/mailman/confirm/sqlite-users/408a0103ea2cc1c97a22f37f83e44678937e4962


-- Forwarded message --
From: Simon Davies 
Date: 11 August 2010 12:38
Subject: Conflicting table existence errors after SAVEPOINT & ROLLBACKs
To: sqlite-users@sqlite.org


Hi Users,

I'm running Windows 7 Pro on a Dell box;

First noticed this in 3.6.11, confirmed it occurs in 3.7.0.1

Built from amalgamation.

C:\> sqlite3
SQLite version 3.7.0.1
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite>
sqlite> select sqlite_source_id();
2010-08-04 12:31:11 042a1abb030a0711386add7eb6e10832cc8b0f57
sqlite>
sqlite> begin;
sqlite> create table t( a );
sqlite> insert into t values( 1  );
sqlite> savepoint a;
sqlite> insert into t values( 2 );
sqlite> rollback to savepoint a;
sqlite> select * from t;
1
sqlite> rollback;
sqlite>
sqlite> begin;
sqlite> create table t( a );
Error: table t already exists
sqlite> insert into t values( 1 );
Error: no such table: t
sqlite>

Can anybody else reproduce this?

Regards,
Simon
___
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


[sqlite] Fwd: Conflicting table existence errors after SAVEPOINT & ROLLBACKs

2010-08-27 Thread Simon Davies
Repost after being bounced - if the moderator hasn't looked at this in
16 days, perhaps he never will...

> Your mail to 'sqlite-users' with the subject
>
>Conflicting table existence errors after SAVEPOINT & ROLLBACKs
>
> Is being held until the list moderator can review it for approval.
>
> The reason it is being held:
>
>Post by non-member to a members-only list
>
> Either the message will get posted to the list, or you will receive
> notification of the moderator's decision.  If you would like to cancel
> this posting, please visit the following URL:
>
>
> http://sqlite.org:8080/cgi-bin/mailman/confirm/sqlite-users/408a0103ea2cc1c97a22f37f83e44678937e4962


-- Forwarded message --
From: Simon Davies 
Date: 11 August 2010 12:38
Subject: Conflicting table existence errors after SAVEPOINT & ROLLBACKs
To: sqlite-users@sqlite.org


Hi Users,

I'm running Windows 7 Pro on a Dell box;

First noticed this in 3.6.11, confirmed it occurs in 3.7.0.1

Built from amalgamation.

C:\> sqlite3
SQLite version 3.7.0.1
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite>
sqlite> select sqlite_source_id();
2010-08-04 12:31:11 042a1abb030a0711386add7eb6e10832cc8b0f57
sqlite>
sqlite> begin;
sqlite> create table t( a );
sqlite> insert into t values( 1  );
sqlite> savepoint a;
sqlite> insert into t values( 2 );
sqlite> rollback to savepoint a;
sqlite> select * from t;
1
sqlite> rollback;
sqlite>
sqlite> begin;
sqlite> create table t( a );
Error: table t already exists
sqlite> insert into t values( 1 );
Error: no such table: t
sqlite>

Can anybody else reproduce this?

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


Re: [sqlite] SQL script help.

2010-08-27 Thread Black, Michael (IS)
What language are you writing in?  Why do you need to know the # of rows?  What 
are you doing with that information?
 
The select itself does stop (obviously).  
 
>From  a Windows command prompt you can just do this
 
echo SELECT * FROM myTable WHERE _rowid_ >= 100 AND _rowid_ <= 102 | sqlite3 
mytable.db

And then you can redirect the output wherever hyou want.
 
Just add quotes around the select statement for Unix.
 
 
Michael D. Black
Senior Scientist
Advanced Analytics Directorate
Northrop Grumman Information Systems
 



From: sqlite-users-boun...@sqlite.org on behalf of Kirk Clemons
Sent: Thu 8/26/2010 1:01 PM
To: 'General Discussion of SQLite Database'
Subject: EXTERNAL:Re: [sqlite] SQL script help.



I would like to be able to create an output log of each row. But I need to know 
how many rows there are in the database unless there is a way to tell sqlite to 
stop at the end?

-Original Message-
From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] 
On Behalf Of Israel Lins Albuquerque
Sent: Thursday, August 26, 2010 10:58 AM
To: General Discussion of SQLite Database
Subject: Re: [sqlite] SQL script help.

Or you can do:
SELECT * FROM myTable WHERE _rowid_ IN (100, 101, 102)

depending what you want


- "Simon Slavin"  escreveu:
>
> On 26 Aug 2010, at 3:39pm, Kirk Clemons wrote:
>
> > SELECT * FROM myTable WHERE _rowid_ = 100; SELECT * FROM myTable WHERE 
> > _rowid_ = 101; SELECT * FROM myTable WHERE _rowid_ = 102;
>
> SELECT * FROM myTable WHERE _rowid_ BETWEEN 100 AND 102
>
> or
>
> SELECT * FROM myTable WHERE _rowid_ >= 100 AND _rowid_ <= 102
>
> will give identical results. Technically speaking you might want to add 
> 'ORDER BY _rowid_' to the end of those if the order matters.
>
> Simon.
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>

--

Atenciosamente/Regards,

Israel Lins Albuquerque
Desenvolvimento/Development
Polibrás Brasil Software Ltda.


___
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


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


Re: [sqlite] upstreaming Chromium patches for file handle passing support

2010-08-27 Thread Richard Hipp
On Thu, Aug 26, 2010 at 6:02 PM, Paweł Hajdan, Jr.
wrote:

> Please take a look at chromium_sqlite3 functions in
>
> http://src.chromium.org/viewvc/chrome/trunk/src/third_party/sqlite/src/src/os_unix.c?view=markup
>
> They are needed because in Chrome the browser process will pass a file
> descriptor to the child renderer process instead of a file path. Here's the
> code that handles it on the renderer side:
>
> http://trac.webkit.org/browser/trunk/WebCore/platform/sql/chromium/SQLiteFileSystemChromiumPosix.cpp
>
> Currently those chromium_sqlite3 functions live in patched os_unix.c file
> because they access slite internals that are only visible in os_unix.c.
>
> Could you suggest a way to do the same thing in a way that wouldn't require
> custom patches on the Chromium project side? If we can get a similar
> interface exposed in sqlite that'd be great. Another possible solution
> would
> be to allow those chromium_sqlite3 functions to be implemented outside of
> os_unix.c file (that will probably require exposing more internals from
> that
> file).
>

The VFS interface is published, stable, and documented.  I think the VFS is
the interface you should be using.

You do not have to patch os_unix.c.  Leave it unchanged.  Instead, create
your own os_chromium.c based off of your patched os_unix.c (changing just a
few identifiers to avoid conflicts) and link it with your process as a
separate file.  (You really should be using the SQLite amalgamation file
sqlite3.c - not separate source files - since the amalgamation runs about 5%
or 10% faster due to better compiler optimizations.)  At start-time, simply
call sqlite3_vfs_register() to register your customized VFS with SQLite.
Then use sqlite3_open_v2() to specify your custom VFS implementation.  Or
make your custom VFS implementation the default when you register it.

Another option is for you to append your custom routines to the end of
sqlite3.c.

cat sqlite3.c chromium_vfs.c >chromium_sqlite3.c

That why, you custom routine will have access to all of the SQLite
internals.  Of course, those internals will change from time to time.  We do
not gratuitously change things, but every not and then we do refactor
interfaces to add new features or to make them more efficient.  So the
custom code you append would need to track those changes.

If we were to expose the interfaces that you are using, that means we would
have to lock them down and support them forever.  That would preclude many
future enhancements and is something we are very reluctant to do.



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



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


Re: [sqlite] SQL script help.

2010-08-27 Thread Denis Gomes
Kirk,

 You can use the aggregate function count.  So if  you have a table
called foo, do this,

SELECT COUNT(*) FROM foo;

That'll give you the number of rows in the table.

Denis

On Fri, Aug 27, 2010 at 6:30 AM, Paul Corke wrote:

> On 26 August 2010 19:02, Kirk Clemons wrote:
>
> > I would like to be able to create an output log of each row. But I
> > need to know how many rows there are in the database unless there is
> > a way to tell sqlite to stop at the end?
>
> Do you just want:
>
> SELECT * FROM myTable
>
> which will return every row and stop at the end.
>
> Paul.
> ___
>  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] SQL script help.

2010-08-27 Thread Paul Corke
On 26 August 2010 19:02, Kirk Clemons wrote:

> I would like to be able to create an output log of each row. But I
> need to know how many rows there are in the database unless there is
> a way to tell sqlite to stop at the end?  

Do you just want:

SELECT * FROM myTable

which will return every row and stop at the end.

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


Re: [sqlite] SQL script help.

2010-08-27 Thread Kirk Clemons
I would like to be able to create an output log of each row. But I need to know 
how many rows there are in the database unless there is a way to tell sqlite to 
stop at the end?

-Original Message-
From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] 
On Behalf Of Israel Lins Albuquerque
Sent: Thursday, August 26, 2010 10:58 AM
To: General Discussion of SQLite Database
Subject: Re: [sqlite] SQL script help.

Or you can do: 
SELECT * FROM myTable WHERE _rowid_ IN (100, 101, 102) 

depending what you want 


- "Simon Slavin"  escreveu: 
> 
> On 26 Aug 2010, at 3:39pm, Kirk Clemons wrote: 
> 
> > SELECT * FROM myTable WHERE _rowid_ = 100; SELECT * FROM myTable WHERE 
> > _rowid_ = 101; SELECT * FROM myTable WHERE _rowid_ = 102; 
> 
> SELECT * FROM myTable WHERE _rowid_ BETWEEN 100 AND 102 
> 
> or 
> 
> SELECT * FROM myTable WHERE _rowid_ >= 100 AND _rowid_ <= 102 
> 
> will give identical results. Technically speaking you might want to add 
> 'ORDER BY _rowid_' to the end of those if the order matters. 
> 
> Simon. 
> ___ 
> sqlite-users mailing list 
> sqlite-users@sqlite.org 
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users 
> 

-- 

Atenciosamente/Regards, 

Israel Lins Albuquerque 
Desenvolvimento/Development 
Polibrás Brasil Software Ltda. 


___
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] SQL script help.

2010-08-27 Thread Kirk Clemons
Thank you,
So how do I get the total count of rows?
-Original Message-
From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] 
On Behalf Of Simon Slavin
Sent: Thursday, August 26, 2010 8:59 AM
To: General Discussion of SQLite Database
Subject: Re: [sqlite] SQL script help.


On 26 Aug 2010, at 3:39pm, Kirk Clemons wrote:

> SELECT * FROM myTable WHERE _rowid_ = 100; SELECT * FROM myTable WHERE 
> _rowid_ = 101; SELECT * FROM myTable WHERE _rowid_ = 102;

SELECT * FROM myTable WHERE _rowid_ BETWEEN 100 AND 102

or

SELECT * FROM myTable WHERE _rowid_ >= 100 AND _rowid_ <= 102

will give identical results.  Technically speaking you might want to add 'ORDER 
BY _rowid_' to the end of those if the order matters.

Simon.
___
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