Linking Database Query Host field to a variable
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Linking Database Query Host field to a variable
Does anyone know how to link the Host field in the Database Query builder to a variable?
I am using one database from different access points and I need a way to dynamically link the Host field to different IP addresses.
Say a global variable would be nice.
Does anyone know if this can be done? Can a variable be used for the Host field in the Database Query builder?
This seems like a requirement for applications which share a server in a local area network. Once a script is compiled how would you change the IP of your server?
I am using one database from different access points and I need a way to dynamically link the Host field to different IP addresses.
Say a global variable would be nice.
Does anyone know if this can be done? Can a variable be used for the Host field in the Database Query builder?
This seems like a requirement for applications which share a server in a local area network. Once a script is compiled how would you change the IP of your server?
Developing with Windows XP & Revolution 4.5
Post subject: Linking Database Query Host field to a variabl
The runrev user guide states that if no Host is supplied then the default is used.
How do I set the default?
I guess this is what I need to do.
How do I set the default?
I guess this is what I need to do.
Developing with Windows XP & Revolution 4.5
-
- VIP Livecode Opensource Backer
- Posts: 977
- Joined: Sat Apr 08, 2006 7:47 am
- Contact:
I'm afraid you can't use a variable for that; but thanks to some inner knowledge of how the automated database queries work, I think I have a workaround for you.
The tricky part is that the revDatabase frontscript will receive the preOpenStack event before you get a chance to change any of the settings, and try and open the database connection. Which means you have to change the settings during the startup event - which your stack will only receive when compiled into a standaloine application.
So you would add something like the following to your stack script:
Caveat: I didn't test this, but it should work. At least until the RunRev team changes the innards of the implementation...
Best of luck,
Jan Schenkel.
The tricky part is that the revDatabase frontscript will receive the preOpenStack event before you get a chance to change any of the settings, and try and open the database connection. Which means you have to change the settings during the startup event - which your stack will only receive when compiled into a standaloine application.
So you would add something like the following to your stack script:
Code: Select all
on startup
-- you may want to read it somewhere from a file
put "123.123.123.123" into tIPAddress
UpdateDBHost tIPAddress
pass startup
end startup
on UpdateDBHost pHost
put revQueryObjects(the longname of this stack) into tQueryObjects
repeat for each line tQueryObject in tQueryObjects
set the cREVDatabaseQuery["dbhost"] of tQueryObject to pHost
end repeat
end UpdateDBHost
Best of luck,
Jan Schenkel.
Quartam Reports & PDF Library for LiveCode
www.quartam.com
www.quartam.com
Janschenkel:
Thank you so much. This is exactly what I need.
I will test it and report back.
I did not know how to retrieve the properties of the Query Object to know what values to change. There are clues in the user guide but just clues only.
This is a real learning experience.
Thank you so much. This is exactly what I need.
I will test it and report back.
I did not know how to retrieve the properties of the Query Object to know what values to change. There are clues in the user guide but just clues only.
This is a real learning experience.
Developing with Windows XP & Revolution 4.5
-
- VIP Livecode Opensource Backer
- Posts: 977
- Joined: Sat Apr 08, 2006 7:47 am
- Contact:
The easiest way to get to the 'revDatabase' frontscript (which implements these automated queries) is:
HTH,
Jan Schenkel.
- Open the Message box
- Switch to the Front Scriptspanel - using the sixth button
- Tick the checkbox Show Revolution UI Front Scripts
- Doubleclick on the line revDatabase
Code: Select all
the cREVDatabaseQuery["dbdatabase"]
Jan Schenkel.
Quartam Reports & PDF Library for LiveCode
www.quartam.com
www.quartam.com
Jan:
Thank you again
This gives me the control over the database options which I needed.
What I have done is put together a logon script to multiple companies which require different database names and different hosts ip addresses dependent on the server used and the point from which it needs to be accessed. The companies have different database names with identical tables. So the same queries are designed to work with different databases ie different companies.
Without your help here there is no way I could have figured a way to incorporate the runrev queries. So this helps me tremendously.
Thank you again
This gives me the control over the database options which I needed.
What I have done is put together a logon script to multiple companies which require different database names and different hosts ip addresses dependent on the server used and the point from which it needs to be accessed. The companies have different database names with identical tables. So the same queries are designed to work with different databases ie different companies.
Without your help here there is no way I could have figured a way to incorporate the runrev queries. So this helps me tremendously.
Developing with Windows XP & Revolution 4.5