|
| Inicio → WINDEV 2024 → Ping JImbo san. HOpen() vs HCreationIfNotFound() /auto modify db-tables |
| Ping JImbo san. HOpen() vs HCreationIfNotFound() /auto modify db-tables |
| Iniciado por guest, 10,oct. 2009 01:47 - 13 respuestas |
| |
| | | |
|
| |
| Publicado el 10,octubre 2009 - 01:47 |
Hi JImbo san, (and Hi You) With reference to this discussion : http://forum.mysnip.de/read.php… I have modified your source a bit (will follow) and ATM I think you are wrong :
>Therefore, the program would balk at you with an error message if the structure in the analysis doesn't match the physical structure of the data file. BUT: there's virtually no way to know whether the program needs to be updated or the data file has to be restructured! Even worse, I found that data files not always contain the correct generation number but do work together with an analysis of a higher generation number as long as the physical structure fits the structure in the analysis!
I think we can catch error 70016 (THE FILE DOES NOT MATCH ITS DESCRIPTION) -- see yourself :
HChangeConnection( "*", SHARED.gsConnection )
sAllFiles is string = HListFile("","",hLstNormal) sCurrFile is string nErrCode is int
FOR EACH STRING sCurrFile OF sAllFiles SEPARATED by CR
WHEN EXCEPTION IN HOpen(sCurrFile)
DO ExceptionEnable()
nErrCode = ExceptionInfo(errCode)
IF nErrCode = 70021 _OR_ nErrCode = 70052 THEN HIndex( sCurrFile, hNdxSilent )
ELSE IF nErrCode = 70003 THEN HCreation(sCurrFile)
ELSE IF nErrCode = 70016 THEN
ELSE EndProgram( ExceptionInfo(errFullDetails), -1) END
END END
So it seems that we are able to catch structural analysis changes (Error 70016): The idea is now ro re-use the cModifyAuto class coming along with the WDSetup example.... but more in the following message... (This one is allready too long. Björn |
| |
| |
| | | |
|
| | |
| |
| Publicado el 10,octubre 2009 - 01:47 |
For a better understanding, or in other words, to see the whole problematic: Here the current snippet : HFAQL CS, UserGroupware...
Procedure PRIVATE EstablishConnection() IF gpwOpenConnection(gsConnection, "ADMIN", "", gstMyConnection:sServer, gstMyConnection:sDatabase , hAccessHFClientServer ) = False THEN Error(ErrorInfo()) ELSE
nRes is int = gpwOpen()
IF nRes gpwOk THEN
SWITCH nRes CASE gpwError : Error("Error initializing the groupware.", ErrorInfo()) CASE gpwUnknownUser : Error("Unknown user.") CASE gpwInvalidPassword : Error("Invalid password.") CASE gpwCancel : Error("User Groupware canceled.") OTHER CASE ERROR("Unknown User Groupware error.") END
EndProgram()
ELSE
HChangeConnection( "*", SHARED.gsConnection )
sAllFiles is string = HListFile("","",hLstNormal) sCurrFile is string nErrCode is int
FOR EACH STRING sCurrFile OF sAllFiles SEPARATED by CR
WHEN EXCEPTION IN HOpen(sCurrFile)
DO ExceptionEnable()
nErrCode = ExceptionInfo(errCode)
IF nErrCode = 70021 _OR_ nErrCode = 70052 THEN HIndex( sCurrFile, hNdxSilent )
ELSE IF nErrCode = 70003 THEN HCreation(sCurrFile)
ELSE IF nErrCode = 70016 THEN
ELSE EndProgram( ExceptionInfo(errFullDetails), -1) END
END END END END Next How ro invoke automatic update without adding the WINDEV TOOL.. and of course questions ... Björn |
| |
| |
| | | |
|
| | |
| |
| Publicado el 10,octubre 2009 - 01:48 |
Now the questions remains : How to auto-update db-tables which are not in sync with the analysis any more ? I would like to re-use a class coming from the WDSetup project.. : cAutoModif in conjunction with the WDMOD140:DLL I have'nt implemented that feature.. but have to ... within the next 2-3 hours... (Help is welcome) So folks : In case that I am completely wrong.. let me know...
Still remaining questions : 1) What are the Full_Text_Index related errors ? So that I can DO a :
IF nErrCode = XXXXX THEN HIndex( sCurrFile, hFTX ) Björn |
| |
| |
| | | |
|
| | |
| |
| Publicado el 10,octubre 2009 - 18:08 |
Hi JImbo san, (and Hi You)
>With reference to this discussion :
>http://forum.mysnip.de/read.php…
>I have modified your source a bit (will follow) and ATM I think you are wrong :
>
Therefore, the program would balk at you with an error message if the structure in the analysis doesn't match the physical structure of the data file. BUT: there's virtually no way to know whether the program needs to be updated or the data file has to be restructured! Even worse, I found that data files not always contain the correct generation number but do work together with an analysis of a higher generation number as long as the physical structure fits the structure in the analysis!
>> I think we can catch error 70016 (THE FILE DOES NOT MATCH ITS DESCRIPTION) -- see yourself :
HChangeConnection( "*", SHARED.gsConnection )
sAllFiles is string = HListFile("","",hLstNormal) sCurrFile is string nErrCode is int
FOR EACH STRING sCurrFile OF sAllFiles SEPARATED by CR
WHEN EXCEPTION IN HOpen(sCurrFile)
DO ExceptionEnable()
nErrCode = ExceptionInfo(errCode)
IF nErrCode = 70021 _OR_ nErrCode = 70052 THEN HIndex( sCurrFile, hNdxSilent )
ELSE IF nErrCode = 70003 THEN HCreation(sCurrFile)
ELSE IF nErrCode = 70016 THEN
ELSE EndProgram( ExceptionInfo(errFullDetails), -1) END
END END
So it seems that we are able to catch structural analysis changes (Error 70016): The idea is now ro re-use the cModifyAuto class coming along with the WDSetup example.... but more in the following message... (This one is allready too long. Björn
Hello Bjoerno san, I never said, that I could not detect a mismatch of analysis and file structure (70016)! Of course, we can! What I said was, that from now on you're lost! Why? Because you ONLY know, that the structure of a file definition in the analysis does not match the structure of a given physical file. There are (at least!) two possible cases of the 70016-situation to handle: A - [color=#A52A2A]The program is older than the file.[/color] If you're starting WDMODFIC.EXE now and try to restructure the file, you're can restructure it up to the end of time - at the next HOpen(..) the file will stubbornly give you a 70016 !!! What is really to be done here, is an update of the program itself, but there's no way to find out from HOpen-ing it! You'd need a second mechanisms (which you'd have to invent!) which tells you 'Hey dude, this data file is for generation number 4711 but the analysis of the file in the currently used analysis is only 4710 !' You can read the generation number of the physical data file using MyFileName..GenerationNumber, but there is no way to find the Generation number of the file in the analysis! B - [color=#A52A2A]The program is newer than the file.[/color] Here, we can cure the 70016 easily by using WDMODFIC.EXE ! But you cannot know whether the 70016 was issued because of case A or case B ! Comment: Comparing the physical file's GUID with the analysis file GUID doesn't help us either. It will only tell you that the file is matching / not matching the program. GUIDs are random strings and tell nothing about a newer/older situation. [color=#0000FF]Suggested remedy:[/color] before generating the setup of the any program version, run a small routine that reads the Generation Number of all phyiscal files of the test environment and writes them to a file (suggested file type: .INI) and distribute / install the program together with this file into the .exe directory. When doing the HOpen-mambo, you can easily find out whether you have situation A or B. Kind regards, Guenter |
| |
| |
| | | |
|
| | |
| |
| Publicado el 10,octubre 2009 - 18:09 |
>Now the questions remains : How to auto-update db-tables which are not in sync with the analysis any more ?
>I would like to re-use a class coming from the WDSetup project.. : cAutoModif in conjunction with the WDMOD140:DLL
>I have'nt implemented that feature.. but have to ... within the next 2-3 hours... (Help is welcome)
>So folks : In case that I am completely wrong.. let me know...
>
Still remaining questions :
>
1) What are the Full_Text_Index related errors ?
>So that I can DO a :
>[quote]IF nErrCode = XXXXX THEN HIndex( sCurrFile, hFTX )[/quote]
>Björn
> Hi Bjoerno san, if you know the correct cause of a 70016 AND if you know that the file is older than the program then you can restructure the file using WDMODFIC.EXE, which can be re-distributed with your program. WDMODFIC.EXE can be used / executed from the command-line and it can be used together with the graphical shell. Easy way: if you're getting a 70016 PLUS a comparison between VERSIONS.INI and the phyiscal file's Generation Number reveals that the file is older than the program then run the command-line version of WDMODFIC.EXE on exactly that file. If comparison between VERSIONS.INI and physical file reveals that the program is older than the file then as the user to update their software and terminate the program. Kind regards, Guenter |
| |
| |
| | | |
|
| | |
| |
| Publicado el 10,octubre 2009 - 18:09 |
Jimbo san, just this (atm) I don't want to have WDMODFIC.EXE with our Installation. I simply hate black boxes. I prefer programming/flexibility. later, bjoern |
| |
| |
| | | |
|
| | |
| |
| Publicado el 10,octubre 2009 - 18:09 |
Domo Arigato JImbo san, As always, I am readong your comments very! carefully: But atm. it seems that I a'm not able to get it. ... Don't know how about you, since we are living within the same time-zone, but I have to sleep. (Guess you are just out of the bed) .. However, this is something which needs definitely further investigation. (and maybe a very clever workaround) Will read your comments again in about 6 hours. Hopefully more "open minded" Björn |
| |
| |
| | | |
|
| | |
| |
| Publicado el 10,octubre 2009 - 18:09 |
Hi Bjoerno san, I think, we don't have a choice here, let's be realistic! We do not re-invent HyperFileSQL, we do not re-invent W-Language, the Report generator or even Windev itself, so why is it so bad to use WDMODFIC.EXE ? It's just one of the many, many tools we (and our customers) are using on a daily basis. We do not make a hammer before using it, we just buy one. The only case we make a hammer is when there is no hammer available that fits our needs. Kind regards, Guenter |
| |
| |
| | | |
|
| | |
| |
| Publicado el 10,octubre 2009 - 18:10 |
Hi Bjoern, most days I'm out of bed from about 4:00 in the morning. Normally, I have take a nap in the afternoon anyway because they left me one kidney only and it takes about two hours time to get rid of the lunch's metabolism-byproducts. The upside of it is that I can stay with my wife in the evening, watching TV or doing a walk. Kind regards, Guenter |
| |
| |
| | | |
|
| | |
| |
| Publicado el 10,octubre 2009 - 18:12 |
I always have one file in the project called tbl_version, which has only one field current_version. On startup of my exe I read the current version from the executable (with ProjectInfo() ) and compare it to the info in the database. If the version is older: display an error and quit. Running an older version, in my case, is never allowed. And actually not needed. If the exe-version is newer: 1. create a backup with HBackup() (because you never know what's happening during the folowing steps) 2. start wdmodfic with the proper command-line options 3. you can run some conversion routines. Every now and then you have to modify/replace/move data as well, because with your new version, existing functionality has improved/changed. 4. start a re-index of the database and recalculate stats as well (because data may have changed a lot during step 3). 5. Finally save the new version. This way you keep track of the proces yourself. You can remove these option in the setup, which is to complicated for ordinary users. Arie |
| |
| |
| | | |
|
| | |
| |
| Publicado el 22,octubre 2009 - 09:46 |
Hi Arie, what if your customer chooses to install your program a second time? Only way to go: distribute the tbl_version together with your software and HCopyFile() it to the database while doing the setup. Kind regards, Guenter |
| |
| |
| | | |
|
| | |
| |
| Publicado el 22,octubre 2009 - 11:43 |
Guenter, a second install (with a second, new database) is the same as a first install. The tbl_version is newly created and therefore empty. I check on this and skip most steps in this case. I only save the version-number. Arie |
| |
| |
| | | |
|
| | |
| |
| Publicado el 19,diciembre 2009 - 16:12 |
| |
| |
| | | |
|
| | |
| |
| Publicado el 20,diciembre 2009 - 18:00 |
Hi All, Great discussion. Two comments: 1) We always distribute WDMODFIC.exe + required files with our applications. Furthermore, we automatically execute WDMODFIC every start up of the application. It is not even noticed by our users as we do is silently and it does not take noticeable time. This has proven very valuable since we have multiple users (some with copies of the data where no network is available). We use automatic updates but the automatic update only changes one of the data copies at install. Also, it will not change data if restored from a backup. Thus the WDMODFIC check at start up. 2) The code for handling related errors and damaged / mismatched files are great ideas for making the application execute automatic recovery. Currently we have applications running in cafeterias where they are on roll carts since the cafeteria is also the gym. Occasionally the power is pulled accidentally (sometimes as a prank). Usually HF recovers nicely but sometimes a file is damaged. So instead of having the user run re-indexing, etc. maybe we could do that on the fly and just delay the start briefly. Lots of good ideas. Thanks to all, |
| |
| |
| | | |
|
| | | | |
| | |
|