Some people complain about not being able to debug in 64 bit… What do you do to debug a program that is running on a distant host and does not behave like in the IDE ?
Here is my problem : the very same method that records data just fine when a Web program runs in the IDE on Mac gets an error “unable to open database file” when the program runs on the Linux host. I simply record a code, SecondsFrom1970, and the current date.
I use code adapted from the SQlite example.
This step goes fine in both cases in the Open event. The Debuglog method places the messages in a property I can read from the web app :
[code] DB = New SQLiteDatabase
Dim f As FolderItem
If DebugBuild then
f = app.ExecutableFile.Parent.Parent.Parent.parent.child(“compteurs.sqlite”) 'SpecialFolder.Documents.Child(“compteurs.sqlite”) 'New FolderItem(“compteurs.sqlite”)
system.DebugLog app.ExecutableFile.ShellPath
Debuglog str(f.exists)+EndOfLine
else
f = app.ExecutableFile.Parent.child(“compteurs.sqlite”) 'SpecialFolder.Documents.Child(“compteurs.sqlite”) 'New FolderItem(“compteurs.sqlite”)
Debuglog str(f.exists)+EndOfLine
end if
db.DatabaseFile = f
If db.CreateDatabaseFile Then
// proceed with database operations…
Debug = Debug + "Database created "+EndOfLine
Else
MsgBox("Database not created. Error: " + db.ErrorMessage)
Debuglog "Database not created. Error: " + db.ErrorMessage+EndOfLine
End If[/code]
The file exists, and database is created.
Where it gets bad is here. When run in the IDE on Mac the record is added just fine. When run on the Linux host I get the “unable to open database file”. I verified the permissions for the sqlite file, it is 666, everybody can read and write :
[code] If db.Connect Then
// App.DB is a connected database
Dim tables As RecordSet
tables = DB.TableSchema
dim lestables as string
If tables <> Nil Then
While Not tables.EOF
lestables = lestables + tables.IdxField(1).StringValue
tables.MoveNext
Wend
tables.Close
End If
if instr(lestables, "ftstest") = 0 then
db.SQLExecute("CREATE VIRTUAL TABLE ftstest USING fts4(content TEXT, totalsec TEXT, zdate TEXT); ")
end if
If not db.Error Then
DB.Commit
else
MsgBox(Currentmethodname+" Error: " + db.ErrorMessage)
End If
Dim myDate as Xojo.Core.Date = Xojo.Core.Date.Now
Dim GMTZone As New Xojo.Core.TimeZone("GMT")
Dim dule As New Xojo.Core.Date(myDate.SecondsFrom1970, GMTZone)
Dim Result as boolean
// Add data
'DB.SQLExecute("BEGIN TRANSACTION")
dim d as new date
db.SQLExecute("INSERT INTO ftstest (content, totalsec, zdate) VALUES ('"+Code+"', '"+format(dule.SecondsFrom1970,"###")+"', '"+d.SQLDate+"')")
// We record encrypted UUID, SecondsFrom1970 GMT, and SQLDate
Debuglog "Record dule : "+format(dule.SecondsFrom1970,"###")
If not db.Error Then
Debuglog "Recorded OK"
Result = True
else
Debuglog(Currentmethodname+" Error: " + db.ErrorMessage)
End If
Return Result
end if[/code]
I will appreciate any pointers.