1. Beatrix Willius
  2. Valentina Database ADK
  3. 金, 3月 01 2019, 01:56 PM
  4.  メールで購読
I finally took some time to make the diagnosis of my database run without the pizza of death. No joy.

1) The example "Database_Diagnose" shows how not to do this. It uses


while mThreadFinished = false
app.SleepCurrentThread 100
wend


Please fix.

2) The menu is in MainWindow, which sends the diagnosis to the MainWindowController, then to MaxModel. We go to the DBUtilities class which does the DiagnosisThread. And this is without mentioning the progress window.

I changed the above code to a notification which goes do the DBUtilities class. However, I can't stop the interface in MainWindow from doing something. Since it's become en vogue not do do crash reports anymore my app just does vanish.

Not even events would help here because I can't block anything.

So what can I do?

1. I could close the database, do the diagnosis and open the database again. Ugly. Likely will change the selection.

2. I could try to set the open cursors to nil, do the diagnosis and reset the cursors. Not sure what would happen in the interface.

3. I could try to find out where the app crashes and fix that. Without crash log this is suboptimal. Not sure what would happen in the interface and if there are other places where the app could crash.

No solution sounds really good.

Am I overthinking this? Is there a simpler solution?

Xojo 2018r4, Valentina 8.7.

I still don't understand why you can't do like Christian or other database plugins MT (multithread) versions of the normal methods which encapsulate the whole multithreading operations so that we don't have to do this complicated stuff. And I haven't even looked at the diagnosis I do at the end of archiving which has a way more complex set of events.

Mit freundlichen Grüßen/Regards

Beatrix Willius

http://www.mothsoftware.com
Mail Archiver X: The email archiving solution for professionals
コメント
There are no comments made yet.
Ivan Smahin 承諾済みの回答
Beatrix, you should try v.9.x. It seems it is fixed already (including V4RB example).
コメント
There are no comments made yet.
Beatrix Willius 承諾済みの回答
Hi Ivan,

yes, the example is better now. However, the basic problems remains with the diagnosis.

While a database is open and a diagnosis is running I can't easily prohibit access to the database. I was successful with method 2 that I mentioned above. But I still need to save the state of the database and reload the state after doing the diagnosis.

Regards

Beatrix Willius
コメント
There are no comments made yet.
Ruslan Zasukhin 承諾済みの回答
I guess Ivan means 9.0.7 which should be soon (today?)
コメント
There are no comments made yet.
Ivan Smahin 承諾済みの回答
I think you should simply show some own "beach ball" during diagnose, like progress bar.
コメント
There are no comments made yet.
Beatrix Willius 承諾済みの回答
Sigh...

I AM showing a progress window with an indeterminate progress bar.

HOWEVER: the users get confused by the beachball. They think my app hangs. The app should NEVER EVER show the beachball. Users have no understanding about threads and internals. They just see the beachball and they were taught that this is a "bad thing". Is this so hard to understand? You are not a user.
コメント
There are no comments made yet.
Ruslan Zasukhin 承諾済みの回答
what problem with progress bar signed as "Do Diagnose of DB. This can take some time. Please wait."
コメント
There are no comments made yet.
Beatrix Willius 承諾済みの回答
The progress window already shows this.

Again: the users see the beachball and it doesn't matter what is in the progress window. They just think that the app isn't doing anything anymore.
コメント
There are no comments made yet.
Ruslan Zasukhin 承諾済みの回答
Hi Beatrix,

Why users will think that app does nothing if you will show text in that progress bar dialog
"Do Diagnose of DB. This can take some time. Please wait."


Additionally:

* You say "do it as others do". For 9.x we did it really as MySQL plugin for Xojo, which is open source.
* This is the best what is possible to do in Xojo, with its cooperative threading.
* And you should build own thread <-> progress bar.
* During this long operation, you cannot do any other db operations.
* But it must be able to do other operations if you want.
* But your app now must not show "not responsible" to OS, because event loop leaves.
コメント
There are no comments made yet.
Ruslan Zasukhin 承諾済みの回答
/// I still don't understand why you can't do like Christian or other database plugins MT (multithread) versions of the normal methods which encapsulate the whole multithreading operations so that we don't have to do this complicated stuff. //

* Beatrix, we did it in 9.x EXACTLY as MYSQL plugin for Xojo, which is open source.
* it also requires usage of TIMER,


If you think they can do something in another way, maybe you can make a simple example around MySQL plugin and demonstrate to us?
コメント
There are no comments made yet.
Beatrix Willius 承諾済みの回答
We are talking in circles - like the last time.

Please tell me how you want to do a multithreaded SQL query with a timer? How does this here work:

https://www.monkeybreadsoftware.net/sql-sqldatabasembs-method.shtml#4

Everything is hidden behind the MT.

Yes, I can make my code - diagnosis, opening, cloning - work with a timer. The user interface wasn't made for asynchronous database access and I have a lot of problems as result. As long as you do only simple examples you don't see a problem. The database is used in multiple places and there is no simple "open, diagnose, close".
コメント
There are no comments made yet.
Ruslan Zasukhin 承諾済みの回答
okay, I have read this method description.

So let's clarify. You say:

1) new our method with timer, which we made as official Xojo MySQL plugin, do works for you fine, but
2) you wonder if it is possible to do things as MBS plugin do.
Right?

Then more questions:

* have you use this plugin yourself to see it really works as you expecting?

* does exists example that demonstrates a more real-world example of this ConnectMT() method and something else in new Thread of Xojo? How you will know in Xojo app that thread has finished its job? (Ivan thinks may be again you need a timer for this? Xojo does not have thread join functionality for example).
コメント
There are no comments made yet.
Beatrix Willius 承諾済みの回答
Hi guys,

method with timer: yes, for simple situation this works fine.

MBS: yes, sure, I want the wonderful but sometimes strange Valentina plugin to work similarly to the also wonderful and differently strange MBS plugin.

Checking the plugin to see if the MT methods work: you are kidding, right? You can download the plugin yourself. There are a lot of examples. For me Christian has made 2 methods for MT use that aren't database related. Those work fine.

Example for real world use in MBS plugin: you need to do NOTHING special. No timer, no threads, no nothing.

Yesterday I talked to a developer friend about Valentina and he helped me to clear my thoughts: database access is by it's nature synchronous. Just look at an SQL statement. You do an SQLSelect and work with the result. You want to force A-synchronous access. This won't work because it's against the nature of a database. Yes, I can try to plug the holes that the async access makes. But it will always be something that shouldn't be done.
コメント
There are no comments made yet.
  • ページ :
  • 1


There are no replies made for this post yet.
However, you are not allowed to reply to this post.

Categories

Announcements & News
  1. 0 subcategories
Valentina Studio
  1. 2 subcategories
Valentina Server
  1. 4 subcategories
Valentina Database ADK
  1. 0 subcategories
Valentina Reports ADK
  1. 0 subcategories
Other Discussions
  1. 0 subcategories
BETA Testing
  1. 0 subcategories
Education & Research
  1. 0 subcategories
Omegabundle
  1. 0 subcategories