Here I describe two bugs, maybe are corelated, maybe not.
I have the following two files
trf05f FILE,DRIVER('ODBC'),OWNER('wmj'),NAME('trf05f'),PRE(t05),CREATE,BINDABLE,THREAD
trf05k1 KEY(t05:trt0501),NOCASE,OPT,PRIMARY
trf05k2 KEY(t05:trt0503,t05:trt0501),DUP,NOCASE,OPT
Record RECORD,PRE()
trt0501 STRING(20)
trt0502 STRING(2000)
trt0503 LONG
trt0504 STRING(1)
END
END
trf03f FILE,DRIVER('ODBC'),OWNER('wmj'),NAME('trf03f'),PRE(t03),CREATE,BINDABLE,THREAD
trf03k1 KEY(t03:trt0301),NOCASE,OPT,PRIMARY
trf03k2 KEY(t03:trt0302,t03:trt0301),DUP,NOCASE
trf03k3 KEY(t03:trt0303,t03:trt0301),DUP,NOCASE
Record RECORD,PRE()
trt0301 LONG
trt0302 STRING(50)
trt0303 STRING(50)
END
END
And the relation is trf03f many trf05f one on trt0503=trt0301
I have generated the browse of trf05f with table relation
trf05f
-trf03f
Bugs:
I have found that the template generated browse blocks when I enter the procedure. I had to use taskmanager to kill process.
After some debugging, it turned out that the browse was called from the main frame without START. When I clicked "open in new thread" the blocking diseappeared.
I have found that the following scenario generates view open error:
-enter the same browse template
-exit the browse
-enter the browse for the second time : view error
If I enter the second time the browse, but without exiting the firstly opened browse, then no error happens.
After some debugging I have found that if I put the trf03f,trf05f on table list in the main frame then the error disappears.
Thanks
Nenad
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
1. is a programming error; you must open MDI child windows in separate threads. Though c2j should fail more gracefully whenever this happens.
2. It sounds as though that clarion 6 ABFILE detection of files being opened or closed is not working perfectly with c2j and error you are getting is because the file is closed, but ABFILE thinks it is open. In clarion, internal state of a file, whether it is opened or not, is not accessible, so ABFILE independently tracks it. They must be out of sync. Checking code, I notice that tracking whether a file is open or not in c2j is global, not thread local. Maybe this is cause of the problem? Based on the behaviour you describe above, sounds like ABFILE when compiled by c2j, is not correctly tracking closing of files.
Your workaround is the best approach anyway, and it is what I do. I open all files on the main thread as soon as the application opens. Opening and closing SQL files makes no sense. Having a file open does not consume resources, and opening close costs time (goes to PostgreSQL database and fetches meta data on the underlying table, i.e. column names and types etc). So it is best to keep file open at all times. All files share a single database connection, there is one connection per thread.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Here I describe two bugs, maybe are corelated, maybe not.
I have the following two files
trf05f FILE,DRIVER('ODBC'),OWNER('wmj'),NAME('trf05f'),PRE(t05),CREATE,BINDABLE,THREAD
trf05k1 KEY(t05:trt0501),NOCASE,OPT,PRIMARY
trf05k2 KEY(t05:trt0503,t05:trt0501),DUP,NOCASE,OPT
Record RECORD,PRE()
trt0501 STRING(20)
trt0502 STRING(2000)
trt0503 LONG
trt0504 STRING(1)
END
END
trf03f FILE,DRIVER('ODBC'),OWNER('wmj'),NAME('trf03f'),PRE(t03),CREATE,BINDABLE,THREAD
trf03k1 KEY(t03:trt0301),NOCASE,OPT,PRIMARY
trf03k2 KEY(t03:trt0302,t03:trt0301),DUP,NOCASE
trf03k3 KEY(t03:trt0303,t03:trt0301),DUP,NOCASE
Record RECORD,PRE()
trt0301 LONG
trt0302 STRING(50)
trt0303 STRING(50)
END
END
And the relation is trf03f many trf05f one on trt0503=trt0301
I have generated the browse of trf05f with table relation
trf05f
-trf03f
Bugs:
I have found that the template generated browse blocks when I enter the procedure. I had to use taskmanager to kill process.
After some debugging, it turned out that the browse was called from the main frame without START. When I clicked "open in new thread" the blocking diseappeared.
I have found that the following scenario generates view open error:
-enter the same browse template
-exit the browse
-enter the browse for the second time : view error
If I enter the second time the browse, but without exiting the firstly opened browse, then no error happens.
After some debugging I have found that if I put the trf03f,trf05f on table list in the main frame then the error disappears.
Thanks
Nenad
1. is a programming error; you must open MDI child windows in separate threads. Though c2j should fail more gracefully whenever this happens.
2. It sounds as though that clarion 6 ABFILE detection of files being opened or closed is not working perfectly with c2j and error you are getting is because the file is closed, but ABFILE thinks it is open. In clarion, internal state of a file, whether it is opened or not, is not accessible, so ABFILE independently tracks it. They must be out of sync. Checking code, I notice that tracking whether a file is open or not in c2j is global, not thread local. Maybe this is cause of the problem? Based on the behaviour you describe above, sounds like ABFILE when compiled by c2j, is not correctly tracking closing of files.
Your workaround is the best approach anyway, and it is what I do. I open all files on the main thread as soon as the application opens. Opening and closing SQL files makes no sense. Having a file open does not consume resources, and opening close costs time (goes to PostgreSQL database and fetches meta data on the underlying table, i.e. column names and types etc). So it is best to keep file open at all times. All files share a single database connection, there is one connection per thread.
OK, i will open my files at init time.
Nenad