Re: [sqlite] Problems using AUTOINCREMENT row IDs in indexes

2009-02-11 Thread Hugh Gibson
> I've banged on about this problem and thanks to your assistance it > seems > to be resolved now. Perhaps you could update the documentation at > http://www.sqlite.org/autoinc.html and > http://www.sqlite.org/lang_createindex.html - I had certainly read > these many times so a note about

Re: [sqlite] Problems using AUTOINCREMENT row IDs in indexes

2008-11-20 Thread Hugh Gibson
> > > Any comments on this - Richard or Dan? > > > > The INTEGER PRIMARY KEY is always included in every index as an > > implied extra column on the end. If you explicitly add the > > INTEGER PRIMARY KEY as a column in the index, then you have it > > in the index twice, which serves no

Re: [sqlite] Problems using AUTOINCREMENT row IDs in indexes

2008-11-20 Thread Hugh Gibson
> > Any comments on this - Richard or Dan? > > The INTEGER PRIMARY KEY is always included in every index as an > implied extra column on the end. If you explicitly add the INTEGER > PRIMARY KEY as a column in the index, then you have it in the > index twice, which serves no purpose I

Re: [sqlite] Problems using AUTOINCREMENT row IDs in indexes

2008-11-20 Thread Hugh Gibson
timescale for fixing the bug? > > I will have to bypass the AUTOINCREMENT functionality and create my > own IDs. That creates more complications. > > Hugh > > > *Subject:* Problems using AUTOINCREMENT row IDs in indexes > > *From:* "Hugh Gibson" <[EMAI

Re: [sqlite] Dropping and creating indexes

2008-11-20 Thread Hugh Gibson
> > According to Igor all that happens when you create a primary > > key is that an index with the unique constraint is created. And > > the only good reason for not being able to drop it, as far as I > > can tell, is so that the SQL statement stored for the table is not > > made invalid. > >

Re: [sqlite] Dropping and creating indexes

2008-11-19 Thread Hugh Gibson
> > SQLite will complain because of the duplicate index names, but in > > other database packages it will be accepted. You then have to > > specify the table name when deleting indexes. > > The only database I'm aware of that does this is SQL Server. > Don't overgeneralize. :) No worries - I

Re: [sqlite] Dropping and creating indexes

2008-11-18 Thread Hugh Gibson
> An index is actually indeed associated with a table, and within that > table with one or more columns. > > Hence, dropping an index doesn't require a table name. I can easily write SQL like this: CREATE TABLE First (nID, nValue) CREATE INDEX idxID ON First (nID) CREATE TABLE Second (nID,

Re: [sqlite] Recommended method of atomically inserting if data is not present

2008-11-18 Thread Hugh Gibson
> Clients can be referred to by one or more names and so there's > another table: > > CREATE TABLE client_names ( > id integer, > name text > ); > > Names aren't unique. Two clients can have the same name. But the combination of id and name are unique: hence try this: CREATE TABLE

Re: [sqlite] Dropping and creating indexes

2008-11-18 Thread Hugh Gibson
> > I note that SQLite prevents creation of indexes with the same > > name, regardless of table. > > Quite. So it's unclear why you would want to be able to mention > table name in the DROP INDEX statement. Fair enough! It does seem strange when an index is associated with a single table to

[sqlite] Dropping and creating indexes

2008-11-17 Thread Hugh Gibson
We implement automatic instructions to upgrade a database schema. These include modifying field values and adding/dropping fields, tables, indexes etc. I see from the syntax of DROP INDEX that a table name is not specified. Are there any plans for adding a way of specifying the table? There are

Re: [sqlite] INTEGER PRIMARY KEY and triggers

2008-11-17 Thread Hugh Gibson
> I am addicted to using INTEGER PRIMARY KEY AUTOINCREMENT as the id > fields in my SQLite projects, yet I would like to try some triggers > as well. Of course, every time I add a trigger that accesses a > table with these types of id fields, all sorts of odd things > happen. Not to

Re: [sqlite] Problems using AUTOINCREMENT row IDs in indexes

