looking for a LC/iOS master…

i'm developing an app for both desktop and mobile platforms (LC 5.5.2, iOS 5.1, OSX). this app has access to a local sqlite database. after the startUp, a copy of the internal DB is copied into the "documents" folder, if it needs (i.e. at the very first launch, at least). then, the user has to click an "enter" btn to read the data. this btn checks the db file version getting the current one via url/php code from my server. if it needs, the update procedure starts.
and that's the weird thing:
this is the code i'm using
Code: Select all
#btn "enter"
on mouseUp
checkDB
go to cd "db home"
end mouseUp
command checkDB
put "Loading…" into fld "status"
put the defaultFolder into oldDefFolder
set the defaultFolder to specialFolderPath("Documents")
put the files into tCurVersion
set the defaultFolder to oldDefFolder
filter tCurVersion with "*.sql"
if tCurVersion is empty then put copyDB() into tCurVersion //eg: tCurVersion = "db1.sql"
put "Checking version…" into fld "status"
put kBaseUrl & kCheck into theURL
put URL theURL into tLastVer //eg: tLastVer = "db2.sql"
if tLastVer <> tCurVersion then answer question localString("update_avalilable") with "OK" OR localString("cancel")
if it is "OK" then put updateDB(tCurVersion, tLastVer) into tCurVersion
put specialFolderPath("Documents") & SLASH & tCurVersion into gPathDB //save the db file path in a global
put "" into fld "status"
end checkDB
function updateDB tCurVersion, tLastVer
#eg: tCurVersion = "db1.sql", tLastVer = "db2.sql"
if tCurVersion <> tLastVer then
put specialFolderPath("Documents") & SLASH & tCurVersion into tFilePath
delete file tFilePath
put "ftp://" & uDB & ":" & pDB & kBaseFTPUrl & tLastVer into tSource
put specialFolderPath("Documents") & SLASH & tLastVer into tDestination
put URL(tSource) into URL ("binfile:"&tDestination)
put the result
end if
return tLastVer
end updateDB
function copyDB
…
return tCurVersion
end copyDB
whilst on iPad device the result is empty (then no errors during the ftp download), the file is updated (old one goes away, new one appears) BUT the file is 0 byte.
any ideas? what's wrong with my code?
