if __name__ == "__main__": #Get the call in table file if 'gtm_access_ci' not in os.environ: print "Please set environment variable gtm_access_ci to the location of gtm_access.ci" exit(0) if not os.path.exists(os.environ['gtm_access_ci']): print "Error: {0} does not exist".format(os.environ['gtm_access_ci']) exit(0) os.environ['GTMCI'] = os.environ['gtm_access_ci'] #Change working folder to database location if 'gtm_data_dir' not in os.environ: print "Please set environment variable gtm_data_dir to the data folder" if not os.path.exists(os.environ['gtm_data_dir']): print "Error: {0} does not exist".format(os.environ['gtm_data_dir']) exit(0) os.chdir(os.environ['gtm_data_dir']) db = GTM() print "Enter email" username = raw_input() print "Enter password" password = raw_input() db.execute('d loginLowLevel^user("{0}","{1}")'.format(username, password)) print "authenticated=", db.get('%sess("authenticated")') print "uid=", db.get('%sess("uid")')
# load gtm module from gtm import GTM db = GTM() print db.about() print db.version() getValue = "Initially empty" for k in xrange(1, 1000): db.set("^FibonacciA", "1") db.set("^FibonacciB", "1") termnumber = 100 for i in xrange(1, termnumber): db.execute("set ^FibonacciValue=^FibonacciA+^FibonacciB") db.execute("set ^FibonacciB=^FibonacciA") db.execute("set ^FibonacciA=^FibonacciValue") getValue = db.get("^FibonacciValue") print 'Fibonacci term ', termnumber, ' = ', getValue db.kill("^FibonacciA") db.kill("^FibonacciB") db.kill("^FibonacciValue")
# See the License for the specific language governing permissions and # limitations under the License. # #=========================================================================*/ # load gtm module from gtm import GTM # # Test the Execute method # db = GTM() # # Exercise the string API # textOfCode = 'write $ZVERSION,!' db.execute( textOfCode ) # # Exercise the same pattern with direct strings # db.execute( 'write $ZVERSION,!')
# Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # #=========================================================================*/ # load gtm module from gtm import GTM # # Test the Execute method # db = GTM() # # Exercise the string API # textOfCode = 'write $ZVERSION,!' db.execute(textOfCode) # # Exercise the same pattern with direct strings # db.execute('write $ZVERSION,!')
# load gtm module from gtm import GTM db = GTM() print db.about() print db.version() getValue = "Initially empty" for k in xrange(1,1000): db.set("^FibonacciA", "1") db.set("^FibonacciB", "1") termnumber = 100 for i in xrange(1,termnumber): db.execute("set ^FibonacciValue=^FibonacciA+^FibonacciB") db.execute("set ^FibonacciB=^FibonacciA") db.execute("set ^FibonacciA=^FibonacciValue") getValue = db.get("^FibonacciValue") print 'Fibonacci term ', termnumber, ' = ', getValue db.kill("^FibonacciA") db.kill("^FibonacciB") db.kill("^FibonacciValue")
# #=========================================================================*/ # load gtm module from gtm import GTM # # Test the Lock method # db = GTM() globalName = "^ValueCounter" setValue = "0" getValue = "Initially empty" db.lock( globalName ) db.set( globalName, setValue ) for i in xrange(0,9): db.execute("set ^ValueCounter=^ValueCounter+1") getValue = db.get( globalName ) print "counter = ", getValue print "Final Counter Value = ", getValue db.kill( "^ValueCounter" )
# See the License for the specific language governing permissions and # limitations under the License. # #=========================================================================*/ # load gtm module from gtm import GTM # # Test the Lock method # db = GTM() globalName = "^ValueCounter" setValue = "0" getValue = "Initially empty" db.lock(globalName) db.set(globalName, setValue) for i in xrange(0, 9): db.execute("set ^ValueCounter=^ValueCounter+1") getValue = db.get(globalName) print "counter = ", getValue print "Final Counter Value = ", getValue db.kill("^ValueCounter")