Jump to content

_SQLite "Delete From" Problem.


Recommended Posts

hi there, i have a problem with deleting rows. searched forum, tried too many times but cannot figured it out.

my problem is: sqlite delete is not deleting really or rolling deleted data back after restart.

used commands :

_SQLite_Exec($DBN, "DELETE FROM "&$curtable&" WHERE id = '" & $curpersonid & "';")
_SQLite_Exec($DBN, "COMMIT")

after this, when i press the list people button it does list correctly. (deleted person not in the list)

but it creates a file @scriptdir with name: "[databasename].db-journal" and rolls data back from it to original database after restart. (i think)(also, this file is in-use so i cannot delete it.)

i need your help. i will be very very appreciated. btw, sorry for my poor english :D wish u understand.

:alien: ~ Every Living Thing is a Code Snippet of World Application ~ :alien:

Link to comment
Share on other sites

Try to add semicolon after COMMIT

Also use BEGIN together with COMMIT

_SQLite_Exec($DBN, "BEGIN;")
_SQLite_Exec($DBN, "DELETE FROM "&$curtable&" WHERE id = '" & $curpersonid & "';")
_SQLite_Exec($DBN, "COMMIT;")

EDIT:

In many simple scripts you can also use DELETE without COMMIT

_SQLite_Exec($DBN, "DELETE FROM "&$curtable&" WHERE id = '" & $curpersonid & "';")
Edited by Zedna
Link to comment
Share on other sites

Try to add semicolon after COMMIT

Also use BEGIN together with COMMIT

_SQLite_Exec($DBN, "BEGIN;")
_SQLite_Exec($DBN, "DELETE FROM "&$curtable&" WHERE id = '" & $curpersonid & "';")
_SQLite_Exec($DBN, "COMMIT;")

EDIT:

In many simple scripts you can also use DELETE without COMMIT

_SQLite_Exec($DBN, "DELETE FROM "&$curtable&" WHERE id = '" & $curpersonid & "';")

Thanks 4 answer but,

--> Function: _SQLite_Exec

--> Query: COMMIT;

--> Error: cannot commit transaction - SQL statements in progress

Lemme guess, i have to _SQLite_Close($DBN) after any exec or query ??

or, _SQLite_Exec($DBN, "END;") before COMMIT ?

Edited by mistakilla

:alien: ~ Every Living Thing is a Code Snippet of World Application ~ :alien:

Link to comment
Share on other sites

No. Your guess are wrong.

Post more (whole) code.

solved. you gave me the idea so thank you very much !

ive just _SQLite_QueryFinalize($hQuery)'ed. and that silly journal file gone. btw, it ate my 1 day :D

:alien: ~ Every Living Thing is a Code Snippet of World Application ~ :alien:

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...