Re: [sqlite] Sqlite crash in two lines...

2007-08-15 Thread Christopher J. McKenzie
Ok great - I guess I need to check for upgrades more often. And as for what I was doing - well I have a program that generates queries (not very well it appears) and it would occasionally crash - when I tracked the bug down I was able to simplify it to two lines. Samuel R. Neff wrote: I

RE: [sqlite] why doesn't this work? (fts rowids)

2007-08-15 Thread Samuel R. Neff
With FTS3 can you specify the rowid to use in SQL or is it always automatic? It seems like most commonly you'd want the FTS data to match up with a real table using the same key and not have to store the FTS key in a separate table. Ideally I'd want to be able to include a single foreign key

Re: [sqlite] Sqlite crash in two lines...

2007-08-15 Thread Christopher J. McKenzie
I was using sqlite3.exe on windows xp when I discovered it. Then, for confirmation, I ran the same set of commands on the same version of sqlite3 (a version I think I compiled) on a linux machine and got the same thing. Then, for further confirmation, I *also* ran it on a FreeBSD machine

[sqlite] Sqlite crash in two lines...

2007-08-15 Thread Christopher J. McKenzie
Try this: $ sqlite3 SQLite version 3.4.0 Enter ".help" for instructions sqlite> create table test (field text); sqlite> select * from test group by distinct field; Segmentation fault $ oops... Any idea? ~chris. - To

Re: [sqlite] why doesn't this work? (fts rowids)

2007-08-15 Thread Scott Hess
At this time I do not plan to provide a way to distinguish "INTEGER PRIMARY KEY AUTOINCREMENT" and "INTEGER PRIMARY KEY" for fts3. fts is in the business of doing a fulltext index, not enforcing constraints! If you require that level of operation, the appropriate solution would be to have a

Re: [sqlite] why doesn't this work? (fts rowids)

2007-08-15 Thread Joe Wilson
--- Adam Megacz <[EMAIL PROTECTED]> wrote: > Hello, I need to create a perpetually-unique column in an FTS2 table. > For example: > > create virtual table t using fts2(c); > insert into t (c) values ('a'); > select rowid,c from t; > 1|a > delete from t; > insert into t (c) values

[sqlite] why doesn't this work? (fts rowids)

2007-08-15 Thread Adam Megacz
Hello, I need to create a perpetually-unique column in an FTS2 table. For example: create virtual table t using fts2(c); insert into t (c) values ('a'); select rowid,c from t; 1|a delete from t; insert into t (c) values ('b'); select rowid,c from t; 1|b How can I get the last

RE: [sqlite] SQLITE_BUSY error in multi-threaded environment

2007-08-15 Thread Ken
If you have only one thread accessing the file. Then you shouldn't need to do any type of locking per se. I would leave the file locks. I would not induce your own mutex. Sqlites locking should be adequate. I have a system where there are two threads sharing a single db and each thread

RE: [sqlite] SQLITE_BUSY error in multi-threaded environment

2007-08-15 Thread Mark Brown
No, not a soft link. :) Based on other posts I have read about threading performance and SQLite, it seems like most people like to use a single thread. I'm going to change our application to use a system-wide mutex for thread synchronization and see if that improves our results. I'm still

[sqlite] Re: INDEXES and PRIMARY KEY

2007-08-15 Thread Igor Tandetnik
Igor Mironchick <[EMAIL PROTECTED]> wrote: Can anybody explain me for what PRIMARY KEY needed? PRIMARY KEY is roughly equivalent to UNIQUE NOT NULL. That is, you get an index on this column, the database enforces that no two rows have the same value, and doesn't allow NULLs in this column.

Re: [sqlite] PRAGMA writable_schema=ON;

2007-08-15 Thread Joe Wilson
--- Scott Hess <[EMAIL PROTECTED]> wrote: > On 8/15/07, Joe Wilson <[EMAIL PROTECTED]> wrote: > > If you find a way to get sqlite3 to re-parse the schema after your direct > > sqlite_master change, please post it to the list. I don't think it can > > be done without modifying the code or making a

[sqlite] INDEXES and PRIMARY KEY

