This may seem like and odd question, but i am trying to adapt my source code to work in two deployment modes:
- As a servoy client solution run from the server
- As an offline version.
In order to synchronies records i am using a second instance of the database as a local sybase version when in the offline developer version, and also have defined my remote mysql database.
I was developing two solutions and keeping them pretty much in parallel, but i am now trying to merge them into one which has the sync stuff only showing when in developer mode (using the application type that works fine).
What i need to do is make sure that someone actually doing development doesn’t actually do a sync function and then start to add new records to the same database.
Therefore if i could check to see that a database is Sybase or Mysql then i could prevent any nasty syncronisations happening by mistake when developing?
Other method would be to query whether the solution is in “Offline” mode? i.e designer.enabled=false.
So if the first question is not possible is there anyway i can check for the second?
Thanks
David
For the problem you describe, I would feel much more comfortable allowing the database to identify itself. Have a “preferences” table with one record and a “mode” column, and initialize the value in the actual database to differentiate.
My $0.02.
greg.
There are a lot of clever people in this forum!
That will certainly work, as i can hard code that in my offline version of developer and then it into a global on startup. I can then use that to fork between scripts, buttons etc.
Thanks Greg. Good solution
David
Maybe GetDatabaseProductName can do the trick?
Thanks Ric,
Thats also cool. Having implemented Gregs Solution, I have added this as a double jeopardy check on startup.
The potential fairly catastrophic issue being that in served solution mode i have two databases servers which refer to the same database in my solution. Obviously the one i call _remote is not used on my live solution.
On my offline one then one is a local Sybase copy of the database, the other is the live Mysql one.
If i accidentally do some sync scripts on the live solution then that will be quite messy!
This is working quite nicely now in that all i have to do to update my local copy is to remimport it into my servoy local version that contains the mirrored database framework in sybase. Previously i was updating two solutions in parallel!
thanks
David