Jimmy Pritts | 1 Jun 11:02 2003
Picon

multiple sqlite structures

Hi,

I have a program that has 3 sqlite structures open at one time.
I am not multithreading.  In do the following the in this order...

1. Open sqlite structure 1
2. Create 2 tables with sqlite structure 1
3. Open sqlite structure 2
4. Create 1 table with sqlite structure 2
5. Open sqlite structure 3
6. Create 1 table with sqlite structure 3
**7. Insert 1 row into a table created with sqlite structure 1

Step 7 is where sqlite returns the error:
"database schema has changed"

I compiled sqlite with the preprocessor macro THREADSAFE=1 just to 
be sure that was not the problem.  Am I doing something not allowed?

Thanks in advance,
  Jimmy.

------------------------ Yahoo! Groups Sponsor ---------------------~-->
Get A Free Psychic Reading! Your Online Answer To Life's Important Questions.
http://us.click.yahoo.com/Lj3uPC/Me7FAA/ySSFAA/EbFolB/TM
---------------------------------------------------------------------~->

To unsubscribe from this group, send an email to:
sqlite-unsubscribe@...

(Continue reading)

D. Richard Hipp | 1 Jun 19:58 2003

Re: multiple sqlite structures

Jimmy Pritts wrote:
> Hi,
> 
> I have a program that has 3 sqlite structures open at one time.
> I am not multithreading.  In do the following the in this order...
> 
> 1. Open sqlite structure 1
> 2. Create 2 tables with sqlite structure 1
> 3. Open sqlite structure 2
> 4. Create 1 table with sqlite structure 2
> 5. Open sqlite structure 3
> 6. Create 1 table with sqlite structure 3
> **7. Insert 1 row into a table created with sqlite structure 1
> 
> Step 7 is where sqlite returns the error:
> "database schema has changed"
> 
> I compiled sqlite with the preprocessor macro THREADSAFE=1 just to 
> be sure that was not the problem.  Am I doing something not allowed?
> 

This has nothing to do with threadsafety.  When you have an SQLite
database open and some other process (or another connection to the
same database within the same process) changes the schema for the
database, the first time you try to access the database you will
get a return code of SQLITE_SCHEMA.  All this means is that SQLite
needs to reread the schema (because it has changed) which it will
do automatically the next time you call sqlite_exec().

--

-- 
(Continue reading)

Jimmy Pritts | 1 Jun 14:34 2003
Picon

Re: multiple sqlite structures

"D. Richard Hipp" <drh@...> writes:

> Jimmy Pritts wrote:
> > Hi,
> > 
> > I have a program that has 3 sqlite structures open at one time.
> > I am not multithreading.  In do the following the in this order...
> > 
> > 1. Open sqlite structure 1
> > 2. Create 2 tables with sqlite structure 1
> > 3. Open sqlite structure 2
> > 4. Create 1 table with sqlite structure 2
> > 5. Open sqlite structure 3
> > 6. Create 1 table with sqlite structure 3
> > **7. Insert 1 row into a table created with sqlite structure 1
> > 
> > Step 7 is where sqlite returns the error:
> > "database schema has changed"
> > 
> > I compiled sqlite with the preprocessor macro THREADSAFE=1 just to 
> > be sure that was not the problem.  Am I doing something not allowed?
> > 
> 
> This has nothing to do with threadsafety.  When you have an SQLite
> database open and some other process (or another connection to the
> same database within the same process) changes the schema for the
> database, the first time you try to access the database you will
> get a return code of SQLITE_SCHEMA.  All this means is that SQLite
> needs to reread the schema (because it has changed) which it will
> do automatically the next time you call sqlite_exec().
(Continue reading)

Jimmy Pritts | 1 Jun 14:46 2003
Picon

Re: multiple sqlite structures

Jimmy Pritts <jpritts@...> writes:

