Re: [sqlite] fast string prefix matching

2010-08-17 Thread Doug Reeder
On Aug 17, 2010, at 9:28 PM, Igor Tandetnik wrote: > Doug Reeder wrote: >> I need to search for string prefix matches; for example given the >> path 'PP', >> I need to find 'PPA', 'PPBJQ', and 'PPz'. (The character set is all >> characters greater than or equal to 'A', and is case-sensitive.)

Re: [sqlite] fast string prefix matching

2010-08-17 Thread Igor Tandetnik
Doug Reeder wrote: > I need to search for string prefix matches; for example given the path 'PP', > I need to find 'PPA', 'PPBJQ', and 'PPz'. (The character set is all > characters greater than or equal to 'A', and is case-sensitive.) A > statement that does exactly what I want is > > "UPDATE

[sqlite] fast string prefix matching

2010-08-17 Thread Doug Reeder
I need to search for string prefix matches; for example given the path 'PP', I need to find 'PPA', 'PPBJQ', and 'PPz'. (The character set is all characters greater than or equal to 'A', and is case-sensitive.) A statement that does exactly what I want is "UPDATE item SET hasChildren = EXISTS (S

Re: [sqlite] [PATCH] cache preloading

2010-08-17 Thread Scott Hess
On Mon, Aug 16, 2010 at 7:58 PM, Shawn Wilsher wrote: > On Mon, Aug 16, 2010 at 5:13 PM, Paweł Hajdan, Jr. > wrote: >> Is it something you'd like to include in SQLite? If so, does the patch need >> any adjustments before that's possible? > I'm slightly concerned about licensing here - do we know

Re: [sqlite] NOT NULL asymetry between CREATE TABLE and ALTER TABLE, why?

2010-08-17 Thread Nikolaus Rath
Michael Schlenker writes: > Hi all, > > Have a look at the following short sqlite shell session: > > SQLite version 3.6.4 > Enter ".help" for instructions > Enter SQL statements terminated with a ";" > sqlite> create table foo (a text(5) NOT NULL); > sqlite> alter table foo add column b text(5) NO

Re: [sqlite] NOT NULL asymetry between CREATE TABLE and ALTER TABLE, why?

2010-08-17 Thread Stephen Oberholtzer
The difference is that when you issue an ALTER TABLE, the table already exists. When you create a new table, it is known that there are no rows in it. But you can issue an ALTER TABLE to a table with rows in it. If so, what value should you put for the existing rows? Granted, in this specific ca

[sqlite] NOT NULL asymetry between CREATE TABLE and ALTER TABLE, why?

2010-08-17 Thread Michael Schlenker
Hi all, Have a look at the following short sqlite shell session: SQLite version 3.6.4 Enter ".help" for instructions Enter SQL statements terminated with a ";" sqlite> create table foo (a text(5) NOT NULL); sqlite> alter table foo add column b text(5) NOT NULL; SQL error: Cannot add a NOT NULL co

Re: [sqlite] Why the deadlock?

2010-08-17 Thread Nikolaus Rath
Dan Kennedy writes: > On Aug 17, 2010, at 1:48 AM, Nikolaus Rath wrote: > >> Hello, >> >> The script below fails with >> >> Deadlock detected when executing 'DELETE FROM foo WHERE id=2' >> >> What I think should be happening instead is this: >> >> - When executing statement 1, the main thread obta

Re: [sqlite] EXTERNAL: Record corruption on Mac OS X 10.6(SnowLeopard)

2010-08-17 Thread Dario Napolitano
Il 17/08/2010 14.06, Black, Michael (IS) ha scritto: > I'm not an objective C expert (or even amateur) -- but it looks to me like > your use inside the function call is not setting anything in the object but > appears to be a cast. > > So your old success would completely depend on the behavior

Re: [sqlite] EXTERNAL: Record corruption on Mac OS X 10.6(SnowLeopard)

2010-08-17 Thread Black, Michael (IS)
I'm not an objective C expert (or even amateur) -- but it looks to me like your use inside the function call is not setting anything in the object but appears to be a cast. So your old success would completely depend on the behavior of the memory allocator and garbage collector and how it reus

Re: [sqlite] EXTERNAL: Record corruption on Mac OS X 10.6 (Snow Leopard)

2010-08-17 Thread Dario Napolitano
Il 17/08/2010 11.21, Dan Kennedy ha scritto: >> I'm using SQLITE_STATIC since the memory buffer returned by >> cStringUsingEncoding should be valid until the object is deallocated, >> which doesn't happen until after the statement is executed. >> > You could try using SQLITE_TRANSIENT instead

Re: [sqlite] [PATCH] cache preloading

2010-08-17 Thread Shawn Wilsher
On Mon, Aug 16, 2010 at 5:13 PM, Paweł Hajdan, Jr. wrote: > Is it something you'd like to include in SQLite? If so, does the patch need > any adjustments before that's possible? I'm slightly concerned about licensing here - do we know what license this patch is? Can we get clarification from the

Re: [sqlite] Database.

2010-08-17 Thread Kirk Clemons
Thank you, Maybe I will just try to write a script to perform the selection. In answer to your question about '.bailing', this is a setting that can be turned on or off in the SQLite command line shell. It tells SQLite wether or not to terminate when an error is encountered. -Original Messag

Re: [sqlite] EXTERNAL: Record corruption on Mac OS X 10.6 (Snow Leopard)

2010-08-17 Thread Dan Kennedy
> I'm using SQLITE_STATIC since the memory buffer returned by > cStringUsingEncoding should be valid until the object is deallocated, > which doesn't happen until after the statement is executed. You could try using SQLITE_TRANSIENT instead to verify this. Or just go straight to valgrind. Good

Re: [sqlite] EXTERNAL: Record corruption on Mac OS X 10.6 (Snow Leopard)

2010-08-17 Thread Dario Napolitano
Il 16/08/2010 18.54, Black, Michael (IS) ha scritto: > Can you post your code? In particular the place where it fails and you retry? > > Here's the thread execution loop: - (void)main { [[NSThread currentThread] setName:@"WriteThread"]; while (![self isCancelled]) { DBObject

Re: [sqlite] Record corruption on Mac OS X 10.6 (Snow Leopard)

2010-08-17 Thread Dario Napolitano
Il 16/08/2010 18.52, Sam Roberts ha scritto: > On Mon, Aug 16, 2010 at 9:33 AM, Dario Napolitano > wrote: > >> Hello everyone. >> I have developed a conversion tool to generate a SQLite database from a >> MySQL one. The tool is a simple C Cocoa application in which I have >> statically compiled

Re: [sqlite] EXTERNAL: Record corruption on Mac OS X 10.6 (Snow Leopard)

2010-08-17 Thread Dario Napolitano
Il 16/08/2010 21.04, Simon Slavin ha scritto: > Where is the sqlite3_open command used ? Is it in the main thread or > the writing thread ? The main thread calls sqlite3_open, then registers a custom collation function and creates the tables. The connection handle is then passed to the worker thre