Save main stack SQLite

Deploying to Windows? Utilizing VB Script execution? This is the place to ask Windows-specific questions.

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller

Post Reply
SkinnyKenny
Posts: 28
Joined: Fri Jan 24, 2020 6:44 am

Save main stack SQLite

Post by SkinnyKenny » Fri Feb 21, 2020 10:38 am

Hello all...I was wondering if it was possible to save the current state of a main stack into a "Blob" container using SQLite. What I am trying to accomplish is keeping the data up to date in my main stack when multiple users across multiple user profiles on Windows are accessing the program. I assume that as long as I create a database and save it to the shared resources folder that all users access, the main stack can be updated periodically. I saw a lesson where you upload the raw LC main stack file to a server and have it open when a user navigates to that stack. Is this something I should be thinking of doing or is there a better way to save data between sessions so that all users have the most up to date data in the main stack?

bogs
Posts: 5098
Joined: Sat Feb 25, 2017 10:45 pm

Re: Save main stack SQLite

Post by bogs » Fri Feb 21, 2020 11:45 am

I'm not sure I understand the question fully, so pardon my ignorance.

While a blob in sqlite is generally there for storage of binary data, sqlite itself is a single user accessed db, normally used for local storage. Right off the top, that would prevent multiple users from doing anything with (a single instance of) it. Maybe you were thinking of a different db type?
SkinnyKenny wrote:
Fri Feb 21, 2020 10:38 am
I saw a lesson where you upload the raw LC main stack file to a server and have it open when a user navigates to that stack. Is this something I should be thinking of doing or is there a better way to save data between sessions so that all users have the most up to date data in the main stack?
This is more along the lines of what I would think would work, using something like ~

Code: Select all

go url "http://mySpiffyStack"
which would load that stack for the user(s) when they open your standalone calling it.

Some thing to keep in mind, though, that stack is going to load as opened at the time the user opens it and will *not* reflect changes made by other users while it is open.

In other words, if you have a field in the stack that a user can update that holds, oh, a custom property let's say, that is updated locally on that users machine, not on the stack on the server.

If you have a text file that is updated, it *can* be updated on the server and distributed throughout all open instances with proper coding, but your looking at making sure changes aren't committed simultaneously.

If I missed what your attempting completely, please feel free to chime back in with a clearer description of what you want to try :D
Image

SkinnyKenny
Posts: 28
Joined: Fri Jan 24, 2020 6:44 am

Re: Save main stack SQLite

Post by SkinnyKenny » Fri Feb 21, 2020 12:12 pm

Thank you for your response. I guess what I am getting at is this... I am having a hard time understanding how the .exe is shared on a PC when there are multiple user profiles on a single PC. So lets say I make a simple program that is installed on my PC under my profile. The PC has 3 other user profiles that others use. If I install the .exe, how do others access the program and use it? Do they need to install the program as well? I need the data to persist between sessions when the other users access the program. I assume in order to update the program with the most current changes, the stacks need to be updated from a .txt file or database file giving the program the most up to date changes that were made the last time it was used.

Another example is: I have 2 datagrids that are kept up to date by saving the databases to:

"put specialFolderPath("0x0023") & "/medAdminDB.sqlite" into tDatabasePath_med"

The ("0x0023") is the shared resource folder that all user profiles can access and save to. When the datagrids are opened, the database is queried and the datagrids are updated to reflect any changes made to it. This keeps the datagrids current. So, I have another stack with fields and buttons that I would like to keep current as well. THIS is where I am confused. How do I make sure that no matter who uses the program (user profiles), the fields and buttons keep their same state as when it was last used. Do I need to store a file in the shared user folder that updates the stack when opened, whoever uses the program?

I'm sorry if I am not making any sense. Thanks in advance.

Klaus
Posts: 12204
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Save main stack SQLite

Post by Klaus » Fri Feb 21, 2020 12:38 pm

Hi Kenny,
I assume in order to update the program with the most current changes, the stacks need to be updated from a .txt file or database file giving the program the most up to date changes that were made the last time it was used.
yes, since runtimes cannot save themselfes, this is the only way to go!
So, I have another stack with fields and buttons that I would like to keep current as well. THIS is where I am confused. How do I make sure that no matter who uses the program (user profiles), the fields and buttons keep their same state as when it was last used. Do I need to store a file in the shared user folder that updates the stack when opened, whoever uses the program?
Sorry, not sure I understand what you are trying to do...


Best

Klaus

Klaus
Posts: 12204
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Save main stack SQLite

Post by Klaus » Fri Feb 21, 2020 12:45 pm

Maybe you want your runtime to behave like in the IDE?
User changes whatever in the stack and you want to "save" this state between sessions?
And for each user separately?

SkinnyKenny
Posts: 28
Joined: Fri Jan 24, 2020 6:44 am

Re: Save main stack SQLite

Post by SkinnyKenny » Fri Feb 21, 2020 1:13 pm

Well, I would like for anyone who uses the program on a single PC to be able to have the most current updated stacks ie (fields, buttons etc).

So, this is a work program that multiple users will be using. Each person has a profile set up on this PC. When user 1 opens the program and makes changes, it needs to save just as it is so if the next user opens the program, it opens as it was left from the last user. This why I assume there needs to be some sort of custom property/txt file that saves periodically so no matter which person/profile opens the program, it updates the stack to when it was last used.

If this program was to be used only on one profile, I could just save it as a raw LC file and create a "load" screen standalone and open the ".livecode file. This would save my changes from session to session. But, since multiple users are going to be using the program, I need to have a way to update the stacks with the most current state. I know this is confusing to you all, and I am trying to explain it the best I know how. If you don't understand what I am getting at, I understand.

Klaus
Posts: 12204
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Save main stack SQLite

Post by Klaus » Fri Feb 21, 2020 1:25 pm

I know this is confusing to you all, and I am trying to explain it the best I know how. If you don't understand what I am getting at, I understand.
It is and thank you! :-D

OK, do these multiple users use that namely stack at the same time of one after another?

If the latter, which I presume, you could create the SPLASH screen runtime and save the stack in -> specialfolderpath(35)
which is the same as -> specialfolderpath(26) = specialFolderPath("0x0023") but for ALL users.

This way one user can save that stack and the next user will then open that up-to-date stack.

Hope I understood what you are trying to do! :-D

SkinnyKenny
Posts: 28
Joined: Fri Jan 24, 2020 6:44 am

Re: Save main stack SQLite

Post by SkinnyKenny » Fri Feb 21, 2020 1:28 pm

That's EXACTLY what I was looking for! Phew! Thank you very much!

And yes, the users would be accessing the program one after another....I was thinking that I could maybe save the stack (.livecode) in the shared user folder but I wasn't sure if that was how it worked. I am going to try it now!

Post Reply

Return to “Windows”