2007-08-15 Thread Igor Mironchick
Hi, guys. Can anybody explain me for what PRIMARY KEY needed? For example, is there some pluses using PRIMARY KEY insted of a simple INTEGER column (when I connect two tables by values of this column in SELECT queries)? And is PRIMARY KEY auto increment his value when inserting new value in

Re: [sqlite] ALTER TABLE and INTEGER PRIMARY KEY.

2007-08-15 Thread Scott Hess
I'd love to do fts2_1, because it implies fts1_1, but, really, 2_1 implies that the data would be backward-compatible, and maybe there's just a new feature exposed or something. -scott On 8/14/07, Samuel R. Neff <[EMAIL PROTECTED]> wrote: > > +1 for fts3 or fts2_1 :-) > >

Re: [sqlite] Help with performance...

2007-08-15 Thread Ken
Joe, each of the tables involved also had a parent table. that was also being copied. It turned out that the parent table copy (insert .. select) was taking over 50% of the time. So I flattened the tables including the neccessary fields into the children tables. This doubled the throughput

RE: [sqlite] SQLITE_BUSY error in multi-threaded environment

2007-08-15 Thread Ken
It should not. As long as those two connections are not used across threads and point to truely different databases. They wouldn't be a soft link would they? I Mark Brown <[EMAIL PROTECTED]> wrote: Hi John- There is a .lock file for each database. From my understanding, that should

RE: [sqlite] SQLITE_BUSY error in multi-threaded environment

2007-08-15 Thread Joe Wilson
--- Mark Brown <[EMAIL PROTECTED]> wrote: > There is a .lock file for each database. From my understanding, that should > prohibit 2 connections from using the same database at the same time. > However, that is not the situation I am wondering about. I am specifically > wondering if database

Re: [sqlite] PRAGMA writable_schema=ON;

2007-08-15 Thread Scott Hess
On 8/15/07, Joe Wilson <[EMAIL PROTECTED]> wrote: > If you find a way to get sqlite3 to re-parse the schema after your direct > sqlite_master change, please post it to the list. I don't think it can > be done without modifying the code or making a new connection. You could probably manage it by

Re: [sqlite] random(*), randomblob(N), etc.

2007-08-15 Thread Shane Harrelson
Now thats a good idea! Thanks! On 8/15/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > "Shane Harrelson" <[EMAIL PROTECTED]> wrote: > > > > Other than the normal caveats for using customized versions of the > SQLite > > code, does this sound like it would work? > > > > Why not just write

Re: [sqlite] PRAGMA writable_schema=ON;

2007-08-15 Thread Joe Wilson
--- T <[EMAIL PROTECTED]> wrote: > > Even if you got the sqlite_master table entries right, the in- > > memory sqlite schema data structures would not be in sync. > > Yes, but my point/question was, would that not only apply to tables > and indexes? I expect that views and triggers have no

Re: [sqlite] Altering views, keeping triggers

2007-08-15 Thread T
Hi Joe, You've got the right idea. Just make use of sqlite_master.tbl_name. select sql || ';' from sqlite_master where type = 'trigger' and tbl_name = 'MyView'; sqlite_master.name is the name of the table/view/index/trigger itself, and sqlite_master.tbl_name is what it acts on. I

Re: [sqlite] PRAGMA writable_schema=ON;

2007-08-15 Thread T
Hi Joe, Even if you got the sqlite_master table entries right, the in- memory sqlite schema data structures would not be in sync. Yes, but my point/question was, would that not only apply to tables and indexes? I expect that views and triggers have no data structures (eg rootpage = 0) so

RE: [sqlite] SQLITE_BUSY error in multi-threaded environment

2007-08-15 Thread Mark Brown
Hi John- There is a .lock file for each database. From my understanding, that should prohibit 2 connections from using the same database at the same time. However, that is not the situation I am wondering about. I am specifically wondering if database activity on a connection to DB 1 would have

Re: [sqlite] random(*), randomblob(N), etc.

