Can you update a database on closeStack ?

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
shawnblc
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 342
Joined: Fri Jun 01, 2012 11:11 pm

Can you update a database on closeStack ?

Post by shawnblc » Tue Oct 15, 2013 3:02 am

I've been trying to update a MySQL database on closeStack, not having much success. Can this be done or does it have to be done prior?

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

Re: Can you update a database on closeStack ?

Post by Simon » Tue Oct 15, 2013 3:22 am

Here is a test for you to try
on closeStack
answer the revOpenDatabases() --should not be empty

Or you can move the save further up the chain to:
on closeStackRequest

I don't have an example that I have done which proves either.

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

shawnblc
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 342
Joined: Fri Jun 01, 2012 11:11 pm

Re: Can you update a database on closeStack ?

Post by shawnblc » Tue Oct 15, 2013 3:30 am

Simon wrote:Here is a test for you to try
on closeStack
answer the revOpenDatabases() --should not be empty

Or you can move the save further up the chain to:
on closeStackRequest

I don't have an example that I have done which proves either.

Simon

on closeStack I get this (see image). Let me try the other now.

shawnblc
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 342
Joined: Fri Jun 01, 2012 11:11 pm

Re: Can you update a database on closeStack ?

Post by shawnblc » Tue Oct 15, 2013 3:40 am

Hmmmm. I'll stay up until I figure this out. lol.

on closeStack and on closeStackRequest I can't get my database to update. onMouseUp I can update it, but I don't want a mouseUp, I need to update it on close too.

shawnblc
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 342
Joined: Fri Jun 01, 2012 11:11 pm

Re: Can you update a database on closeStack ?

Post by shawnblc » Tue Oct 15, 2013 3:51 am

Got it! Thank you Simon!

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

Re: Can you update a database on closeStack ?

Post by Simon » Tue Oct 15, 2013 4:48 am

Hi shawnblc,
Can you say what was the solution?

And Holy Cow! That is a lot of open databases :)

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

shawnblc
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 342
Joined: Fri Jun 01, 2012 11:11 pm

Re: Can you update a database on closeStack ?

Post by shawnblc » Tue Oct 15, 2013 5:54 am

Simon wrote:Hi shawnblc,
Can you say what was the solution?

And Holy Cow! That is a lot of open databases :)

Simon
It's the same database, the same stack has been opening the database while I try and learn this. I haven't closed the connection, which I will do.
I'll post solution that I came up with in next post and will update the previous post after I close my db connection.

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

Re: Can you update a database on closeStack ?

Post by Simon » Tue Oct 15, 2013 6:01 am

Thanks shawnblc, at least I will learn from your discovery.

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

shawnblc
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 342
Joined: Fri Jun 01, 2012 11:11 pm

Re: Can you update a database on closeStack ?

Post by shawnblc » Tue Oct 15, 2013 6:14 am

Simon wrote:Hi shawnblc,
......
And Holy Cow! That is a lot of open databases :)

Simon
Only one database open now :P

shawnblc
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 342
Joined: Fri Jun 01, 2012 11:11 pm

Re: Can you update a database on closeStack ?

Post by shawnblc » Tue Oct 15, 2013 6:23 am

Simon wrote:Hi shawnblc,
Can you say what was the solution?

...

Simon

I used closeStackRequest with an update to my database, then revExecuteSQL, showed an answer tSQL to make sure my SQL query was right. It looked good so I commented it out. I also used on closeStack. I used your suggestion :) Worked like a charm.

I did a lot of learning today. Thanks to you (Simon) and Bangkok on an earlier post I had today. Maybe one day I'll be able to say I was a noob ;) Thanks to both of you.

Post Reply