Re: [sqlite] Is it possible to call sqlite_exec() from within the callback made inside sqlite_exec()

2006-09-16 Thread drh
Kevin Stewart <[EMAIL PROTECTED]> wrote:
> I am still curious. Generally speaking, can one access
> the database inside the callback from select via sqlite_exec()?
> 

Yes.  SQLite is reentrant.

SQLite uses this reentrancy internally.  There are occasions
when you are running an SQL statement that SQLite while invoke
sqlite3_exec() as part of the processing for that SQL statement.
This happens, for example, when you are running an ALTER TABLE
or a CREATE TABLE command.

--
D. Richard Hipp   <[EMAIL PROTECTED]>


-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] Is it possible to call sqlite_exec() from within the callback made inside sqlite_exec()

2006-09-16 Thread Jay Sprenkle

On 9/15/06, Kevin Stewart <[EMAIL PROTECTED]> wrote:

Well, its a little more complicated than that. I don't want the whole
table, just the set of records that matched the initial search criteria
in the select. But thanks for your response. I did a little redesigning


Add a where clause to the select statement that is the source for the
insert.


of the database schema and the way my code handles things and I came up
with a better solution anyway. Maybe I shouldn't have jumped the gun and
submitted this questionhowever I am still curious. Generally
speaking, can one access the database inside the callback from select
via sqlite_exec()?


I believe not.

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] Is it possible to call sqlite_exec() from within the callback made inside sqlite_exec()

2006-09-15 Thread Kevin Stewart
Well, its a little more complicated than that. I don't want the whole 
table, just the set of records that matched the initial search criteria 
in the select. But thanks for your response. I did a little redesigning 
of the database schema and the way my code handles things and I came up 
with a better solution anyway. Maybe I shouldn't have jumped the gun and 
submitted this questionhowever I am still curious. Generally 
speaking, can one access the database inside the callback from select 
via sqlite_exec()?


Kevin

Jay Sprenkle wrote:

that's the hard way:
open db1
attach db2
insert into db2.destinationTable  select * from db1.sourceTable

done


On 9/15/06, Kevin Stewart <[EMAIL PROTECTED]> wrote:

I need to move some records from one database (and table) to another.
The tables are identical. My idea was to 'select' all records that match
my search criteria and in the callback that is called from sqlite_exec()
I can add them to the other table in the other database. This way I
don't need to save the records away or anything like thatjust sort
of a direct copy. After the select completes I can then execute a
'DELETE' on the same set of records using the same search criteria.

Thanks in advance for any help.

Kevin

- 


To unsubscribe, send email to [EMAIL PROTECTED]
- 









-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] Is it possible to call sqlite_exec() from within the callback made inside sqlite_exec()

2006-09-15 Thread Jay Sprenkle

that's the hard way:
open db1
attach db2
insert into db2.destinationTable  select * from db1.sourceTable

done


On 9/15/06, Kevin Stewart <[EMAIL PROTECTED]> wrote:

I need to move some records from one database (and table) to another.
The tables are identical. My idea was to 'select' all records that match
my search criteria and in the callback that is called from sqlite_exec()
I can add them to the other table in the other database. This way I
don't need to save the records away or anything like thatjust sort
of a direct copy. After the select completes I can then execute a
'DELETE' on the same set of records using the same search criteria.

Thanks in advance for any help.

Kevin

-
To unsubscribe, send email to [EMAIL PROTECTED]
-





--
--
SqliteImporter and SqliteReplicator: Command line utilities for Sqlite
http://www.reddawn.net/~jsprenkl/Sqlite

Cthulhu Bucks!
http://www.cthulhubucks.com

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



[sqlite] Is it possible to call sqlite_exec() from within the callback made inside sqlite_exec()

2006-09-15 Thread Kevin Stewart
I need to move some records from one database (and table) to another. 
The tables are identical. My idea was to 'select' all records that match 
my search criteria and in the callback that is called from sqlite_exec() 
I can add them to the other table in the other database. This way I 
don't need to save the records away or anything like thatjust sort 
of a direct copy. After the select completes I can then execute a 
'DELETE' on the same set of records using the same search criteria.


Thanks in advance for any help.

Kevin

-
To unsubscribe, send email to [EMAIL PROTECTED]
-