2007-08-15 Thread drh
"Shane Harrelson" <[EMAIL PROTECTED]> wrote: > > Other than the normal caveats for using customized versions of the SQLite > code, does this sound like it would work? > Why not just write your own version of random() and register it using sqlite3_create_function()? -- D. Richard Hipp <[EMAIL

Re: [sqlite] random(*), randomblob(N), etc.

2007-08-15 Thread Shane Harrelson
Thanks for the response. I'm not sure either will work since my random table can be created at many different points in my application. I looked at the source, and I think that if I expose the state structure ( prng) in randomByte (remove static and move it outside of the function), I can save

Re: [sqlite] random(*), randomblob(N), etc.

2007-08-15 Thread drh
"Shane Harrelson" <[EMAIL PROTECTED]> wrote: > I have a table that has the rows sorted by using a column which is filled > with values from random(*). > > Is there a PRAGMA or other API which allows me to set the "seed" used by > random(*) such that > I can reproduce the same random sequence each

[sqlite] random(*), randomblob(N), etc.

2007-08-15 Thread Shane Harrelson
I have a table that has the rows sorted by using a column which is filled with values from random(*). Is there a PRAGMA or other API which allows me to set the "seed" used by random(*) such that I can reproduce the same random sequence each time? Thanks. -Shane

Re: [sqlite] SQLITE_BUSY error in multi-threaded environment

2007-08-15 Thread John Stanton
My guess is that you will find your problem in the way file locking is implemented on your system. Is there a global file lock rather than locks associated with each file? A simple test program will resolve the issue. Mark Brown wrote: Hi Andre- After rereading your post, I wanted to

RE: [sqlite] SQLITE_BUSY error in multi-threaded environment

2007-08-15 Thread Mark Brown
Hi Andre- After rereading your post, I wanted to confirm something. In your example below, are thread1 and thread2 connected to the same database, or different databases? In my scenario, the threads are connected to different databases, so I'm not sure if it is the same situation. Thanks, Mark

Re: [sqlite] Problem loading extension in Delphi (FTS2)

2007-08-15 Thread Joe Wilson
--- Ralf Junker <[EMAIL PROTECTED]> wrote: > >Does it support external sqlite loadable extensions? > > Loadable extensions are currently omitted. FTS1 and FTS2 extensions are > provided as built-in > modules. User-aware collations sequences using the Windows sorting functions > are provided in

RE: [sqlite] SQLITE_BUSY error in multi-threaded environment

2007-08-15 Thread Mark Brown
Hi Andre- Thank you for your insight. Looks like we have some redesign scheduled for today. :) Thanks, Mark > -Original Message- > From: Andre du Plessis [mailto:[EMAIL PROTECTED] > Sent: Wednesday, August 15, 2007 5:05 AM > To: sqlite-users@sqlite.org > Subject: RE: [sqlite]

Re: [sqlite] PROBLEMS BUILDING 3.4.2 using Ms Visual Studio 2005

2007-08-15 Thread Andrew Finkenstadt
On 8/15/07, [EMAIL PROTECTED] <[EMAIL PROTECTED] > wrote: > > > > See http://www.sqlite.org/cvstrac/tktview?tn=2574 > > > > Apparently VC++ does not like for you to declare a constant > > with file scope before the constant is defined. I do not > > know how to work around this problem. Perhaps

Re: [sqlite] PRAGMA writable_schema=ON;

2007-08-15 Thread drh
T <[EMAIL PROTECTED]> wrote: > >> Now that is interesting. I didn't realize we could change > >> sqlite_master directly, but have often thought it could be very > >> handy. > > > > Warning: If you mess up, your database becomes unreadable and > > unrepairable. This is a very dangerous

Re: [sqlite] PROBLEMS BUILDING 3.4.2 using Ms Visual Studio 2005

2007-08-15 Thread BardzoTajneKonto
> See http://www.sqlite.org/cvstrac/tktview?tn=2574 > > Apparently VC++ does not like for you to declare a constant > with file scope before the constant is defined. I do not > know how to work around this problem. Perhaps someone who > better understands the quirks of VC++ can help. VC

Re: [sqlite] PRAGMA writable_schema=ON;

2007-08-15 Thread T
Now that is interesting. I didn't realize we could change sqlite_master directly, but have often thought it could be very handy. Warning: If you mess up, your database becomes unreadable and unrepairable. This is a very dangerous feature. If you use it and you lose data: no tears.

Re: [sqlite] PROBLEMS BUILDING 3.4.2 using Ms Visual Studio 2005

2007-08-15 Thread Dennis Volodomanov
Would it help if you didn't have the "const" in the declaration? (I haven't tried - just an idea...) Dennis [EMAIL PROTECTED] wrote: "Cariotoglou Mike" <[EMAIL PROTECTED]> wrote: I am having problems building 3.4.2 from the amalgamated source,using Microsoft Visual Studio 2005 (this

[sqlite] Static linking under Kylix Delphi

2007-08-15 Thread MaxGyver
I'm trying to develop a cross platform application (Wn32 / Linux). I use Borland (Codegear) developer tools - Borland Delphi & Kylix. I have already developed SQLite components with option to use SQLite dynamically (DLL) or statically (link OBJs to app). I would prefer static linking in my

Re: [sqlite] PROBLEMS BUILDING 3.4.2 using Ms Visual Studio 2005

2007-08-15 Thread drh
"Cariotoglou Mike" <[EMAIL PROTECTED]> wrote: > I am having problems building 3.4.2 from the amalgamated source,using > Microsoft Visual Studio 2005 > > (this is the first time I am trying to use > the amalgamated source). I get the following errors: > > Error 1 error C2133:

[sqlite] PROBLEMS BUILDING 3.4.2 using Ms Visual Studio 2005

2007-08-15 Thread Cariotoglou Mike
I am having problems building 3.4.2 from the amalgamated source,using Microsoft Visual Studio 2005 (this is the first time I am trying to use the amalgamated source). I get the following errors: Error 1 error C2133: 'sqlite3UpperToLower' : unknown size Error 37 error C2133:

Re: [sqlite] PRAGMA writable_schema=ON;

2007-08-15 Thread drh
T <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > > It appears that you can set > > > > PRAGMA writable_schema=ON; > > > > Then do a manual UPDATE of the sqlite_master table to insert > > > I tried it and it seems to work. But it is dangerous. If you mess > > up, you corrupt the

RE: [sqlite] SQLITE_BUSY error in multi-threaded environment

2007-08-15 Thread Andre du Plessis
Being a newbie to SQLite I've had the same problems working with SQLite so maybe I can help, It does not matter how well your database is synchronized, a common pitfall I had was that I would have a query object with an open cursor which prevents any other statement from committing to the

Re: [sqlite] Need help linking into Delphi Application

2007-08-15 Thread MaxGyver
John Elrick-2 wrote: > > I've been using the Delphi ASGSqlite components with static linking for > some time with version 3.3.13. I'd like to move on up to 3.4.0, > however, no one seems to have documented how to do this yet. > > I tried compiling the Amalgamation with Borland C++ 5.0 and

Re: [sqlite] [Delphi] Escaping quote?

2007-08-15 Thread MaxGyver
I'm not an expert on Aducom SQLite components, but anyway i'll try to help. Maybe you should consider using parameters in your query. Parameters in SQLite start with ':', '@' or '?', however ASGSQlite supports only ':' in my opinion. Your SQL query should look like this: INSERT INTO Stuff

Re: [sqlite] Problem loading extension in Delphi (FTS2)

2007-08-15 Thread Ralf Junker
Hello Joe Wilson, >Does it support external sqlite loadable extensions? Loadable extensions are currently omitted. FTS1 and FTS2 extensions are provided as built-in modules. User-aware collations sequences using the Windows sorting functions are provided in place of the ICU extension. Full

[sqlite] Unknown SQLITE_ERROR problem

2007-08-15 Thread Jiri Hajek
Hi, Rarely (I have 4 debug logs from all our beta testers) executing 'COMMIT' statement returns SQLITE_ERROR + 'SQL logic error or missing database'. Analysis of the debug logs and source codes doesn't show any problem, there simply begins a transaction, some SQL statements are executed and