1. Chris Zakrewsky
  2. Valentina Database ADK
  3. Thursday, June 29 2017, 10:45 AM
  4.  Subscribe via email
The ADK is superb working oblivious the VServer native OS and allowing among other things remote administration.
However there is a catch: when defining scheduled events, for example like making daily backups there is often necessary to provide the destination path (if not default) for the backup file in the stored procedure.

This is where angels stop singing.

If the remote VServer is on Windows, the path goes like C:\users\chris\documents...
If the remote VServer is on Linux, the path goes like /home/chris/Documents...

How to tell from the client side what OS the server is running on?

What I do now is to misuse the INI file at the installation time and piggyback this info there:


; Optional but very recommended to specify.
Crash_Reporter_Owner_Name=Chris_Whatever (Linux)


And then in my client code harvest this tidbit:


char * getServerOS
( /* <= "", "Windows", "Linux", "Mac" */
VConnection dbConnectionP,
VDatabase dbP
)
{
static char buf[256];/* <> in: variable name, out: variable value */

strcpy ( buf, "Crash_Reporter_Owner_Name" );
if ( nomadicApi_getServerVariable ( dbConnectionP, NULL, buf ) )
{
char *c1P = strchr ( buf, '(' );
char *c2P = strrchr ( buf, ')' );

if ( c1P && c2P && c1P < c2P )
{
*c2P = '\0';

return ( c1P + 1 );
}
}

return ( "" );
}


It's an ugly hack, I know.
But is there a better way to inform the client about the remote VServer platform?

Best!
/Chris
Comment
There are no comments made yet.
Chris Zakrewsky Accepted Answer
Forgot to add code for the function called above:


char * nomadicApi_getServerVariable
( /* <= value or NULL */
VConnection dbConnectionP,
VDatabase dbP,
char variableBuf[256] /* <> in: variable name, out: variable value */
)
{
if ( NULL == variableBuf )
{
return ( NULL );
}
else if ( NULL == dbConnectionP
&& NULL == dbP )
{
return ( NULL );
}
else if ( NULL == dbConnectionP )
{
dbConnectionP = Database_GetConnection ( dbP );
}

variableBuf[255] = '\0';

VServer dbServerP = Server_New ( dbConnectionP );
if ( dbServerP )
{
char *valueStrP = Server_GetVariable ( dbServerP, variableBuf );
if ( valueStrP )
{
strncpy ( variableBuf, valueStrP, 255 );

return ( variableBuf );
}
}

return ( NULL );
}


Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Database ADK
  3. # 1
Ruslan Zasukhin Accepted Answer
Hi Chris,

we will check. I have drop question to our vstudio team.
I do not remember if vstudio shows the vserver OS.

If not, we can easy add such function also next week.
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Database ADK
  3. # 2
Chris Zakrewsky Accepted Answer
Just a confirmation from my side of the trenches: it works very well!
Thank you again!

/Chris

PS:
The PROPERTY OS and OS_TYPE probably also need to be documented here:
http://www.valentina-db.com/docs/dokuwiki/v7/doku.php?id=valentina:vcomponents:vsql:reference:properties:server_props
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Database ADK
  3. # 3
Chris Zakrewsky Accepted Answer
PROPERTY OS_TYPE seems to be missing in v8?

Cheers,
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Database ADK
  3. # 4
Chris Zakrewsky Accepted Answer
I noted this in v8.3 actually, due to spam it creates in vlog ("ERROR 0x22023: Invalid parameter value";).
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Database ADK
  3. # 5
Sergey Pashkov Accepted Answer
Hi Chris,

Yes, the OS_TYPE was renamed to OS_ARCH

So to get the OS you can use
GET PROPERTY OS OF SERVER;

And the 32/64-bit architecture:
GET PROPERTY OS_ARCH OF SERVER;
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Database ADK
  3. # 6
Chris Zakrewsky Accepted Answer
I believe you need to ping about this change the VStudio team as well ;)
Attachments (1)
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Database ADK
  3. # 7
Ruslan Zasukhin Accepted Answer
I think fixed in 8.3.2
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Database ADK
  3. # 8
  • Page :
  • 1


There are no replies made for this post yet.
However, you are not allowed to reply to this post.