PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV Mobile 2024 → Resetting database
Resetting database
Débuté par Mike Stewart, 06 fév. 2017 20:57 - 3 réponses
Posté le 06 février 2017 - 20:57
I am trying to reset my database as a security element of my app.

I can't get the following code to work because I can not get the errors to 'fall silently'

Can anyone suggest what may be wrong or suggest an alternative please? if fFileexist for example doesn't work on Android

Many Thanks

Procedure Scrub_data()
sPs is string = AtSchool("N")

sPassReq is string = "Individuals Foc_reg_log"
sNoPass is string = "school_detail group_hierarchy group_membership groups Foc_reg_header seating_plans timetable_entries TT_clashes Lesson_Files"
sNoPass=sNoPass+" Lesson_outline lessons day_timings Entities OneDrive WorkHierarchy current_user"
serr is string
FOR EACH STRING sFile OF sPassReq SEPARATED by " "
IF HOpen(sFile,sPs)=True THEN
sSQL is string = "DELETE FROM "+sFile
dsOne is Data Source
IF HExecuteSQLQuery(dsOne,hQueryDefault,sSQL) = False THEN
// IF HDeleteAll(sFile)=False THEN
serr=serr+CR+HErrorInfo(hErrMessage)
END
ELSE
Trace(HErrorInfo(hErrFile))
END
END


FOR EACH STRING sFile OF sNoPass SEPARATED by " "
sSQL is string = "DELETE FROM "+sFile
dsOne is Data Source
IF HExecuteSQLQuery(dsOne,hQueryDefault,sSQL) = False THEN
// IF HDeleteAll(sFile)=False THEN
serr=serr+CR+HErrorInfo(hErrMessage)
END
END
//info(serr)
OpenMobileWindow(WIN_login)
Posté le 07 février 2017 - 10:41
Hi Mike

you are talking about errors, but you are not giving us the error
message, or on what instruction it happened

Best regards

--
Fabrice Harari
International WinDev, WebDev and WinDev mobile Consulting

Ready for you: WXShowroom.com, WXReplication (open source) and now WXEDM
(open source)

More information on http://www.fabriceharari.com


Le 2/6/2017 à 2:57 PM, Mike Stewart a écrit :
I am trying to reset my database as a security element of my app.

I can't get the following code to work because I can not get the errors
to 'fall silently'

Can anyone suggest what may be wrong or suggest an alternative please?
if fFileexist for example doesn't work on Android

Many Thanks

PROCEDURE Scrub_data()
sPs is string = AtSchool("N")

sPassReq is string = "Individuals Foc_reg_log"
sNoPass is string = "school_detail group_hierarchy group_membership
groups Foc_reg_header seating_plans timetable_entries TT_clashes
Lesson_Files" sNoPass=sNoPass+" Lesson_outline lessons day_timings
Entities OneDrive WorkHierarchy current_user" serr is string
FOR EACH STRING sFile OF sPassReq SEPARATED BY " "
IF HOpen(sFile,sPs)=True THEN
sSQL is string = "DELETE FROM "+sFile
dsOne is Data Source
IF HExecuteSQLQuery(dsOne,hQueryDefault,sSQL) = False THEN
// IF HDeleteAll(sFile)=False THEN
serr=serr+CR+HErrorInfo(hErrMessage)
END
ELSE Trace(HErrorInfo(hErrFile))
END
END


FOR EACH STRING sFile OF sNoPass SEPARATED BY " "
sSQL is string = "DELETE FROM "+sFile
dsOne is Data Source
IF HExecuteSQLQuery(dsOne,hQueryDefault,sSQL) = False THEN
// IF HDeleteAll(sFile)=False THEN
serr=serr+CR+HErrorInfo(hErrMessage)
END
END
//info(serr)
OpenMobileWindow(WIN_login)
Posté le 07 février 2017 - 12:16
In this case I could not get the error handling to work even when I tried the automated version. What did work though was to create the file if it did not exist using hcreationifnotfound. That way I avoided the errors in the first place.


If anyone would like to add anything to this I am pretty sure it is a function that will be needed.
Posté le 07 février 2017 - 15:47
Hi Mike,

If anyone would like to add anything to this I am pretty sure it is a
function that will be needed.


Needed for what? If you uninstall the apk, all data files are deleted too...

So except if you have a very specific case file, I don't know whre
anybody would use this.


Furthermore, a simple loop on hcreation will reset all files.

Best regards

--
Fabrice Harari
International WinDev, WebDev and WinDev mobile Consulting

Ready for you: WXShowroom.com, WXReplication (open source) and now WXEDM
(open source)

More information on http://www.fabriceharari.com