controller.deleteAllRecords

controller.deleteAllRecords() does not want to work in real time…
I have to do it twice to work:
controller.deleteAllRecords, show all records, then delete again works…
where is the trap?
I have also tried using the foundset directly, same misery…
All this works if issued using sql commands directly.

Is this alway the case, also in a simple example, or only in specific scenario’s?

When you first call controller.deleteAllrecords, does the controller have records?

Paul

1: specific scenario, but I have no other table I can delete and repopulate with no consequence
2: yes, it had 576 records, after first deleteAllRecords, the screen is showing no records, but if I ask to show all, all records come back. I delete a second time, then it’s ok. problem is repeatable… if I wait a lot in between, like working 10mn on something else, it seems to be ok. but is this supposed to be cached? even if the deletion is not pushed to the db server in real time, it should not show these records as available from the servoy server cache?
Note that all this is with a foundset that exceeds 200 recs, and to show all, I use my own method to work around the 200 recs. limit.
my “show all” method:
function show_all(event) {
//load complete table instead of 200 lines
var $sql = “select report_id from report” ;
var dataset = databaseManager.getDataSetByQuery(“ocifam”, $sql ,null, 100000);
controller.loadRecords(dataset);
}

This is an odd one

What database are you using and are you deleting the records within a transaction?

Are you sure the deleteAllRecords is successful (returns true)?

Are you sure the server and table on which you query in the show_all method are exactly the same as the server and table the form is based on?

If the deleteAllRecords is succesful, it beats me how this can happen, as delete(All)Records will delete the records directly in the database, thus the query you performs afterwards should not return any records. What is the size of the dataset with PK’s in the show_all method?

Paul

What database are you using and are you deleting the records within a transaction?
----------- sql2008express

Are you sure the deleteAllRecords is successful (returns true)?
------------- did not check, I’ll add this and let you know.

Are you sure the server and table on which you query in the show_all method are exactly the same as the server and table the form is based on?
------------- yes, otherwise it would not work on 2nd time.

If the deleteAllRecords is succesful, it beats me how this can happen, as delete(All)Records will delete the records directly in the database, thus the query you performs afterwards should not return any records. What is the size of the dataset with PK’s in the show_all method?
------------- 576

result is true, even when records are not deleted…
seems like if I wait a long time, a few minutes, deletion will work on 1st attempt.
to avoid any wrong interpretation, I checked the physical presence of my records using the mssql studio management utility which issues sql commands in real time, and its results matches what I mentionned on servoy side. when show_all() still shows records after a deletion, the mssql studio management shows them as well…

can you look in the admin pages what sql statement is fired to the database when you call deleteAll ?

here it is.
contains the 1st delete (failed) and then the 2nd (successfull). no other action.

Servoy Server Administration.txt (33.3 KB)

lesouef,

Can you reproduce that in a small sample?

Rob

not today, I am not on site. but I will; the problem is on one table only but you need the data in another table to create records in the guilty one.
how can I supply this to you? this is a mssql db, and I don’t want to post it here, these data are not public and belongs to a company, I’d like to send you a link in an email.
while talking about it, I noticed yesterday that it does not happen if the records have been in the db for a while, but only if they have been created recently (less than a few minutes). I’ll also try next week to move this solution to my portable PC which is running on mysql instead of mssql, to see if it behaves differently.

lesouef,

I meant with a small sample, a new very simple solution that displays this issue.

Rob