DELETE Statements

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

DELETE Statements

dannyp1202
Hello,
 
I'm using ne latest SQlite Version in a C++ programm without a wrapper
class/function or something like that. To execute SELECT Statements the
sqlite3_exec() function with a callback function works fine. But what must I
do to execute DELETE Statements? There is no callback function needed
because no return of the Statement is made. I tried do pass NULL for the
callback function pointer but the record in the database isn't deleted. No
error occurs, too.
 
Can somebody tell me, what I have to do, for executing DELETE statements?
 
Thanks in advance.
Daniel
Reply | Threaded
Open this post in threaded view
|

Re: DELETE Statements

Martin Engelschalk
Hi Daniel,

I do a

sqlite3_prepare()
sqlite3_step()
sqlite3_finalize()

Perhaps you would like to use a C++ wrapper. There is one in
codeproject: http://www.codeproject.com/database/CppSQLite.asp

Martin



Daniel schrieb:

>Hello,
>
>I'm using ne latest SQlite Version in a C++ programm without a wrapper
>class/function or something like that. To execute SELECT Statements the
>sqlite3_exec() function with a callback function works fine. But what must I
>do to execute DELETE Statements? There is no callback function needed
>because no return of the Statement is made. I tried do pass NULL for the
>callback function pointer but the record in the database isn't deleted. No
>error occurs, too.
>
>Can somebody tell me, what I have to do, for executing DELETE statements?
>
>Thanks in advance.
>Daniel
>
>  
>
Reply | Threaded
Open this post in threaded view
|

AW: DELETE Statements

dannyp1202
Hello,
Thanks for your answer.

> sqlite3_prepare()
> sqlite3_step()
> sqlite3_finalize()

I tried to do this, but nothing happend. I passed the SQL Statement to the
prepare function and sqlite3_stmt to the step and the finalize function. The
prepare function returns SQLITE_DONE and the prepare and finalize functions
return SQLITE_OK. But the record stays in the Database.

What do I do wrong? The database isn't opend in any other way during the
query.

Thanks
Daniel

Reply | Threaded
Open this post in threaded view
|

Re: AW: DELETE Statements

Teg-3
Hello Daniel,


So, sqlite3_exec() returns no error status or message? How are you
generating the SQL query? What happens if you type the exact same
command in Sqlite3.exe?

Your method should work, I use Exec to create and drop tables without
any callback functions.

My guess is the query is just wrong. You should get a failed status
from the C call though.

C

D> Hello,
D> Thanks for your answer.

>> sqlite3_prepare()
>> sqlite3_step()
>> sqlite3_finalize()

D> I tried to do this, but nothing happend. I passed the SQL Statement to the
D> prepare function and sqlite3_stmt to the step and the finalize function. The
D> prepare function returns SQLITE_DONE and the prepare and finalize functions
D> return SQLITE_OK. But the record stays in the Database.

D> What do I do wrong? The database isn't opend in any other way during the
D> query.

D> Thanks
D> Daniel




--
Best regards,
 Teg                            mailto:[hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: DELETE Statements

Dan Kennedy
In reply to this post by dannyp1202

It sounds to me like your DELETE statement contains a bug. You are correct
to pass NULL as the callback function. Your best bet might be to try to
get the DELETE working in the sqlite shell first. Or you could just post
the table schema, text of the statement and the contents of the row you
are unable to delete and someone here will probably be able to see the
problem.
 


--- Daniel <[hidden email]> wrote:

> Hello,
>  
> I'm using ne latest SQlite Version in a C++ programm without a wrapper
> class/function or something like that. To execute SELECT Statements the
> sqlite3_exec() function with a callback function works fine. But what must I
> do to execute DELETE Statements? There is no callback function needed
> because no return of the Statement is made. I tried do pass NULL for the
> callback function pointer but the record in the database isn't deleted. No
> error occurs, too.
>  
> Can somebody tell me, what I have to do, for executing DELETE statements?
>  
> Thanks in advance.
> Daniel
>


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com