I'm trying to update an existent SQLite DB with WinDev Mobile 21. The DB has stored data and I don't want to lose it.
I've updated the Analysis in the project adding a column to a table and now the app can't open it because the structure of the .db file is different from the expected.
First I thought in use the SQL "ATER TABLE" statement and add the new column to the .db file, but I don't know how. So I tried to connect to the old DB before opening, copy the existent data to a temporary Data Source, delete the file, create a new one with the new structure and copy the stored data to it.
This is the code I tried, info function must return the number of records but returns 0. HOpenConnection() and HExecuteSQLQuery() are successful.
ProductesTemp is Data Source
HDescribeConnection("Temp","","","/sdcard/Android/data/com.dbases/ficheret.db/ficheret.db","ficheret",hNativeAccessSQLite,hOReadWrite)
IF HOpenConnection("Temp") THEN
IF HExecuteSQLQuery(ProductesTemp,"Temp",hQueryDefault,"SELECT * FROM Productes") THEN
Info("HRecNum: " + HRecNum(ProductesTemp))
ELSE Info("HExecuteSQLQuery Error", HErrorInfo(hErrFullDetails)) END
ELSE Info("HOpenConnection Error", HErrorInfo(hErrFullDetails)) END |