Normal Topic Sesame version check using Client/Server mode (Read 984 times)
SesameNubi
Member
*
Offline



Posts: 2
Joined: Jul 1st, 2011
Sesame version check using Client/Server mode
Jul 1st, 2011 at 7:24pm
Print Post Print Post  
Hello All - I am new to Sesame and to the user forum.

We are using Sesame in a Client/Server mode on Sesame 2.5.
I am looking for a way in the application to validate the Client version of Sesame that is being used aginst the Server version of Sesame that is being used.
I see that there is a @ReleaseVersion function that can be called to return the Sesame release version.  Is there a way to use this or some similar function call to check both the Client instance and Server instance during runtime?
The previous developer here set up environment variables on the server and on the client side (via an install script) and is using @GetLocalEnvVar and @GetServerEnvVar to compare the client to the server.  This approach has the pitfall of assuming the environment variable being used actually contains the correct version number to match the currently running executable.  Not good enough for my comfort level.
All suggestions would be welcome - Thanks! Huh
  
Back to top
 
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: Sesame version check using Client/Server mode
Reply #1 - Jul 1st, 2011 at 8:41pm
Print Post Print Post  
OK, this is tricksy, but I figured out a way to do this. To get the version of the server using @ReleaseVersion, you have to get the code to run server-side, instead of client-side. There is a command called @XResultSetRunProgram that will force a code snippet to run server-side. Here is an example that works on the sample Customers database.

Code
Select All
#include "sbasic_include.sbas"

var vClientVersion as String
var vRS as Int
var vPgm as String
var vServerVersion as String

	vClientVersion = @ReleaseVersion()
	vPgm = "WriteLn(@ReleaseVersion())"
	vRS = @XResultSetSearch(@FN, "Customers", SEARCH_MODE_AND,SEARCH_SYNTAX_QA, "!Key=1000")
	If vRS > -1
	{
		vServerVersion = @XResultSetRunProgram(vRS, "", vPgm, 0)
		WriteLn(vServerVersion)   // You can compare this to vClientVersion instead of displaying it with WriteLn
		XResultSetClose(vRS)
	}
 



Make sure you structure your XResultSetSearch to retrieve one and only one record. It doesn't matter what record, just as long as you only have one.

Edited:
Note: I added an XResultSetClose to the code. Very important!
« Last Edit: Jul 5th, 2011 at 9:58pm by Hammer »  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged