Btrieve 2
Loading...
Searching...
No Matches
bversion.py

This is an example of version use written in Python.

1import sys
2import struct
3import math
4import os
5import platform
6
7if (platform.system() == "Windows"):
8 sys.path.append("C:\\Program Files\\Actian\\Zen\\bin")
9else:
10 sys.path.append("/usr/local/actianzen/lib64")
11
12import btrievePython
13
14# If the incorrect number of arguments were given.
15if (len(sys.argv) != 2):
16 sys.exit("Usage: " + os.path.basename(sys.argv[0]) + " databaseURI")
17
18databaseURI = sys.argv[1]
19
20btrieveClient = btrievePython.BtrieveClient()
21assert(btrieveClient != None)
22
23
24rc = btrieveClient.Login(databaseURI)
25assert(rc == btrievePython.Btrieve.STATUS_CODE_NO_ERROR), "Error: BtrieveClient::Login():%d:%s.\n" % (rc, btrievePython.Btrieve_StatusCodeToString(rc))
26
27
28
29btrieveVersion = btrievePython.BtrieveVersion()
30assert(btrieveVersion != None)
31
32
33
34rc = btrieveClient.GetVersion(btrieveVersion)
35assert(rc == btrievePython.Btrieve.STATUS_CODE_NO_ERROR), "Error: BtrieveClient::GetVersion():%d:%s.\n" % (rc, btrievePython.Btrieve_StatusCodeToString(rc))
36
37
38
39rc = btrieveVersion.GetClientRevisionNumber()
40assert(rc >= 0), "Error: btrieveVersion::GetClientRevisionNumber():%d:%s.\n" % (rc, btrievePython.Btrieve_StatusCodeToString(btrieveVersion.GetLastStatusCode()))
41
42
43print("ClientRevisionNumber =", rc)
44
45
46rc = btrieveVersion.GetClientVersionNumber()
47assert(rc >= 0), "Error: btrieveVersion::GetClientVersionNumber():%d:%s.\n" % (rc, btrievePython.Btrieve_StatusCodeToString(btrieveVersion.GetLastStatusCode()))
48
49
50print("ClientVersionNumber =", rc)
51
52
53rc = btrieveVersion.GetClientVersionType()
54assert(rc != btrievePython.Btrieve.VERSION_TYPE_UNKNOWN), "Error: btrieveVersion::GetClientVersionType():%d:%s.\n" % (rc, btrievePython.Btrieve_StatusCodeToString(btrieveVersion.GetLastStatusCode()))
55
56print("ClientVersionType =", btrievePython.Btrieve_VersionTypeToString(rc))
57
58
59
60rc = btrieveVersion.GetLocalRevisionNumber()
61assert(rc >= 0), "Error: btrieveVersion::GetLocalRevisionNumber():%d:%s.\n" % (rc, btrievePython.Btrieve_StatusCodeToString(btrieveVersion.GetLastStatusCode()))
62
63
64print("LocalRevisionNumber =", rc)
65
66
67rc = btrieveVersion.GetLocalVersionNumber()
68assert(rc >= 0), "Error: btrieveVersion::GetLocalVersionNumber():%d:%s.\n" % (rc, btrievePython.Btrieve_StatusCodeToString(btrieveVersion.GetLastStatusCode()))
69
70
71print("LocalVersionNumber =", rc)
72
73
74rc = btrieveVersion.GetLocalVersionType()
75assert(rc != btrievePython.Btrieve.VERSION_TYPE_UNKNOWN), "Error: btrieveVersion::GetLocalVersionType():%d:%s.\n" % (rc, btrievePython.Btrieve_StatusCodeToString(btrieveVersion.GetLastStatusCode()))
76
77print("LocalVersionType =", btrievePython.Btrieve_VersionTypeToString(rc))
78
79
80
81rc = btrieveVersion.GetRemoteRevisionNumber()
82assert(rc >= 0), "Error: btrieveVersion::GetRemoteRevisionNumber():%d:%s.\n" % (rc, btrievePython.Btrieve_StatusCodeToString(btrieveVersion.GetLastStatusCode()))
83
84
85print("RemoteRevisionNumber =", rc)
86
87
88rc = btrieveVersion.GetRemoteVersionNumber()
89assert(rc >= 0), "Error: btrieveVersion::GetRemoteVersionNumber():%d:%s.\n" % (rc, btrievePython.Btrieve_StatusCodeToString(btrieveVersion.GetLastStatusCode()))
90
91
92print("RemoteVersionNumber =", rc)
93
94
95rc = btrieveVersion.GetRemoteVersionType()
96assert(rc != btrievePython.Btrieve.VERSION_TYPE_UNKNOWN), "Error: btrieveVersion::GetRemoteVersionType():%d:%s.\n" % (rc, btrievePython.Btrieve_StatusCodeToString(btrieveVersion.GetLastStatusCode()))
97
98print("RemoteVersionType =", btrievePython.Btrieve_VersionTypeToString(rc))
99
100
101
102rc = btrieveClient.Logout(databaseURI)
103assert(rc == btrievePython.Btrieve.STATUS_CODE_NO_ERROR), "Error: BtrieveClient::Logout():%d:%s.\n" % (rc, btrievePython.Btrieve_StatusCodeToString(rc))
104
105