Moving an SQL database to LiveCode

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
Simon Knight
Posts: 919
Joined: Wed Nov 04, 2009 11:41 am

Moving an SQL database to LiveCode

Post by Simon Knight » Fri Jan 28, 2011 6:27 pm

Hi,

I run a small business and I control my time bookings, invoicing and expenses in an application I wrote in RealBasic. One of reasons I moved from Realbasic to RunRev was the lack of any simple report generation in Realbasic - when creating a report I have to keep track of where everything is on the page which makes updating my reports slow and error prone. The application, which is called Time&Expense uses an SQL database with 5 data tables to store company and client information. While SQL is powerful it is overkill for my small business and quite difficult to maintain. However one of the strengths of Time&Expense is that the data is completely separate from the application code and this feature allows the application to be updated while leaving the data intact.

When I port my application to Livecode I plan to use its built-in data storage capabilities rather than an external SQL database as my data tables are very small. I wish to maintain the data in a separate data file so that it is possible to simply perform data ups: this file could be either a TSV or similar file opened on start-up or possibly a sub-stack. I have searched the forum for advice and found the following:

Richard Gaskin wrote last October:
For documents, while I often use stack files for data storage because of the convenient efficiency of custom properties for storing stuff, I usually use it for storage only, with any views showing that data implemented as substacks of my app mainstack. This lets me update the user interface at any time without affecting the user's data files.

That's a whole other story we can get into later.
I am interested in how Richard's schema operates with a non-IDE version of the code, for instance is it a case of using a compiled/built main splash stack and having all the other stacks including those holding data as substacks thus allowing the subs stacks to be updated by the running application? If this is the way to go how would you advise implementing a 5 table structure; all the tables on one card, one table per card, one table per stack or some other cunning way?

Thanks for reading,
Simon
best wishes
Skids

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

Re: Moving an SQL database to LiveCode

Post by BvG » Fri Jan 28, 2011 6:46 pm

No. that won't work. Substacks will be part of the Standalone executable, and therefore not saveable. what you want is just to use any stack file. Your standalone can load them, and use them afterwards as regular stacks. For example:

Code: Select all

on mouseUp --works in IDE as well as your standalone
  answer file "a stack"
  if it <> "" then
    go stack URL ("binfile:" & it)
  end if
end mouseUp
As for saving 5 tables, I'd suggest using custom properties. Using fields is sligthly slower, but has the advantage that Chars are automatically converted when going from windows to mac or back (you can do that yourself using the platform property and the isotomac() respectively mactoiso() functions. So it depends on your needs I guess.
Various teststacks and stuff:
http://bjoernke.com

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

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10046
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Moving an SQL database to LiveCode

Post by FourthWorld » Sat Jan 29, 2011 2:11 am

Simon Knight wrote:I am interested in how Richard's schema operates with a non-IDE version of the code, for instance is it a case of using a compiled/built main splash stack and having all the other stacks including those holding data as substacks thus allowing the subs stacks to be updated by the running application?
Saving data in LiveCode standalones
by Sarah Reichelt
http://livecodejournal.com/tutorials/sa ... ution.html
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Simon Knight
Posts: 919
Joined: Wed Nov 04, 2009 11:41 am

Re: Moving an SQL database to LiveCode

Post by Simon Knight » Sat Jan 29, 2011 11:30 am

Many thanks for the tips and links.

Simon
best wishes
Skids

Post Reply