Пример #1
0
#
#         http://www.apache.org/licenses/LICENSE-2.0.txt
#
#  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 Set and Get methods
#

db = GTM()

globalName = "^Capital"
setValue = "London"

db.set( globalName, setValue )

getValue = db.get( globalName )

print globalName, " = ", getValue

Пример #2
0
# 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")
Пример #3
0
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")')
Пример #4
0
#  Copyright OSEHRA
#
#  Licensed under the Apache License, Version 2.0 (the "License");
#  you may not use this file except in compliance with the License.
#  You may obtain a copy of the License at
#
#         http://www.apache.org/licenses/LICENSE-2.0.txt
#
#  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 Set and Get methods
#

db = GTM()

db.set("^Capital", "London")

capital = db.get("^Capital")

print "Capital = ", capital
Пример #5
0
#
#         http://www.apache.org/licenses/LICENSE-2.0.txt
#
#  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 Set, Get and Kill methods
#

db = GTM()

globalName = "^Capital"
setValue = "London"

db.set(globalName, setValue)

getValue = db.get(globalName)

print globalName, " = ", getValue

db.kill(globalName)
Пример #6
0
# 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")

Пример #7
0
#  Licensed under the Apache License, Version 2.0 (the "License");
#  you may not use this file except in compliance with the License.
#  You may obtain a copy of the License at
#
#         http://www.apache.org/licenses/LICENSE-2.0.txt
#
#  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 Set and Get methods
#

db = GTM()

db.set("^Capital","London")

capital = db.get("^Capital")

print "Capital = ", capital