> "D. Richard Hipp" <drh@...> writes:
> 
> > Jimmy Pritts wrote:
> > > Hi,
> > > 
> > > I have a program that has 3 sqlite structures open at one time.
> > > I am not multithreading.  In do the following the in this order...
> > > 
> > > 1. Open sqlite structure 1
> > > 2. Create 2 tables with sqlite structure 1
> > > 3. Open sqlite structure 2
> > > 4. Create 1 table with sqlite structure 2
> > > 5. Open sqlite structure 3
> > > 6. Create 1 table with sqlite structure 3
> > > **7. Insert 1 row into a table created with sqlite structure 1
> > > 
> > > Step 7 is where sqlite returns the error:
> > > "database schema has changed"
> > > 
> > > I compiled sqlite with the preprocessor macro THREADSAFE=1 just to 
> > > be sure that was not the problem.  Am I doing something not allowed?
> > > 
> > 
> > This has nothing to do with threadsafety.  When you have an SQLite
> > database open and some other process (or another connection to the
> > same database within the same process) changes the schema for the
> > database, the first time you try to access the database you will
> > get a return code of SQLITE_SCHEMA.  All this means is that SQLite
(Continue reading)

D. Richard Hipp | 1 Jun 22:12 2003

Re: multiple sqlite structures

Jimmy Pritts wrote:
> 
> I did a test to answer my own ?.  sqlite does perform the SQL statement in
> sqlite_exec despite returning the error code SQLITE_SCHEMA.  
> 

If you can reproduce this behavior, please let me know and give me
specific instructions on how you did it.  This is a bug that needs
to be fixed.

--

-- 
D. Richard Hipp -- drh@... -- 704.948.4565

------------------------ Yahoo! Groups Sponsor ---------------------~-->
Get A Free Psychic Reading! Your Online Answer To Life's Important Questions.
http://us.click.yahoo.com/Lj3uPC/Me7FAA/ySSFAA/EbFolB/TM
---------------------------------------------------------------------~->

To unsubscribe from this group, send an email to:
sqlite-unsubscribe@...

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 

Jimmy Pritts | 2 Jun 07:15 2003
Picon

Re: multiple sqlite structures

"D. Richard Hipp" <drh@...> writes:

> Jimmy Pritts wrote:
> > 
> > I did a test to answer my own ?.  sqlite does perform the SQL statement in
> > sqlite_exec despite returning the error code SQLITE_SCHEMA.  
> > 
> 
> If you can reproduce this behavior, please let me know and give me
> specific instructions on how you did it.  This is a bug that needs
> to be fixed.
> 
> -- 
> D. Richard Hipp -- drh@... -- 704.948.4565
> 

Sorry to spread the misinformation.  After double checking, if
sqlite_exec returns SQLITE_SCHEMA, the SQL statement is not
executed.  sqlite_exec would have to be run again for the intended
result.  

Regards,
  Jimmy.  

------------------------ Yahoo! Groups Sponsor ---------------------~-->
Get A Free Psychic Reading! Your Online Answer To Life's Important Questions.
http://us.click.yahoo.com/Lj3uPC/Me7FAA/ySSFAA/EbFolB/TM
---------------------------------------------------------------------~->

To unsubscribe from this group, send an email to:
(Continue reading)

D. Richard Hipp | 1 Jun 22:06 2003

Re: multiple sqlite structures

Jimmy Pritts wrote:
 >
 > [S]hould [I] test for SQLITE_SCHEMA, and call sqlite_exec exactly the same as
 > the first time to insert the row.
 >

Yes.

I suppose I really should fix this someday so that sqlite_exec automatically
runs itself again instead of returning SQLITE_SCHEMA...

--

-- 
D. Richard Hipp -- drh@... -- 704.948.4565

------------------------ Yahoo! Groups Sponsor ---------------------~-->
Get A Free Psychic Reading! Your Online Answer To Life's Important Questions.
http://us.click.yahoo.com/Lj3uPC/Me7FAA/ySSFAA/EbFolB/TM
---------------------------------------------------------------------~->

To unsubscribe from this group, send an email to:
sqlite-unsubscribe@...

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 


Gmane