How to include database?

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
ECNU4271
Posts: 93
Joined: Tue May 07, 2013 4:33 pm

How to include database?

Post by ECNU4271 » Fri Aug 23, 2013 7:09 pm

Hi, all!

I am a completely beginner on programming.

But by using Live Code, I've already built my iOS app's all interfaces. It looks great but they are all dummy pages.

I now just wonder how can I make use of a database so that I can record account information?

What tool should I get? Is there a tutorial about it?

I have a Mac. I have no experience in any knowledge of database.


Thanks for any advice!
Michael

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10367
Joined: Wed May 06, 2009 2:28 pm

Re: How to include database?

Post by dunbarx » Fri Aug 23, 2013 7:20 pm

Hi.

LiveCode has SQLlite capability built-in. But do you need to use such a thing? Will you have so many records that speed will be an issue?

Otherwise, even with datasets of many, many thousands of records, LC can manage easily and quickly. A basic table field works pretty well for that.

How much data are we talking about?

Craig Newman

ECNU4271
Posts: 93
Joined: Tue May 07, 2013 4:33 pm

Re: How to include database?

Post by ECNU4271 » Fri Aug 23, 2013 7:20 pm

What way/database will be the most convenient way to do this? Because the database would only have two tables to meet my need. Thanks! Keep waiting for any idea!

ECNU4271
Posts: 93
Joined: Tue May 07, 2013 4:33 pm

Re: How to include database?

Post by ECNU4271 » Fri Aug 23, 2013 7:23 pm

dunbarx wrote:Hi.

LiveCode has SQLlite capability built-in. But do you need to use such a thing? Will you have so many records that speed will be an issue?

Otherwise, even with datasets of many, many thousands of records, LC can manage easily and quickly. A basic table field works pretty well for that.

How much data are we talking about?

Craig Newman

Thanks for the rapid reply.

In my thoughts, there will be two tables in the database. One is about account details(including name, password, etc.).
The other is about course details (including time, duration, place. attenders etc.).

I need the information on my app refreshing from database real-time.

How can I achieve this?

Many thanks!

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10367
Joined: Wed May 06, 2009 2:28 pm

Re: How to include database?

Post by dunbarx » Fri Aug 23, 2013 7:30 pm


ECNU4271
Posts: 93
Joined: Tue May 07, 2013 4:33 pm

Re: How to include database?

Post by ECNU4271 » Fri Aug 23, 2013 7:49 pm


Thanks. I've already downloaded and looked at this SQLlite Example.
The example shows how to create a database manually by clicking. What I need is that the database is already there. When user uses, they register(the information goes into database) and then they can log in(verify the information from the database).

How to do that?

Thanks!
Michael

BvG
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1239
Joined: Sat Apr 08, 2006 1:10 pm
Contact:

Re: How to include database?

Post by BvG » Fri Aug 23, 2013 7:50 pm

You could also store your data in text files as lists with delimiters, no need to learn sql for small and easy information like that ;)

for mobile:

Code: Select all

put field 1 into url ("file:" & the documents folder)
for desktops:

Code: Select all

ask file ""
if it <> "" then
   put field 2 into url ("file" & it)
end if
Various teststacks and stuff:
http://bjoernke.com

Chat with other RunRev developers:
chat.freenode.net:6666 #livecode

ECNU4271
Posts: 93
Joined: Tue May 07, 2013 4:33 pm

Re: How to include database?

Post by ECNU4271 » Fri Aug 23, 2013 7:55 pm

BvG wrote:You could also store your data in text files as lists with delimiters, no need to learn sql for small and easy information like that ;)

for mobile:

Code: Select all

put field 1 into url ("file:" & the documents folder)
for desktops:

Code: Select all

ask file ""
if it <> "" then
   put field 2 into url ("file" & it)
end if
Thanks BvG,

Not just store. Those data needs to be verified when user logs in. The data need to be retrievable so that other pages can see the status of one course.

Does text file still work in this case?

Michael

BvG
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1239
Joined: Sat Apr 08, 2006 1:10 pm
Contact:

Re: How to include database?

Post by BvG » Sat Aug 24, 2013 1:06 pm

Why wouldn't it? What you want sounds like it's a server tho, and not storage on iOS. Which of course introduces different problems, and solutions, like using ftp to upload data, or facilitating remote access to a hosted sql database, with all their security problems and added complexities.
Various teststacks and stuff:
http://bjoernke.com

Chat with other RunRev developers:
chat.freenode.net:6666 #livecode

Klaus
Posts: 14222
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: How to include database?

Post by Klaus » Sat Aug 24, 2013 1:15 pm

BvG wrote:...for mobile:

Code: Select all

put field 1 into url ("file:" & the documents folder)
Hmmm, I would rather supply a FILENAME here, too:

Code: Select all

put field 1 into url ("file:" & the documents folder & "/my_prefs_file.txt")
8)

BvG
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1239
Joined: Sat Apr 08, 2006 1:10 pm
Contact:

Re: How to include database?

Post by BvG » Sat Aug 24, 2013 1:18 pm

Klaus wrote:removed
shh... let them find out by themselves ;)
Various teststacks and stuff:
http://bjoernke.com

Chat with other RunRev developers:
chat.freenode.net:6666 #livecode

ECNU4271
Posts: 93
Joined: Tue May 07, 2013 4:33 pm

Re: How to include database?

Post by ECNU4271 » Sat Aug 24, 2013 5:29 pm

BvG wrote:Why wouldn't it? What you want sounds like it's a server tho, and not storage on iOS. Which of course introduces different problems, and solutions, like using ftp to upload data, or facilitating remote access to a hosted sql database, with all their security problems and added complexities.
Yes, it's more like a server! But how could I do it?

BvG
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1239
Joined: Sat Apr 08, 2006 1:10 pm
Contact:

Re: How to include database?

Post by BvG » Sat Aug 24, 2013 8:30 pm

http://revolution.byu.edu/internet/RevInternet.php

put url "http://your.server.this.is.not/file.txt" into filed 1
put field 1 into url "ftp://john:passwd@ftp.example.net:2121/data.txt"

that's one way... see the dictionary:

url
ftp
http
launch
save
put
get
post
Various teststacks and stuff:
http://bjoernke.com

Chat with other RunRev developers:
chat.freenode.net:6666 #livecode

Post Reply