[sqlite] plans for completion of INSERT OR REPLACE INTO?

2009-07-05 Thread James Gregurich
a question for the sqlite developers.

The inability of "INSERT OR REPLACE" to maintain referential integrity  
leaves me with no mechanism to implement a feature in my project that  
I was intending to provide.  Are there any plans to add in the  
functionality for "INSERT OR REPLACE" to call delete triggers so that  
referential integrity can be maintained?

thanks,
James
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Re bind Statement

2009-07-05 Thread Dennis Cote
Indiff3rence wrote:
> My question is: why is necessary to reset the statement before I can rebind
> it?
> It should work only if I clear the old bind, no? 
>
>   
You need to reset the statement so that it can be executed again from 
the beginning (see section 3.0 of http://www.sqlite.org/cintro.html for 
more details).

You do not need to clear the old bindings if you are going to bind new 
values for each of the variables before you execute the command again. 
The  clear binding call basically binds a NULL to each variable, which 
you are overwriting anyway.

HTH
Dennis Cote

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Column headers of result

2009-07-05 Thread Dennis Cote
BareFeet wrote:
>
>   
>>> How can I get just the column headers without all the result rows?
>>>   
>> Turn headers on, then perform a search which gives no results.
>> 
>
> Unfortunately, the sqlite3 command line tool does not show the headers  
> when there are no result rows. 
>
>   
You can change that behavior with the pragma empty_result_callbacks (see 
http://www.sqlite.org/pragma.html).

SQLite version 3.6.16
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> create table t(a,b);
sqlite> pragma empty_result_callbacks=1;
sqlite> .header on
sqlite> select * from t;
a|b

HTH
Dennis Cote
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Re bind Statement

2009-07-05 Thread Simon Slavin

On 5 Jul 2009, at 2:02pm, Indiff3rence wrote:

> Using the v2 version of prepare didn't help. I'm not sure how can I  
> use
> sqlite_exec and 'BEGIN TRANSACTION' / 'COMMIT'. Can you please  
> provide an
> example where you insert multiple entries to a DB.

Do the command 'BEGIN TRANSACTION'.  Then do each of your 'INSERT'  
commands .  Then do the command 'COMMIT'.  Only when you do the  
'COMMIT' does your database actually change.  You can do any of these  
with _exec or by using _prepare, whichever you want.  The page about  
it is here:



but it should be easy enough for you to try yourself.  If you have  
lots of 'INSERT' commands, this should speed up the total amount of  
time it takes to execute them all.

Simon.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Re bind Statement

2009-07-05 Thread Indiff3rence


Simon Slavin-2 wrote:
> 
> Forget all the fancy ways to speed up individual INSERT commands.  You  
> could probably just use sqlite_exec.  Your speed problem is probably  
> that you're not specifying that they're all the same transaction.  Do  
> a 'BEGIN TRANSACTION' before the first one and a 'COMMIT' after the  
> last one.
> 
> If you do want to use _prepare, try to use the _v2 versions of it and  
> check to see that you're using _finalize correctly.
> 
> Simon.
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> 
> 

Thanks for your reply.

Using the v2 version of prepare didn't help. I'm not sure how can I use
sqlite_exec and 'BEGIN TRANSACTION' / 'COMMIT'. Can you please provide an
example where you insert multiple entries to a DB.

Kind regards,

Pedro Saraiva
-- 
View this message in context: 
http://www.nabble.com/Rebind-Statement-tp24339026p24342912.html
Sent from the SQLite mailing list archive at Nabble.com.

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] problem with SQLITE_BUSY

2009-07-05 Thread Wenton Thomas
I used sqlite version 3.5.9.
The interface sqlite3_next_stmt()  is not offerd.

Any  other solution to check whether all statements really are finalized?





From: Dan 
To: General Discussion of SQLite Database 
Sent: Saturday, July 4, 2009 10:03:47 PM
Subject: Re: [sqlite] problem  with SQLITE_BUSY


On Jul 4, 2009, at 8:12 PM, Wenton Thomas wrote:

> I use prepare statements, and I  am sure I  finalize all  of  them.

You may be mistaken. sqlite3_next_stmt() will return 0 if all
statements really are finalized.

   assert( sqlite3_next_stmt(db, 0)==0 );

Dan.

>
>
>
>
>
> 
> From: Igor Tandetnik 
> To: sqlite-users@sqlite.org
> Sent: Saturday, July 4, 2009 8:44:52 PM
> Subject: Re: [sqlite] problem  with SQLITE_BUSY
>
> Wenton Thomas wrote:
>> Now in my system I used sqlite  to manage  2  database file A.db and
>> B.db,  and each has a connection handle cA, cB. My operation perform
>> like this:
>>
>>
>> sqlite3_exec( select records from cA)
>> sqlite3_exec("begin transaction");
>> insert all records  into cB;
>> sqlite3_exec("commit transaction");
>>
>> All  return value is normal.,but when  I  execute
>> rc = sqlite3_close(),
>> return value rc always be SQLITE_BUSY.
>
> How precisely do you implement "insert all records" part? Do you use
> prepared statements, by any chance? If so, you need to finalize all  
> such
> statements before you can close the connection.
>
> Igor Tandetnik
>
>
>
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
>
>
>
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users



  
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users