Problem with rawSQL.flushAllClientsCache

Hello Everybody

Version: 5.2.7 - build 1013
I have a form ftests with some fields from table tests. (record view) key = testid
In this form i have a tabpanel with 3 related forms.(tableview)
ftestuser shows fields username and testresult from table testuser (relation from tests via testid)
ftestquestions
ftestresults

In form ftestresults we mark the choosen answers for each user and each question.
Then we have a button that fires a method.
This method calculates the testresult for each testuser and then updates the table testuser with the result.

var updcmd = "update testuser set testresult = ? where testid = ? and testuserid = ? "
args…
l_ok = plugins.rawSQL.executeSQL(“pug_schulung”,“testuser”,updcmd,args);

plugins.rawSQL.flushAllClientsCache(“pug_schulung”,“testuser”)

The testresult is writen to the table, but it isnt shown in form ftestuser ???
After restarting the client, the correct testresult is shown in form ftestuser as expected.

Seems that plugins.rawSQL.flushAllClientsCache(“pug_schulung”,“testuser”) is not working ?!

I tried:
update…flush
and then

forms.ftestuser.controller.find();
forms.ftestuser.testid = forms.ftests.testid
forms.ftestuser.controller.search();

to force a reload for the records in form ftestuser.
No success. Forms ftestuser still shows the testresult form the first load, not the new calculated result.

After newstart of client everthing is OK.

Need help !!!

Regards
Albert

We’ve had lots of problems with this one Albert - and the only solution that has worked for us to consistently to force the update has been to refreshRecordFromDatabase(-1).

Though I have to say - that since the Flush fails silently you need to capture the error so that you can determine if your SQL is wrong in the execute. In 90% of the cases we could track it down to something that the query did not like - but the knowledge that the Db is correctly updated but the flush does not broadcast it always makes tracking the problem difficult.

Looking forward to some sort of resolution on this one!

Ian

First of all, why are you doing such a simple update with rawSQL???
and not with the default way of servoy doing it??

be also carefull, with rawSQL, flush, with many users, it can drill your server down!
rawSQL is ment to be, for exotic SQL updates, or large data imports, or something like that…

and not with the default way of servoy doing it??

Hello Harjo

My queststion was:
Why is plugins.rawSQL.flushAllClientsCache not working as expected ???

I don’t assume that you want do tell me that flushAllClientsCache is only working after complex sql-commands.

I know, that this easy example can be solved with servoy logic(and we solved it), but we need a way to ‘update/refresh’ our forms after an rawSQL.
We have a lot of sql-commands, that can’t be done with servoy logic. (updates with recursive querys for example, a special thing that is supported from our database “MAXDB”)

If i interpret the answer from Kahuna right, i’m not alone with this problem.

Regards

Albert

Oke I understand! :-)

it should just work, but if it isn’t and have a reproducable case, please file it Servoy’s support system!

be aware that using: flushAllClientsCache, can be VERY performance consuming, what it does, it flushes ALL foundset’s on ALL clients, all at the same time!!
We have had situations, where 50 clients, where connected, and one client fired the flushAllClientsCache, ALL 50 clients will halt, for 5-10 seconds, because of the (in our case) thousands of queries, that where fired on the server, and ALL clients receiving the new data, the same time.

So, for this (IMHO) it is better to use refreshFromDatabase functions…

It should work: can you file a case preferably with a little test solution?

Paul