Re: [sqlite] A Question: Use of the sqlite3_exe( ) function?

2007-10-08 Thread John Stanton

Lee Crain wrote:

Igor,

I have a question. 


Why is it "highly recommended" to use the function call sequence you
iterate in preference to the sqlite3_exe call, since it is implemented
using that sequence?

Lee Crain

The callback method did not turn out to be such a good idea in practice 
and was superseded by a more flexible and powerful approach.  Write a 
few programs and the benefit becomes very obvious.


Using the prepare, step API's also encourages you to write more 
efficient and robust programs by pre-compileing the SQL.


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



[sqlite] A Question: Use of the sqlite3_exe( ) function?

2007-10-08 Thread Lee Crain
Igor,

I have a question. 

Why is it "highly recommended" to use the function call sequence you
iterate in preference to the sqlite3_exe call, since it is implemented
using that sequence?

Lee Crain

_

-Original Message-
From: Igor Tandetnik [mailto:[EMAIL PROTECTED] 
Sent: Sunday, October 07, 2007 9:44 AM
To: SQLite
Subject: [sqlite] Re: Callback fonction really not flexible to use

[EMAIL PROTECTED] wrote:
>Here a sample (in c) of the use i would like to do with sqlite
>fucntion1() call fonction2() where is sqlite3_exec()
>Callback function is the function3() and i would like to add data
>in an array, which is retuned to function1() after the call of
> function(2).
>How i can do that ? does the Callback function can return
> something else than an int ?

A callback function must return 0. Any non-zero return value is an error 
indicator.

However, the callback can, and usually does, have side effects. The 
void* parameter you pass to sqlite3_exec is passed through to the 
callback. Normally, this points to some kind of a data structure that 
the callback modifies.


Having said that, be aware that sqlite3_exec is retained for backward 
compatibility only. It is highly recommended for new code to use API 
like sqlite3_prepare, sqlite3_step, sqlite3_finalize, sqlite3_column_* 
to iterate over the resultset. In fact, sqlite3_exec itself is 
implemented entirely in terms of these public API functions.

Igor Tandetnik 


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



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