Page 1 of 1

Email SQLite Database

Posted: Fri Dec 14, 2012 6:12 pm
by wunder
Hello- still newbie here. I've developed a prototype application that stores data in a SQLite database. Now I'm trying to get the database off the iphone and back to my desktop PC. There doesn't appear to be a way to copy the file directly, so I thought I'd try using the mobileComposeMail command. However, when the email opens, it does not appear to contain an attachment and when I receive it, there is no attachment. Here's my code- I realize the attachment type is wrong, but I was expecting to just receive a text file with the name of the database at this point... I also changed my email address so it's not posted. Thanks in advance.

if the environment = "mobile" then
put DatabasePath into tAttachment["data"]
put "text/plain" into tAttachment["type"]
put "MeteorCount.SQLite" into tAttachment["name"]
mobileComposeMail "Meteor Data " & date(), "myemail@myserver.com",,"Here is the SQLite Database",tAttachment
end if

Re: Email SQLite Database

Posted: Fri Dec 14, 2012 6:55 pm
by gpb01
If you copy your DB into the "documents" directory [ specialFolderPath("documents") ] and you enable the "File Sharing" flag on the Standalone Application settings, you can access the folder directly from iTunes to read/write files. :)

Guglielmo

Re: Email SQLite Database

Posted: Fri Dec 14, 2012 7:18 pm
by wunder
Sweet- thanks! Works great.

I would still like to know how to attach the database to an email if anyone has an answer to that.

Re: Email SQLite Database

Posted: Fri Dec 14, 2012 8:15 pm
by monte
mobilecomposemail has an attachment parameter

Re: Email SQLite Database

Posted: Fri Dec 14, 2012 8:33 pm
by wunder
Do you mean something different from what I posted in my code?

Re: Email SQLite Database

Posted: Fri Dec 14, 2012 11:42 pm
by strongbow
You might want to base64encode the DB before you send it in mail.. or zip + encode it before sending as attachment...?

Ahh - just checked the iOS release notes and this doesn't seem necessary - sorry...!

Re: Email SQLite Database

Posted: Sat Dec 15, 2012 12:49 pm
by Mark
Hi,

It looks like a comma is missing:

Code: Select all

mobileComposeMail "Meteor Data " & date(), "myemail@myserver.com",,,"Here is the SQLite Database",tAttachment
Kind regards,

Mark

Re: Email SQLite Database

Posted: Sat Dec 15, 2012 5:36 pm
by wunder
Whoops- thanks so much and sorry about the dumb question! I'm a noobie with livecode, but I've been coding for 25 years and should know better than that! It's working now. :oops: