Checking if delete operation was successful |
In my controller I do
PHP Code: $meetingsModel->delete(55); PHP Code: $db = db_connect(); I am using SQLite3 database. 1. Is this a bug? 2. What other method could I use to check if the deletion was successful? I can only think of making another query to check if row 55 is still in the database table...
==
Donatas G. Code: $sqlite = new SQLite3('database.sqlite'); Count The Number Of Rows Modified What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
(01-16-2023, 12:40 AM)InsiteFX Wrote:Hi, thanks, looks like it should work, although in my case it will bypass the model hooks so I will go with repeated find for now... I did not notice any disclaimer regarding different behaviour of $db->rowsAffected() when using SQLite3 db, so I should probably report is as a bug. I will see if I should open something like https://github.com/codeigniter4/CodeIgni...ssues/4632 with SQLite3 specifics.
==
Donatas G.
Today I checked my original code in the first post, and now, on Codeigniter 4.4.3, it works as expected, deleted row number is reported correctly (0 if nothing is deleted, 1 if one row...). Works with both mysql and sqlite3. So, problem solved.
==
Donatas G. |
Welcome Guest, Not a member yet? Register Sign In |