Data storage

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
carel
Posts: 58
Joined: Mon Jul 29, 2013 2:49 pm

Data storage

Post by carel » Wed Feb 12, 2014 2:00 pm

I've written a little program for a school that runs on their network.

I've done the following to store data: I create / edit a file on a network share called lessons.txt that looks like this:

lesson name a*1
lesson name b*2
lesson name c*3

The * is the delimiter and the numbers in the second columns is the filename - in other words lessons.txt is in /sharename and in /sharename/lessons is file 1, 2, 3 etc. When a new lesson is created, I look for the highest valued filename and then just add 1 to it to create the new lesson, when a lesson is deleted, I simply remove the line of the lesson from lessons.txt and delete the file 2 for example, then I just have file 1,3 and 2 is never used again (I'm sure filenames can go into billions?)

I'm adding users now and I'm just wondering if there is a better way to store the data, without using sql? ie. something similar that what I have explained here.

Remember that many computers will read from the network, although only the teacher will create lessons, etc. That is until I get to storing reports as well when a student complete a lesson (file access problems?)

Thanks,

Carel

carel
Posts: 58
Joined: Mon Jul 29, 2013 2:49 pm

Re: Data storage

Post by carel » Wed Feb 12, 2014 2:25 pm

I was just thinking about security and an alternative way of doing it.

Security:
Hidden share? - not very secure, but hey there is companies that has their whole accounting books in a normal shared folder.
Give all the files .exe extension? (don't laugh)

Alternative:
Have a "server" program run on the server, with a data grid (I haven't used one yet) and then "clients" connect to the server listening on a port? (I've also never done anything remotely complicated as this)

Thanks,

Carel

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am
Location: Palo Alto

Re: Data storage

Post by Simon » Wed Feb 12, 2014 8:38 pm

Hi Carel,
Not sure about the need for security as they are lessons that one would want people to see. Aside from that, lookup encrypt/decrypt very easy to use.

The longest path to a file is 256 characters, that includes your filename so naming of files must be less then that (no infinite length filenames) .

As this gets bigger you'll want descriptions of the lessons, maybe a separate file? Really will need backups.

Basic up and running sqlite takes a day of learning with liveCode and this http://www.w3schools.com/sql/default.asp. Enough to track teachers/lessons. If you have 10 teachers and 100 lessons then not really needed but a great tool to learn. Don't forget sqlite is built into liveCode, you don't have to do anything except check a box in the standalone settings.

2 cents
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

carel
Posts: 58
Joined: Mon Jul 29, 2013 2:49 pm

Re: Data storage

Post by carel » Thu Feb 13, 2014 3:53 pm

Thanks Simon,

I think I must stop being so lazy and just learn SQL. Will all the clients be able to access the database by pointing it to \\server\share\database.mdb without sql running on the server?

The server IS probably running sql, but I don't want my program to be reliant on any third-party services etc. (and not cause problems with it as well).

Thanks,

Carel

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am
Location: Palo Alto

Re: Data storage

Post by Simon » Thu Feb 13, 2014 11:31 pm

Hi Carel,
Getting mySQL (for multiple users) running on a server is not a beginner task. Well, on-rev/cpanel made it easy for me but I don't know what you have. I just started with the sqLite lesson and worked on it locally then moved to mysql on my server. If you don't have control of the server then best to get IT involved (warning!).
Will all the clients be able to access the database by pointing it to \\server\share\database.mdb ...
Can't really answer that Yes or No, way too specific. With all conditions met then yes.
...without sql running on the server?
Not sure what you mean here, you will want to run mysql... err... to have a database.

No, I'm not a server admin who knows all the ins and outs. Maybe I just got lucky with my setup and fortunately everything fell into place after plenty of studying.
Have a "server" program run on the server, with a data grid (I haven't used one yet) and then "clients" connect to the server listening on a port?
I think you can ease up a bit here... "listening on a port" that is a bit over the top as it has a specific meaning not related to what you should need for this. Just build the whole thing on your local machine see that it's running correctly and when ready for the server, change over all your "put url("file:" & blah/blah.txt ..." to point to the server "put url("file: \\server\share\blah\blah.txt ..."

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”