Board index » off-topic » Multithreaded paradox table access test in Borland Builder (deadpoint, special for you ;-))

Multithreaded paradox table access test in Borland Builder (deadpoint, special for you ;-))


2003-11-19 09:37:38 PM
off-topic12
Quote
Yes if you rewrite it in builder 5, I can spend an hour or so
looking.
I've made it:
www25.brinkster.com/alex99933/db_test.html
 
 

Re:Multithreaded paradox table access test in Borland Builder (deadpoint, special for you ;-))

Hi Alex,
Looking at code now. Your code looks ok but as you have mentioned data in
grid is incorrect, instead of 1...numrecords it shows
1..x,1...y,1...z etc. The effect is much worse when the thread is running
but the problem is still there when the addrecord thread has finished.
I have checked and found
1. Database Desktop shows correct results so the table itself is not the
problem.
2. The query results in the thread are wrong before the results even get
into the dbgrid!!!!
I am simplifying the code in the query thread to see where things are going
wrong.
"Alex" < XXXX@XXXXX.COM >wrote in message
Quote

>Yes if you rewrite it in builder 5, I can spend an hour or so
>looking.

I've made it:
www25.brinkster.com/alex99933/db_test.html
 

Re:Multithreaded paradox table access test in Borland Builder (deadpoint, special for you ;-))

Hi Alex
Have done some more looking the code, what seems to be happening is that you
are starting the query from one thread and doing a sqlexec. Then you are
checking the results from the context of another thread fired from the
timer.
I think you need to simplify what is going on to make sense of what is
happening.
Try and isolate all actions for a given database/session to its 'own'
thread.
I will see what I can do with your code over the next few days to sort out
the duplicate problems
I can see what you are trying to do and think that sucking in the whole
dataset into the grid is probably a bad idea.
It will never be a super fast way of displaying the results even if you
resolve the duplicate problems.
You could implement a virtual listview the sucks in the appropriate records
as needed.
I have done this with Interbase and cursors with tables 10's of millions
rows and the results are blindingly fast if you cache things a bit.
deadpoint dave
 

{smallsort}

Re:Multithreaded paradox table access test in Borland Builder (deadpoint, special for you ;-))

"deadpoint" < XXXX@XXXXX.COM >wrote:
Quote
Hi Alex

Have done some more looking the code, what seems to be happening is that you
are starting the query from one thread and doing a sqlexec. Then you are
checking the results from the context of another thread fired from the
timer.
It was done for the following reason. After the SQL run in the thread the window (FormOpenProgress) with progress of the operation occur. The FormOpenProgress has the timer for
1. Show progress messages.
2. Check if the SQL thread is done.
3. After the SQL thread is done show the results (FormGrid);
For simplification I've removed the progress component (Rx DbProgress), but the window is still there.
Quote
Try and isolate all actions for a given database/session to its 'own'
thread.
I think It's already isolated. Or not?
Quote
I will see what I can do with your code over the next few days to sort out
the duplicate problems
I'll be very grateful.
Quote

I can see what you are trying to do and think that sucking in the whole
dataset into the grid is probably a bad idea.
Agree with it. But the main problem for me is the multiple records.
I'll be waiting for your answer.
Thanks a lot.
 

Re:Multithreaded paradox table access test in Borland Builder (deadpoint, special for you ;-))

Hi Alex,
If you look at the code you will see that you are creating the
Databases,Sessions and Queries in the context of WinMain
and the grid display form - session,database and query are on the form not
created dynamically.
I will see if I can create a very simple app using your db with a reader and
writer thread as this seems to be basically what you want to do.
deadpoint dave
 

Re:Multithreaded paradox table access test in Borland Builder (deadpoint, special for you ;-))

"deadpoint" < XXXX@XXXXX.COM >wrote:
Quote
Hi Alex,

If you look at the code you will see that you are creating the
Databases,Sessions and Queries in the context of WinMain
and the grid display form - session,database and query are on the form not
created dynamically.
Yes. But I was told that it is necessary that the thread have separate session and database. Is it also necessary that the session and database are created dynamically and from exact the same thread which one will work with them?
Quote
I will see if I can create a very simple app using your db with a reader and
writer thread as this seems to be basically what you want to do.
If you will make it, I'll be very grateful.
Thank you for your help.