Page 1 of 1

texis properties defaults

Posted: Tue Mar 15, 2011 10:35 pm
by amitic
Is there a way to reset a texis property to it's default value?
Or maybe a way to query the currently set value?

Let's say, for example, I'd like to change the 'timezone' property temporarily and than reset it back to it's default (local) value - all within a single texis invocation (ie. inside a single vortex script).
Can this be done?

It appears that on windows "SET timezone = '';" or "SET timezone = null;" will reset the timezone property, but this does not work on linux installations.

Thanks

texis properties defaults

Posted: Wed Mar 16, 2011 7:32 am
by John
On Linux (and should work with Windows too) you could do:

<syscp getenv TZ>
<$OrigTimezone=$ret>
<syscp setenv TZ $NewTimezone>
...
<syscp setenv TZ $OrigTimezone>

texis properties defaults

Posted: Wed Mar 16, 2011 8:12 am
by amitic
Thank you, John.

This however only works on linux (at least it doesn't work on 5.01.1258488718/20091117 windows version).
I could combine the "set timezone" for windows and "syscp setenv" for linux after querying the current platform, but would still prefer a single approach that works on both platforms - if that is possible.

Regards

texis properties defaults

Posted: Wed Mar 16, 2011 10:33 am
by mark
Is you concern for resetting the value withing a single invocation or are you worried that the settings will stick across invocations such that one run will affect the next? The latter will not happen. Each run starts with default settings regardless of set commands issued by previous runs.

texis properties defaults

Posted: Wed Mar 16, 2011 12:12 pm
by amitic
I am aware that these settings are only in effect 'within' the single texis process instance.
What I need is to create a vortex function that doesn't alter the texis/vortex context of the caller in any way. Thus, I need to reset every change I make.

In this case (the timezone property) reseting it to it's default value (which is effectively the local system time zone) will suffice, although it would generally be nice to have the means of querying the value of a property before it's change and reseting it to this value at the end.

Regards

texis properties defaults

Posted: Thu Mar 17, 2011 9:37 am
by John
You should be able to use the set timezone= instead of setenv on both:

<syscp getenv TZ>
<$OrigTimezone=$ret>
<sql "set timezone=$NewTimezone"></sql>
...

<sql "set timezone=$OrigTimezone"></sql>