App with multi-user-database?

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
DevBoyLars
Posts: 216
Joined: Wed Feb 27, 2013 9:04 pm

App with multi-user-database?

Post by DevBoyLars » Mon Jul 13, 2015 7:51 pm

Hello,
is it possible in LiveCode to build a client App that connects to a server-database, so that multiple users can read/write to that database in a good speed?

ghettocottage
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 366
Joined: Tue Apr 10, 2012 9:18 am

Re: App with multi-user-database?

Post by ghettocottage » Mon Jul 13, 2015 9:58 pm

Yes, I am working on 3 different ones. They all work fine. I am having the best luck using Livecode Server as an intermediary. Here is a long-ish thread where we were discussing this to some extent:

http://forums.livecode.com/viewtopic.ph ... 08#p124508

DevBoyLars
Posts: 216
Joined: Wed Feb 27, 2013 9:04 pm

Re: App with multi-user-database?

Post by DevBoyLars » Sun Jul 26, 2015 1:10 pm

Ok, so there's no direct-way to use something like a MySQL for every client without server-side coded software? I'm looking "just" for a way to store data in a server-based database. The server itself doesn't need to do anything - just store the data and every client should use it at the same time :D

AxWald
Posts: 578
Joined: Thu Mar 06, 2014 2:57 pm

Re: App with multi-user-database?

Post by AxWald » Sun Jul 26, 2015 3:32 pm

Hi,
DevBoyLars wrote:Ok, so there's no direct-way to use something like a MySQL for every client without server-side coded software?
For sure you could do this. If you can reach your MySQL directly from the internez, go on. Just make sure that no 2 users ever try to modify the same record at the same time! ;-)
This can be done marking the record to be "in use" before editing, and un-marking it after, and hoping this all will really work in an environment where's latency and lag. (check for "semaphor", "mutex", "lock") *1)

And be sure to have nothing important in this database, because chances are good it gets hijacked within a short time ...
{Input in field User: "John Doe'); Drop table USER;--"}

Or, and that's what most ppl do, you have some kind of "middleware". A process running on the server that acts as an "agent" between your users and the database. (Often such is made in PhP, but LC server, or even a LC standalone should do the trick as well, with less hassle. The thread ghettocottage has linked should be full of information related.)

Now all traffic is bundled on this agent, and you have 2 big advantages:
  1. Since your agent gets all the queries, it will nicely fulfill one after the other, and you don't need to care about write conflicts any more.
  2. Since all queries go through your agent, you have a nice point where you can filter entries - for instance, reject anything that contains certain chars like ";" etc.
Have fun!

*1) And if you use MySQL, be sure your tables support transactions - MyISAM doesn't! Choose your table type wisely or suffer later!
All code published by me here was created with Community Editions of LC (thus is GPLv3).
If you use it in closed source projects, or for the Apple AppStore, or with XCode
you'll violate some license terms - read your relevant EULAs & Licenses!

ghettocottage
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 366
Joined: Tue Apr 10, 2012 9:18 am

Re: App with multi-user-database?

Post by ghettocottage » Sun Jul 26, 2015 5:22 pm

DevBoyLars wrote:Ok, so there's no direct-way to use something like a MySQL for every client without server-side coded software? I'm looking "just" for a way to store data in a server-based database. The server itself doesn't need to do anything - just store the data and every client should use it at the same time :D
Livecode can do that, but if your database is on a remote server (that you use the internet to reach) there are some security issues (as Axwald mentioned).

By having Livecode Server installed on the same MySQL server, you can send your data requests to a livecode server file, and get back your data. This adds an extra layer of security to the transaction.

Having multiple users also has some issues, but nothing that cannot be solved with some thought and planning.

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”