2008-11-14 Thread Hugh Gibson
and create my own IDs. That creates more complications. Hugh > *Subject:* Problems using AUTOINCREMENT row IDs in indexes > *From:* "Hugh Gibson" <[EMAIL PROTECTED]> > *To:* sqlite-users@sqlite.org > *CC:* [EMAIL PROTECTED] > *Date:* Thu, 13 Nov 2008 14:56 +00

[sqlite] Problems using AUTOINCREMENT row IDs in indexes

2008-11-13 Thread Hugh Gibson
I'm having problems getting good index choice in SQLite 3.6.4 for a field which is INTEGER PRIMARY KEY AUTOINCREMENT. I've got the following table: CREATE TABLE Signals (sSignalID Text DEFAULT '',sText Text DEFAULT '',sTime Text DEFAULT '',sUserID Text DEFAULT '',nRowID INTEGER PRIMARY KEY

Re: [sqlite] SQL query, finding out which row a result is in

2007-04-23 Thread Hugh Gibson
> You could do this: > > SELECT COUNT(*) from X where memberid < 4567373 That assumes that you are sorting by memberid, of course... Hugh - To unsubscribe, send email to [EMAIL PROTECTED]

Re: [sqlite] SQL query, finding out which row a result is in

2007-04-23 Thread Hugh Gibson
> That is what I want to do. I want to know where the memberid is in > the list (imagine the list was a waiting list or something). Is there > not a way to just get the row number back? Is seems inefficient to > have to allocate all of the memory to hold all of the results and > then iterate

Re: [sqlite] SQLite Performance

2007-04-18 Thread Hugh Gibson
> SELECT * FROM tetragrams > WHERE word1 = 'x' AND word2||'' = 'y' > ORDER BY occs; Better as SELECT * FROM tetragrams WHERE word1 = 'x' AND +word2 = 'y' ORDER BY occs; See http://www.sqlite.org/optoverview.html section 6. Hugh

Re: [sqlite] What query should I use?

2007-04-05 Thread Hugh Gibson
> but of course there is an EXACT answer for my question - there are > selected only the rows when Text2 changes... How to get also always > the first row from original data set? Just UNION the result with a query that gets the first row from the table. Hugh

Re: [sqlite] Compress function

2006-07-19 Thread Hugh Gibson
You could try http://web.utk.edu/~jplyon/sqlite/code/sqaux-userfns.c but it's a little old now. Hugh

Re: [sqlite] accurate progress indication

2006-05-09 Thread Hugh Gibson
> I have had a look at the sqlite3_progress_handler() API function but > it appears that the problem is knowing how many opcodes are required > to complete the transaction before it is run. So do this: set up sqlite3_progress_handler() with N = 1. Create a query to delete one record and count

Re: [sqlite] Rewriting a query

2005-09-29 Thread Hugh Gibson
> I'm intrigued. How do you get SQLite to use a multi-column index as it's > primary key (i.e. B-tree hash)? Please elaborate. Simply CREATE TABLE TransactionList (sTransactionID Text(13) DEFAULT '',sCommunityID Text(13) DEFAULT '',sObject Text(13) , PRIMARY KEY (sCommunityID,

Re: [sqlite] Rewriting a query

2005-09-28 Thread Hugh Gibson
> What happens if you create the index on sCommunityID only? Does > it still do the full table scan? A bit difficult to drop the (sCommunityID, sTransactionID) index, as it's the primary key. > Also, don't overlook using UNION or UNION ALL, ugly as they > can be. Maybe something like this

Re: [sqlite] Rewriting a query

2005-09-28 Thread Hugh Gibson
The following works for me. The Community table has only one entry per community ID so it's fast to look up. SELECT sCommunityID, (SELECT sTransactionID FROM TransactionList WHERE sCommunityID = Community.sCommunityID

[sqlite] Rewriting a query

2005-09-28 Thread Hugh Gibson
I have this query: SELECT sCommunityID, max(sTransactionID) FROM TransactionList WHERE sCommunityID in ('a03061bFi','a03064KDy', 'a03068QhK') GROUP BY sCommunityID There is an index on (sCommunityID, sTransactionID) This forces a table scan (perhaps improved

Re: [sqlite] Assertion failure in btree.c, line 1166

2005-09-27 Thread Hugh Gibson
t; *To:* [EMAIL PROTECTED] > *Date:* Tue, 27 Sep 2005 06:37:44 -0400 > > On Mon, 2005-09-26 at 12:03 +0100, Hugh Gibson wrote: > > Hi, > > > > Using PySQLite 2.0.4 I get a crash with the following sequence, > > starting from no database. If the page_size pragma

[sqlite] Assertion failure in btree.c, line 1166

2005-09-26 Thread Hugh Gibson
Assertion failed: n==4-4*pPage->leaf, file btree.c, line 601 Assertion failed: pPage->leaf==0 || pPage->leaf==1, file btree.c, line 599 Hugh Gibson

Re: [sqlite] operational errors on insert with Python

2005-06-23 Thread Hugh Gibson
> The error returned is OperationalError: near ".", syntax error. Probably because you need to enclose the version strings in single quotes. > OperationalError: no such column: finally Use single quotes around values in the SQL. Contents of double quotes are interpreted as field names. Hugh

RE: [sqlite] ANN: Sqlite3Explorer.exe version 1.6

2005-06-22 Thread Hugh Gibson
riginal Message- > > From: Hugh Gibson [mailto:[EMAIL PROTECTED] > > Sent: Wednesday, June 22, 2005 4:22 PM > > To: sqlite-users@sqlite.org > > Subject: Re: [sqlite] ANN: Sqlite3Explorer.exe version 1.6 > > > > Just got a crash when viewing table data using SQLite

Re: [sqlite] ANN: Sqlite3Explorer.exe version 1.6

2005-06-22 Thread Hugh Gibson
Just got a crash when viewing table data using SQLite3Explorer version 1.6: --- sqlite3explorer --- Access violation at address 00402E29 in module 'sqlite3Explorer.exe'. Write of address 01357AAE. --- OK

Re: [sqlite] ANN: Sqlite3Explorer.exe version 1.6

2005-06-16 Thread Hugh Gibson
> I have uploaded v 1.6 of sqlite3Explorer (www.singular.gr/sqlite). Thanks! The download page has 16/03/2005 against version 1.6 - should be 16/6/2005. Hugh

Re: [sqlite] Problems with SQLite3Explorer

2005-05-24 Thread Hugh Gibson
> A few problems with SQLite3Explorer 1.5: Further to these, I've found that viewing of text data in the grid is limited to 255 characters. Is it possible to make the default a lot bigger or have a way of "zooming" a field to get the final value. Hugh

Re: [sqlite] updating records problem

2005-05-19 Thread Hugh Gibson
> > Myself, I'm not a big fan of high-level abstraction from the sql > > being performed, so I wouldn't use the originally posted idea of > > editing a recordset. > > I don't tend to use it either. But some people like to do things that > way and I'd like to make it as easy as possible for

Re: [sqlite] speedtest result is obsolete

2005-02-07 Thread Hugh Gibson
I would be interested to know the results for very large data sets. Indications on the list have been that performance suffers when the number of records gets very big (> 1 million), possibly due to using an internal sort. Hugh

Re: [sqlite] Any way of using an implicit BTree ordering in SQLite?

2004-12-15 Thread Hugh Gibson
> You might search the list archive and also try a > Google search on 'celko nested set' and 'adjacency > list' -- or even just 'sql tree'. Try also http://www.dbazine.com/tropashko4.shtml Hugh

Re: [sqlite] Performance problem

2004-03-22 Thread Hugh Gibson
> SQLite only uses a single index per table on any give query. > This is unlikely to change. Would it be able to use a multi-column query on ipnode + author? Hugh > Shi Elektronische Medien GmbH, Peter Spiske wrote: > > > > the following simple query is very slow: > > SELECT title FROM t1