1. Chris Zakrewsky
  2. Valentina Database ADK
  3. Donnerstag, Juni 29 2017, 10:45 AM
  4.  Abonnieren via E-Mail
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
Kommentar
There are no comments made yet.
Chris Zakrewsky Akzeptierte Antwort
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 );
}


Kommentar
There are no comments made yet.
Ruslan Zasukhin Akzeptierte Antwort
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.
Kommentar
There are no comments made yet.
Chris Zakrewsky Akzeptierte Antwort
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
Kommentar
There are no comments made yet.
Chris Zakrewsky Akzeptierte Antwort
PROPERTY OS_TYPE seems to be missing in v8?

Cheers,
Kommentar
There are no comments made yet.
Chris Zakrewsky Akzeptierte Antwort
I noted this in v8.3 actually, due to spam it creates in vlog ("ERROR 0x22023: Invalid parameter value";).
Kommentar
There are no comments made yet.
Sergey Pashkov Akzeptierte Antwort
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;
Kommentar
There are no comments made yet.
Chris Zakrewsky Akzeptierte Antwort
I believe you need to ping about this change the VStudio team as well ;)
Anhänge
Kommentar
There are no comments made yet.
Ruslan Zasukhin Akzeptierte Antwort
I think fixed in 8.3.2
Kommentar
There are no comments made yet.
  • Seite :
  • 1


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