sqlalchemy-iris 0.5.0b3__py3-none-any.whl → 0.6.0b1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- intersystems_iris/_BufferReader.py +10 -0
- intersystems_iris/_BufferWriter.py +32 -0
- intersystems_iris/_ConnectionInformation.py +54 -0
- intersystems_iris/_ConnectionParameters.py +18 -0
- intersystems_iris/_Constant.py +38 -0
- intersystems_iris/_DBList.py +499 -0
- intersystems_iris/_Device.py +69 -0
- intersystems_iris/_GatewayContext.py +25 -0
- intersystems_iris/_GatewayException.py +4 -0
- intersystems_iris/_GatewayUtility.py +74 -0
- intersystems_iris/_IRIS.py +1294 -0
- intersystems_iris/_IRISConnection.py +516 -0
- intersystems_iris/_IRISEmbedded.py +85 -0
- intersystems_iris/_IRISGlobalNode.py +273 -0
- intersystems_iris/_IRISGlobalNodeView.py +25 -0
- intersystems_iris/_IRISIterator.py +143 -0
- intersystems_iris/_IRISList.py +360 -0
- intersystems_iris/_IRISNative.py +208 -0
- intersystems_iris/_IRISOREF.py +4 -0
- intersystems_iris/_IRISObject.py +424 -0
- intersystems_iris/_IRISReference.py +133 -0
- intersystems_iris/_InStream.py +149 -0
- intersystems_iris/_LegacyIterator.py +135 -0
- intersystems_iris/_ListItem.py +15 -0
- intersystems_iris/_ListReader.py +84 -0
- intersystems_iris/_ListWriter.py +157 -0
- intersystems_iris/_LogFileStream.py +115 -0
- intersystems_iris/_MessageHeader.py +51 -0
- intersystems_iris/_OutStream.py +25 -0
- intersystems_iris/_PrintStream.py +65 -0
- intersystems_iris/_PythonGateway.py +850 -0
- intersystems_iris/_SharedMemorySocket.py +87 -0
- intersystems_iris/__init__.py +79 -0
- intersystems_iris/__main__.py +7 -0
- intersystems_iris/dbapi/_Column.py +56 -0
- intersystems_iris/dbapi/_DBAPI.py +2295 -0
- intersystems_iris/dbapi/_Descriptor.py +46 -0
- intersystems_iris/dbapi/_IRISStream.py +63 -0
- intersystems_iris/dbapi/_Message.py +158 -0
- intersystems_iris/dbapi/_Parameter.py +138 -0
- intersystems_iris/dbapi/_ParameterCollection.py +133 -0
- intersystems_iris/dbapi/_ResultSetRow.py +314 -0
- intersystems_iris/dbapi/_SQLType.py +32 -0
- intersystems_iris/dbapi/__init__.py +0 -0
- intersystems_iris/dbapi/preparser/_PreParser.py +1658 -0
- intersystems_iris/dbapi/preparser/_Scanner.py +391 -0
- intersystems_iris/dbapi/preparser/_Token.py +81 -0
- intersystems_iris/dbapi/preparser/_TokenList.py +251 -0
- intersystems_iris/dbapi/preparser/__init__.py +0 -0
- intersystems_iris/pex/_BusinessHost.py +101 -0
- intersystems_iris/pex/_BusinessOperation.py +105 -0
- intersystems_iris/pex/_BusinessProcess.py +214 -0
- intersystems_iris/pex/_BusinessService.py +95 -0
- intersystems_iris/pex/_Common.py +228 -0
- intersystems_iris/pex/_Director.py +24 -0
- intersystems_iris/pex/_IRISBusinessOperation.py +5 -0
- intersystems_iris/pex/_IRISBusinessService.py +18 -0
- intersystems_iris/pex/_IRISInboundAdapter.py +5 -0
- intersystems_iris/pex/_IRISOutboundAdapter.py +17 -0
- intersystems_iris/pex/_InboundAdapter.py +57 -0
- intersystems_iris/pex/_Message.py +6 -0
- intersystems_iris/pex/_OutboundAdapter.py +46 -0
- intersystems_iris/pex/__init__.py +25 -0
- iris/__init__.py +25 -0
- iris/iris_site.py +13 -0
- iris/irisbuiltins.py +97 -0
- iris/irisloader.py +199 -0
- irisnative/_IRISNative.py +9 -0
- irisnative/__init__.py +10 -0
- {sqlalchemy_iris-0.5.0b3.dist-info → sqlalchemy_iris-0.6.0b1.dist-info}/METADATA +1 -1
- sqlalchemy_iris-0.6.0b1.dist-info/RECORD +83 -0
- sqlalchemy_iris-0.6.0b1.dist-info/top_level.txt +4 -0
- sqlalchemy_iris-0.5.0b3.dist-info/RECORD +0 -14
- sqlalchemy_iris-0.5.0b3.dist-info/top_level.txt +0 -1
- {sqlalchemy_iris-0.5.0b3.dist-info → sqlalchemy_iris-0.6.0b1.dist-info}/LICENSE +0 -0
- {sqlalchemy_iris-0.5.0b3.dist-info → sqlalchemy_iris-0.6.0b1.dist-info}/WHEEL +0 -0
- {sqlalchemy_iris-0.5.0b3.dist-info → sqlalchemy_iris-0.6.0b1.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1,1294 @@
|
|
1
|
+
import decimal
|
2
|
+
import math
|
3
|
+
import intersystems_iris._InStream
|
4
|
+
import intersystems_iris._IRISOREF
|
5
|
+
import intersystems_iris._PythonGateway
|
6
|
+
import intersystems_iris._IRISGlobalNode
|
7
|
+
import intersystems_iris._IRISIterator
|
8
|
+
import intersystems_iris._IRISList
|
9
|
+
import intersystems_iris._IRISObject
|
10
|
+
import intersystems_iris._IRISReference
|
11
|
+
import intersystems_iris._LegacyIterator
|
12
|
+
|
13
|
+
class _IRIS(object):
|
14
|
+
'''
|
15
|
+
A way to execute basic ObjectScript commands on an IRIS server.
|
16
|
+
|
17
|
+
This class has methods to work with globals and to call class methods and routines. Any errors on the server generate Runtime Errors.
|
18
|
+
'''
|
19
|
+
|
20
|
+
# sysio function codes
|
21
|
+
GET_NODE = 1
|
22
|
+
SET_NODE = 2
|
23
|
+
KILL_NODE = 3
|
24
|
+
ORDER = 5
|
25
|
+
INCREMENT = 6
|
26
|
+
VALUE_FUNCTION = 8
|
27
|
+
DATA = 9
|
28
|
+
GET_SUBNODES = 10
|
29
|
+
VALUE_CLASSMETHOD = 11
|
30
|
+
VOID_CLASSMETHOD = 12
|
31
|
+
VOID_ROUTINE = 13
|
32
|
+
LOCK = 14
|
33
|
+
UNLOCK = 15
|
34
|
+
UNLOCK_ALL = 16
|
35
|
+
TSTART = 17
|
36
|
+
TCOMMIT = 18
|
37
|
+
TROLLBACK = 19
|
38
|
+
TROLLBACK_ONE = 20
|
39
|
+
GET_TLEVEL = 21
|
40
|
+
VOID_PROCEDURE = 26
|
41
|
+
VALUE_METHOD = 27
|
42
|
+
VOID_METHOD = 28
|
43
|
+
GET_PROPERTY = 29
|
44
|
+
SET_PROPERTY = 30
|
45
|
+
# sysio flags
|
46
|
+
FLAG_EMPTY = 0
|
47
|
+
FLAG_VALUE = 1
|
48
|
+
FLAG_SUBSCRIPT = 2
|
49
|
+
FLAG_REVERSE = 4
|
50
|
+
FLAG_STOPON = 8
|
51
|
+
# error code
|
52
|
+
ERROR_UNDEFINED = 1009;
|
53
|
+
# data conversion mode
|
54
|
+
MODE_RUNTIME = 0
|
55
|
+
MODE_GLOBAL = 1
|
56
|
+
MODE_LIST = 2
|
57
|
+
|
58
|
+
def __init__(self, connection):
|
59
|
+
if connection == None or connection.isClosed():
|
60
|
+
raise ValueError("cannot create an IRIS object with a closed connection")
|
61
|
+
self._connection = connection
|
62
|
+
self._is_unicode = connection._connection_info._is_unicode
|
63
|
+
self._locale = connection._connection_info._locale
|
64
|
+
self._in_message = intersystems_iris._InStream._InStream(connection)
|
65
|
+
self._out_message = intersystems_iris._OutStream._OutStream(connection)
|
66
|
+
self._in_message_secondary = intersystems_iris._InStream._InStream(connection)
|
67
|
+
self._out_message_secondary = intersystems_iris._OutStream._OutStream(connection)
|
68
|
+
|
69
|
+
def close(self):
|
70
|
+
pass
|
71
|
+
|
72
|
+
def getAPIVersion(self):
|
73
|
+
'''
|
74
|
+
Returns the version string of the IRIS Native API.
|
75
|
+
|
76
|
+
getAPIVersion()
|
77
|
+
|
78
|
+
Return Value
|
79
|
+
------------
|
80
|
+
Returns the API version string
|
81
|
+
'''
|
82
|
+
return "2.0.0"
|
83
|
+
|
84
|
+
def getServerVersion(self):
|
85
|
+
'''
|
86
|
+
Returns the version string of the IRIS server.
|
87
|
+
|
88
|
+
getServerVersion()
|
89
|
+
|
90
|
+
Return Value
|
91
|
+
------------
|
92
|
+
Returns the server version string
|
93
|
+
'''
|
94
|
+
return self.classMethodString("%SYSTEM.Version","GetVersion")
|
95
|
+
|
96
|
+
def get(self, globalName, *subscripts):
|
97
|
+
'''
|
98
|
+
Fetches the value of a global node.
|
99
|
+
|
100
|
+
get(globalName, subscripts...)
|
101
|
+
|
102
|
+
Parameters
|
103
|
+
----------
|
104
|
+
globalName : global node name.
|
105
|
+
subscripts... : global subscripts, optional, variable length.
|
106
|
+
|
107
|
+
Return Value
|
108
|
+
------------
|
109
|
+
Returns None if the node is undefined; otherwise, returns bytes, Decimal, float, int, or str.
|
110
|
+
'''
|
111
|
+
return self._execute(object, intersystems_iris.IRIS.GET_NODE, globalName, None, subscripts, mode = intersystems_iris.IRIS.MODE_GLOBAL)
|
112
|
+
|
113
|
+
def getObject(self, globalName, *subscripts):
|
114
|
+
'''
|
115
|
+
Fetches the value of a global node.
|
116
|
+
|
117
|
+
getObject(globalName, subscripts...)
|
118
|
+
|
119
|
+
Parameters
|
120
|
+
----------
|
121
|
+
globalName : global node name.
|
122
|
+
subscripts... : global subscripts, optional, variable length.
|
123
|
+
|
124
|
+
Return Value
|
125
|
+
------------
|
126
|
+
Returns None if the node is undefined; otherwise, returns bytes, Decimal, float, int, or str.
|
127
|
+
'''
|
128
|
+
return self._execute(object, intersystems_iris.IRIS.GET_NODE, globalName, None, subscripts, mode = intersystems_iris.IRIS.MODE_GLOBAL)
|
129
|
+
|
130
|
+
def getBoolean(self, globalName, *subscripts):
|
131
|
+
'''
|
132
|
+
Fetches the value of a global node as a boolean.
|
133
|
+
|
134
|
+
getBoolean(globalName, subscripts...)
|
135
|
+
|
136
|
+
Parameters
|
137
|
+
----------
|
138
|
+
globalName : global node name.
|
139
|
+
subscripts... : global subscripts, optional, variable length.
|
140
|
+
|
141
|
+
Return Value
|
142
|
+
------------
|
143
|
+
Returns None if the node is undefined; otherwise, returns bool.
|
144
|
+
'''
|
145
|
+
return self._execute(bool, intersystems_iris.IRIS.GET_NODE, globalName, None, subscripts, mode = intersystems_iris.IRIS.MODE_GLOBAL)
|
146
|
+
|
147
|
+
def getBytes(self, globalName, *subscripts):
|
148
|
+
'''
|
149
|
+
Fetches the value of a global node as bytes.
|
150
|
+
|
151
|
+
getBytes(globalName, subscripts...)
|
152
|
+
|
153
|
+
Parameters
|
154
|
+
----------
|
155
|
+
globalName : global node name.
|
156
|
+
subscripts... : global subscripts, optional, variable length.
|
157
|
+
|
158
|
+
Return Value
|
159
|
+
------------
|
160
|
+
Returns None if the node is undefined; otherwise, returns bytes.
|
161
|
+
'''
|
162
|
+
return self._execute(bytes, intersystems_iris.IRIS.GET_NODE, globalName, None, subscripts, mode = intersystems_iris.IRIS.MODE_GLOBAL)
|
163
|
+
|
164
|
+
def getDecimal(self, globalName, *subscripts):
|
165
|
+
'''
|
166
|
+
Fetches the value of a global node as a decimal.
|
167
|
+
|
168
|
+
getDecimal(globalName, subscripts...)
|
169
|
+
|
170
|
+
Parameters
|
171
|
+
----------
|
172
|
+
globalName : global node name.
|
173
|
+
subscripts... : global subscripts, optional, variable length.
|
174
|
+
|
175
|
+
Return Value
|
176
|
+
------------
|
177
|
+
Returns None if the node is undefined; otherwise, returns Decimal.
|
178
|
+
'''
|
179
|
+
return self._execute(decimal.Decimal, intersystems_iris.IRIS.GET_NODE, globalName, None, subscripts, mode = intersystems_iris.IRIS.MODE_GLOBAL)
|
180
|
+
|
181
|
+
def getFloat(self, globalName, *subscripts):
|
182
|
+
'''
|
183
|
+
Fetches the value of a global node as a float
|
184
|
+
|
185
|
+
getFloat(globalName, subscripts...)
|
186
|
+
|
187
|
+
Parameters
|
188
|
+
----------
|
189
|
+
globalName : global node name.
|
190
|
+
subscripts... : global subscripts, optional, variable length.
|
191
|
+
|
192
|
+
Return Value
|
193
|
+
------------
|
194
|
+
Returns None if the node is undefined; otherwise, returns float.
|
195
|
+
'''
|
196
|
+
return self._execute(float, intersystems_iris.IRIS.GET_NODE, globalName, None, subscripts, mode = intersystems_iris.IRIS.MODE_GLOBAL)
|
197
|
+
|
198
|
+
def getLong(self, globalName, *subscripts):
|
199
|
+
'''
|
200
|
+
This method has been deprecated. Please use getInteger() instead.
|
201
|
+
'''
|
202
|
+
return self.getInteger(globalName, *subscripts)
|
203
|
+
|
204
|
+
def getInteger(self, globalName, *subscripts):
|
205
|
+
'''
|
206
|
+
Fetches the value of a global node as an integer.
|
207
|
+
|
208
|
+
getInteger(globalName, subscripts...)
|
209
|
+
|
210
|
+
Parameters
|
211
|
+
----------
|
212
|
+
globalName : global node name.
|
213
|
+
subscripts... : global subscripts, optional, variable length.
|
214
|
+
|
215
|
+
Return Value
|
216
|
+
------------
|
217
|
+
Returns None if the node is undefined; otherwise, returns int.
|
218
|
+
'''
|
219
|
+
return self._execute(int, intersystems_iris.IRIS.GET_NODE, globalName, None, subscripts, mode = intersystems_iris.IRIS.MODE_GLOBAL)
|
220
|
+
|
221
|
+
def getString(self, globalName, *subscripts):
|
222
|
+
'''
|
223
|
+
Fetches the value of a global node as a string.
|
224
|
+
|
225
|
+
getString(globalName, subscripts...)
|
226
|
+
|
227
|
+
Parameters
|
228
|
+
----------
|
229
|
+
globalName : global node name.
|
230
|
+
subscripts... : global subscripts, optional, variable length.
|
231
|
+
|
232
|
+
Return Value
|
233
|
+
------------
|
234
|
+
Returns None if the node is undefined; otherwise, returns str.
|
235
|
+
'''
|
236
|
+
return self._execute(str, intersystems_iris.IRIS.GET_NODE, globalName, None, subscripts, mode = intersystems_iris.IRIS.MODE_GLOBAL)
|
237
|
+
|
238
|
+
def getIRISList(self, globalName, *subscripts):
|
239
|
+
'''
|
240
|
+
Fetches the value of a global node as a IRISList.
|
241
|
+
|
242
|
+
getIRISList(globalName, subscripts...)
|
243
|
+
|
244
|
+
Parameters
|
245
|
+
----------
|
246
|
+
globalName : global node name.
|
247
|
+
subscripts... : global subscripts, optional, variable length.
|
248
|
+
|
249
|
+
Return Value
|
250
|
+
------------
|
251
|
+
Returns None if the node is undefined; otherwise, returns IRISList.
|
252
|
+
'''
|
253
|
+
return self._execute(intersystems_iris.IRISList, intersystems_iris.IRIS.GET_NODE, globalName, None, subscripts, mode = intersystems_iris.IRIS.MODE_GLOBAL)
|
254
|
+
|
255
|
+
def set(self, value, globalName, *subscripts):
|
256
|
+
'''
|
257
|
+
Sets the value of a global node.
|
258
|
+
|
259
|
+
set(value, globalName, subscripts...)
|
260
|
+
|
261
|
+
Parameters
|
262
|
+
----------
|
263
|
+
value : new value of the global node. The new value may be bool, bytes, bytearray, Decimal, float, int, str, or IRISList.
|
264
|
+
globalName : global node name.
|
265
|
+
subscripts... : global subscripts, optional, variable length.
|
266
|
+
|
267
|
+
Return Value
|
268
|
+
------------
|
269
|
+
Returns None.
|
270
|
+
'''
|
271
|
+
if type(value) == str and len(value) == 0:
|
272
|
+
value = None
|
273
|
+
self._execute(None, intersystems_iris.IRIS.SET_NODE, globalName, None, subscripts, value, mode = intersystems_iris.IRIS.MODE_GLOBAL)
|
274
|
+
return
|
275
|
+
|
276
|
+
def kill(self, globalName, *subscripts):
|
277
|
+
'''
|
278
|
+
Kills a global node including any descendants.
|
279
|
+
|
280
|
+
kill(globalName, subscripts...)
|
281
|
+
|
282
|
+
Parameters
|
283
|
+
----------
|
284
|
+
globalName : global node name.
|
285
|
+
subscripts... : global subscripts, optional, variable length.
|
286
|
+
|
287
|
+
Return Value
|
288
|
+
------------
|
289
|
+
Returns None.
|
290
|
+
'''
|
291
|
+
self._execute(None, intersystems_iris.IRIS.KILL_NODE, globalName, None, subscripts, mode = intersystems_iris.IRIS.MODE_GLOBAL)
|
292
|
+
return
|
293
|
+
|
294
|
+
def increment(self, value, globalName, *subscripts):
|
295
|
+
'''
|
296
|
+
Increments a global node by the value argument.
|
297
|
+
|
298
|
+
increment(value, globalName, subscripts...)
|
299
|
+
|
300
|
+
Parameters
|
301
|
+
----------
|
302
|
+
value : amount by which to increment.
|
303
|
+
globalName : global node name.
|
304
|
+
subscripts... : global subscripts, optional, variable length.
|
305
|
+
|
306
|
+
Return Value
|
307
|
+
------------
|
308
|
+
Returns the new value of the global node. The new value may be Decimal, float, or int.
|
309
|
+
'''
|
310
|
+
return self._execute(object, intersystems_iris.IRIS.INCREMENT, globalName, None, subscripts, value, mode = intersystems_iris.IRIS.MODE_GLOBAL)
|
311
|
+
|
312
|
+
def isDefined(self, globalName, *subscripts):
|
313
|
+
'''
|
314
|
+
Returns whether a global node contains data and whether it has children. This method is similar to $DATA in IRIS.
|
315
|
+
|
316
|
+
isDefined(globalName, subscripts...)
|
317
|
+
|
318
|
+
Parameters
|
319
|
+
----------
|
320
|
+
globalName : global node name.
|
321
|
+
subscripts... : global subscripts, optional, variable length.
|
322
|
+
|
323
|
+
Return Value
|
324
|
+
------------
|
325
|
+
Returns one of the following four integers:
|
326
|
+
0 if the node is undefined and has no children
|
327
|
+
1 if the node is defined and has no children
|
328
|
+
10 if the node is undefined and has children
|
329
|
+
11 if the node is defined and has children.
|
330
|
+
'''
|
331
|
+
return self._execute(int, intersystems_iris.IRIS.DATA, globalName, None, subscripts, intersystems_iris.IRIS.FLAG_EMPTY, mode = intersystems_iris.IRIS.MODE_GLOBAL)
|
332
|
+
|
333
|
+
def nextSubscript(self, reversed, globalName, *subscripts):
|
334
|
+
'''
|
335
|
+
Returns the next subscript of a global node. This method is similar to $ORDER in IRIS.
|
336
|
+
|
337
|
+
nextSubscript(reversed, globalName, subscripts...)
|
338
|
+
|
339
|
+
Parameters
|
340
|
+
----------
|
341
|
+
reversed : boolean to indicate if traversing is reversed
|
342
|
+
globalName : global node name.
|
343
|
+
subscripts... : global subscripts, optional, variable length.
|
344
|
+
|
345
|
+
Return Value
|
346
|
+
------------
|
347
|
+
Returns the next subscript that is the sibling of the last subscript. Returns None if it reaches the end.
|
348
|
+
'''
|
349
|
+
bitflags = intersystems_iris.IRIS.FLAG_SUBSCRIPT + (intersystems_iris.IRIS.FLAG_REVERSE if reversed else intersystems_iris.IRIS.FLAG_EMPTY)
|
350
|
+
subscript = self._execute(str, intersystems_iris.IRIS.ORDER, globalName, None, subscripts, bitflags, mode = intersystems_iris.IRIS.MODE_GLOBAL)
|
351
|
+
if len(subscript) == 0:
|
352
|
+
subscript = None
|
353
|
+
return subscript
|
354
|
+
|
355
|
+
def _nextNode(self, reversed, globalName, *subscripts):
|
356
|
+
bitflags = intersystems_iris.IRIS.FLAG_SUBSCRIPT + intersystems_iris.IRIS.FLAG_VALUE + (intersystems_iris.IRIS.FLAG_REVERSE if reversed else intersystems_iris.IRIS.FLAG_EMPTY)
|
357
|
+
return self._execute(tuple, intersystems_iris.IRIS.ORDER, globalName, None, subscripts, bitflags, 5, mode = intersystems_iris.IRIS.MODE_GLOBAL)
|
358
|
+
|
359
|
+
def _nextNodeWithStop(self, reversed, stop_value, globalName, *subscripts):
|
360
|
+
bitflags = intersystems_iris.IRIS.FLAG_SUBSCRIPT + intersystems_iris.IRIS.FLAG_VALUE + (intersystems_iris.IRIS.FLAG_REVERSE if reversed else intersystems_iris.IRIS.FLAG_EMPTY) + intersystems_iris.IRIS.FLAG_STOPON
|
361
|
+
return self._execute(tuple, intersystems_iris.IRIS.ORDER, globalName, None, subscripts, bitflags, stop_value, mode = intersystems_iris.IRIS.MODE_GLOBAL)
|
362
|
+
|
363
|
+
def iterator(self, globalName, *subscripts):
|
364
|
+
'''
|
365
|
+
This method is deprecated, please use node() instead.
|
366
|
+
|
367
|
+
Returns an iterator which can iterate over the immediate children of a global node.
|
368
|
+
|
369
|
+
The iterator can be set to move forwards or backwards, and to return the subscript, the value or both in the iteration. This is similar to using the $ORDER function in ObjectScript.
|
370
|
+
|
371
|
+
iterator(globalName, subscripts...)
|
372
|
+
|
373
|
+
Parameters
|
374
|
+
----------
|
375
|
+
globalName : global node name.
|
376
|
+
subscripts... : global subscripts, optional, variable length.
|
377
|
+
|
378
|
+
Return Value
|
379
|
+
------------
|
380
|
+
Returns an iterator
|
381
|
+
'''
|
382
|
+
return intersystems_iris.LegacyIterator(self, globalName, *subscripts)
|
383
|
+
|
384
|
+
def node(self, globalName, *subscripts):
|
385
|
+
'''
|
386
|
+
Returns an IRISGlobalNode object which is an iterable object behaves like a virtual dictionary representing the immediate children of a global node.
|
387
|
+
|
388
|
+
IRISGLobalNode is iterable, reversable, indexable and sliceable. Please refer to IRISGLobalNode for more details.
|
389
|
+
|
390
|
+
node(globalName, subscripts...)
|
391
|
+
|
392
|
+
Parameters
|
393
|
+
----------
|
394
|
+
globalName : global node name.
|
395
|
+
subscripts... : global subscripts, optional, variable length.
|
396
|
+
|
397
|
+
Return Value
|
398
|
+
------------
|
399
|
+
Returns an IRISGLobalNode object.
|
400
|
+
'''
|
401
|
+
return intersystems_iris.IRISGlobalNode(self, globalName, *subscripts)
|
402
|
+
|
403
|
+
def _sortOrder(self, subscript1, subscript2, globalName, *subscripts):
|
404
|
+
return self._execute(int, intersystems_iris.IRIS.VALUE_CLASSMETHOD, "%Net.Remote.Gateway", "%SubscriptSortOrder", [globalName, subscript1, subscript2])
|
405
|
+
|
406
|
+
def lock(self, lockMode, timeout, globalName, *subscripts):
|
407
|
+
'''
|
408
|
+
Locks a global node. It performs an incremental lock and not the implicit unlock before lock feature that is also offered in IRIS. Throws a <TIMEOUT> exception if the timeout is reached waiting to acquire the lock.
|
409
|
+
|
410
|
+
lock(lockMode, timeout, globalName, subscripts...)
|
411
|
+
|
412
|
+
Parameters
|
413
|
+
----------
|
414
|
+
lockMode : a string containing zero or more of the following characters
|
415
|
+
S for shared lock, E for escalating lock.
|
416
|
+
An empty string is the default mode (exclusive and non-escalating).
|
417
|
+
timeout : number of seconds to wait to acquire the lock
|
418
|
+
globalName : global node name.
|
419
|
+
subscripts... : global subscripts, optional, variable length.
|
420
|
+
|
421
|
+
Return Value
|
422
|
+
------------
|
423
|
+
Returns None.
|
424
|
+
'''
|
425
|
+
self._execute(None, intersystems_iris.IRIS.LOCK, globalName, None, subscripts, lockMode, timeout, mode = intersystems_iris.IRIS.MODE_GLOBAL)
|
426
|
+
return True
|
427
|
+
|
428
|
+
def unlock(self, lockMode, globalName, *subscripts):
|
429
|
+
'''
|
430
|
+
Unlock a global node. It perform an incremental unlock and not the implicit unlock before lock feature that is also offered in IRIS.
|
431
|
+
|
432
|
+
unlock(lockMode, globalName, subscripts...)
|
433
|
+
|
434
|
+
Parameters
|
435
|
+
----------
|
436
|
+
lockMode : a string containing zero or more of the following characters:
|
437
|
+
S for shared lock, E for escalating lock, I for immediate unlock, D for deferred unlock.
|
438
|
+
An empty string is the default mode (exclusive, non-escalating, always defers releasing an unlocked lock to the end of the current transaction).
|
439
|
+
globalName : global node name.
|
440
|
+
subscripts... : global subscripts, optional, variable length.
|
441
|
+
|
442
|
+
Return Value
|
443
|
+
------------
|
444
|
+
Returns None.
|
445
|
+
'''
|
446
|
+
self._execute(None, intersystems_iris.IRIS.UNLOCK, globalName, None, subscripts, lockMode, mode = intersystems_iris.IRIS.MODE_GLOBAL)
|
447
|
+
return
|
448
|
+
|
449
|
+
def releaseAllLocks(self):
|
450
|
+
'''
|
451
|
+
Releases all locks associated with the session (i.e. connection).
|
452
|
+
|
453
|
+
releaseAllLocks()
|
454
|
+
|
455
|
+
Return Value
|
456
|
+
------------
|
457
|
+
Returns None.
|
458
|
+
'''
|
459
|
+
self._execute(None, intersystems_iris.IRIS.UNLOCK_ALL, None, None, None, mode = intersystems_iris.IRIS.MODE_GLOBAL)
|
460
|
+
return
|
461
|
+
|
462
|
+
def tStart(self):
|
463
|
+
'''
|
464
|
+
Starts an IRIS transaction.
|
465
|
+
|
466
|
+
tStart()
|
467
|
+
|
468
|
+
Return Value
|
469
|
+
------------
|
470
|
+
Returns None.
|
471
|
+
'''
|
472
|
+
self._execute(None, intersystems_iris.IRIS.TSTART, None, None, None, mode = intersystems_iris.IRIS.MODE_GLOBAL)
|
473
|
+
return
|
474
|
+
|
475
|
+
def tCommit(self):
|
476
|
+
'''
|
477
|
+
Commits the current IRIS transaction.
|
478
|
+
|
479
|
+
tCommit()
|
480
|
+
|
481
|
+
Return Value
|
482
|
+
------------
|
483
|
+
Returns None.
|
484
|
+
'''
|
485
|
+
self._execute(None, intersystems_iris.IRIS.TCOMMIT, None, None, None, mode = intersystems_iris.IRIS.MODE_GLOBAL)
|
486
|
+
return
|
487
|
+
|
488
|
+
def tRollback(self):
|
489
|
+
'''
|
490
|
+
Rolls back all open IRIS transactions in the session (i.e. connection).
|
491
|
+
|
492
|
+
tRollback()
|
493
|
+
|
494
|
+
Return Value
|
495
|
+
------------
|
496
|
+
Returns None.
|
497
|
+
'''
|
498
|
+
self._execute(None, intersystems_iris.IRIS.TROLLBACK, None, None, None, mode = intersystems_iris.IRIS.MODE_GLOBAL)
|
499
|
+
return
|
500
|
+
|
501
|
+
def tRollbackOne(self):
|
502
|
+
'''
|
503
|
+
Rolls back the current level of IRIS transaction. This method is intended for nested transactions, when the caller only wants to roll back one level.
|
504
|
+
|
505
|
+
tRollbackOne()
|
506
|
+
|
507
|
+
Return Value
|
508
|
+
------------
|
509
|
+
Returns None.
|
510
|
+
'''
|
511
|
+
self._execute(None, intersystems_iris.IRIS.TROLLBACK_ONE, None, None, None, mode = intersystems_iris.IRIS.MODE_GLOBAL)
|
512
|
+
return
|
513
|
+
|
514
|
+
def getTLevel(self):
|
515
|
+
'''
|
516
|
+
Returns the number of nested transactions currently open in the session (i.e. connection). This is equivalent to fetching the value of the $TLEVEL special variable in IRIS.
|
517
|
+
|
518
|
+
getTLevel()
|
519
|
+
|
520
|
+
Return Value
|
521
|
+
------------
|
522
|
+
Returns an integer indicates the the number of open transactions in the current session (i.e. connection). Returns 0 if there are no transactions open.
|
523
|
+
'''
|
524
|
+
return self._execute(int, intersystems_iris.IRIS.GET_TLEVEL, None, None, None, mode = intersystems_iris.IRIS.MODE_GLOBAL)
|
525
|
+
|
526
|
+
def function(self, functionName, routineName, *args):
|
527
|
+
'''
|
528
|
+
Calls a function that returns a value.
|
529
|
+
|
530
|
+
function(functionName, routineName, args...)
|
531
|
+
|
532
|
+
Parameters
|
533
|
+
----------
|
534
|
+
functionName : name of a function.
|
535
|
+
routineName : name of an IRIS routine.
|
536
|
+
args... : zero or more arguments to be passed to the function, optional, variable length.
|
537
|
+
None is projected as empty string ($$$NULLOREF) in IRIS.
|
538
|
+
bool, bytes, Decimal, float, int, str, and IRISList are projected as literals in IRIS.
|
539
|
+
all other types are projected as proxy objects.
|
540
|
+
|
541
|
+
Return Value
|
542
|
+
------------
|
543
|
+
Returns None if IRIS empty string ($$$NULLOREF) is returned; otherwise, returns bytes, Decimal, float, int, or str.
|
544
|
+
'''
|
545
|
+
return self._execute(object, intersystems_iris.IRIS.VALUE_FUNCTION, functionName, routineName, args)
|
546
|
+
|
547
|
+
def functionObject(self, functionName, routineName, *args):
|
548
|
+
'''
|
549
|
+
Calls a function that returns a value.
|
550
|
+
|
551
|
+
functionObject(functionName, routineName, args...)
|
552
|
+
|
553
|
+
Parameters
|
554
|
+
----------
|
555
|
+
functionName : name of a function.
|
556
|
+
routineName : name of an IRIS routine.
|
557
|
+
args... : zero or more arguments to be passed to the function, optional, variable length.
|
558
|
+
None is projected as empty string ($$$NULLOREF) in IRIS.
|
559
|
+
bool, bytes, Decimal, float, int, str, and IRISList are projected as literals in IRIS.
|
560
|
+
all other types are projected as proxy objects.
|
561
|
+
|
562
|
+
Return Value
|
563
|
+
------------
|
564
|
+
Returns None if IRIS empty string ($$$NULLOREF) is returned; otherwise, returns bytes, Decimal, float, int, or str.
|
565
|
+
'''
|
566
|
+
return self._execute(object, intersystems_iris.IRIS.VALUE_FUNCTION, functionName, routineName, args)
|
567
|
+
|
568
|
+
def functionBoolean(self, functionName, routineName, *args):
|
569
|
+
'''
|
570
|
+
Calls a function that returns a value as a boolean.
|
571
|
+
|
572
|
+
functionBoolean(functionName, routineName, args...)
|
573
|
+
|
574
|
+
Parameters
|
575
|
+
----------
|
576
|
+
functionName : name of a function.
|
577
|
+
routineName : name of an IRIS routine.
|
578
|
+
args... : zero or more arguments to be passed to the function, optional, variable length.
|
579
|
+
None is projected as empty string ($$$NULLOREF) in IRIS.
|
580
|
+
bool, bytes, Decimal, float, int, str, and IRISList are projected as literals in IRIS.
|
581
|
+
all other types are projected as proxy objects.
|
582
|
+
|
583
|
+
Return Value
|
584
|
+
------------
|
585
|
+
Returns None if IRIS empty string ($$$NULLOREF) is returned; otherwise, returns a bool.
|
586
|
+
'''
|
587
|
+
return self._execute(bool, intersystems_iris.IRIS.VALUE_FUNCTION, functionName, routineName, args)
|
588
|
+
|
589
|
+
def functionBytes(self, functionName, routineName, *args):
|
590
|
+
'''
|
591
|
+
Calls a function that returns a value as bytes.
|
592
|
+
|
593
|
+
functionBytes(functionName, routineName, args...)
|
594
|
+
|
595
|
+
Parameters
|
596
|
+
----------
|
597
|
+
functionName : name of a function.
|
598
|
+
routineName : name of an IRIS routine.
|
599
|
+
args... : zero or more arguments to be passed to the function, optional, variable length.
|
600
|
+
None is projected as empty string ($$$NULLOREF) in IRIS.
|
601
|
+
bool, bytes, Decimal, float, int, str, and IRISList are projected as literals in IRIS.
|
602
|
+
all other types are projected as proxy objects.
|
603
|
+
|
604
|
+
Return Value
|
605
|
+
------------
|
606
|
+
Returns None if IRIS empty string ($$$NULLOREF) is returned; otherwise, returns bytes.
|
607
|
+
'''
|
608
|
+
return self._execute(bytes, intersystems_iris.IRIS.VALUE_FUNCTION, functionName, routineName, args)
|
609
|
+
|
610
|
+
def functionDecimal(self, functionName, routineName, *args):
|
611
|
+
'''
|
612
|
+
Calls a function that returns a value as a Decimal.
|
613
|
+
|
614
|
+
functionDecimal(functionName, routineName, args...)
|
615
|
+
|
616
|
+
Parameters
|
617
|
+
----------
|
618
|
+
functionName : name of a function.
|
619
|
+
routineName : name of an IRIS routine.
|
620
|
+
args... : zero or more arguments to be passed to the function, optional, variable length.
|
621
|
+
None is projected as empty string ($$$NULLOREF) in IRIS.
|
622
|
+
bool, bytes, Decimal, float, int, str, and IRISList are projected as literals in IRIS.
|
623
|
+
all other types are projected as proxy objects.
|
624
|
+
|
625
|
+
Return Value
|
626
|
+
------------
|
627
|
+
Returns None if IRIS empty string ($$$NULLOREF) is returned; otherwise, returns a Decimal.
|
628
|
+
'''
|
629
|
+
return self._execute(decimal.Decimal, intersystems_iris.IRIS.VALUE_FUNCTION, functionName, routineName, args)
|
630
|
+
|
631
|
+
def functionFloat(self, functionName, routineName, *args):
|
632
|
+
'''
|
633
|
+
Calls a function that returns a value as a float.
|
634
|
+
|
635
|
+
functionFloat(functionName, routineName, args...)
|
636
|
+
|
637
|
+
Parameters
|
638
|
+
----------
|
639
|
+
functionName : name of a function.
|
640
|
+
routineName : name of an IRIS routine.
|
641
|
+
args... : zero or more arguments to be passed to the function, optional, variable length.
|
642
|
+
None is projected as empty string ($$$NULLOREF) in IRIS.
|
643
|
+
bool, bytes, Decimal, float, int, str, and IRISList are projected as literals in IRIS.
|
644
|
+
all other types are projected as proxy objects.
|
645
|
+
|
646
|
+
Return Value
|
647
|
+
------------
|
648
|
+
Returns None if IRIS empty string ($$$NULLOREF) is returned; otherwise, returns a float.
|
649
|
+
'''
|
650
|
+
return self._execute(float, intersystems_iris.IRIS.VALUE_FUNCTION, functionName, routineName, args)
|
651
|
+
|
652
|
+
def functionInteger(self, functionName, routineName, *args):
|
653
|
+
'''
|
654
|
+
Calls a function that returns a value as an integer.
|
655
|
+
|
656
|
+
functionInteger(functionName, routineName, args...)
|
657
|
+
|
658
|
+
Parameters
|
659
|
+
----------
|
660
|
+
functionName : name of a function.
|
661
|
+
routineName : name of an IRIS routine.
|
662
|
+
args... : zero or more arguments to be passed to the function, optional, variable length.
|
663
|
+
None is projected as empty string ($$$NULLOREF) in IRIS.
|
664
|
+
bool, bytes, Decimal, float, int, str, and IRISList are projected as literals in IRIS.
|
665
|
+
all other types are projected as proxy objects.
|
666
|
+
|
667
|
+
Return Value
|
668
|
+
------------
|
669
|
+
Returns None if IRIS empty string ($$$NULLOREF) is returned; otherwise, returns an int.
|
670
|
+
'''
|
671
|
+
return self._execute(int, intersystems_iris.IRIS.VALUE_FUNCTION, functionName, routineName, args)
|
672
|
+
|
673
|
+
def functionString(self, functionName, routineName, *args):
|
674
|
+
'''
|
675
|
+
Calls a function that returns a value as a string.
|
676
|
+
|
677
|
+
functionString(functionName, routineName, args...)
|
678
|
+
|
679
|
+
Parameters
|
680
|
+
----------
|
681
|
+
functionName : name of a function.
|
682
|
+
routineName : name of an IRIS routine.
|
683
|
+
args... : zero or more arguments to be passed to the function, optional, variable length.
|
684
|
+
None is projected as empty string ($$$NULLOREF) in IRIS.
|
685
|
+
bool, bytes, Decimal, float, int, str, and IRISList are projected as literals in IRIS.
|
686
|
+
all other types are projected as proxy objects.
|
687
|
+
|
688
|
+
Return Value
|
689
|
+
------------
|
690
|
+
Returns None if IRIS empty string ($$$NULLOREF) is returned; otherwise, returns a str.
|
691
|
+
'''
|
692
|
+
return self._execute(str, intersystems_iris.IRIS.VALUE_FUNCTION, functionName, routineName, args)
|
693
|
+
|
694
|
+
def functionIRISList(self, functionName, routineName, *args):
|
695
|
+
'''
|
696
|
+
Calls a function that returns a value as an IRISList.
|
697
|
+
|
698
|
+
functionIRISList(functionName, routineName, args...)
|
699
|
+
|
700
|
+
Parameters
|
701
|
+
----------
|
702
|
+
functionName : name of a function.
|
703
|
+
routineName : name of an IRIS routine.
|
704
|
+
args... : zero or more arguments to be passed to the function, optional, variable length.
|
705
|
+
None is projected as empty string ($$$NULLOREF) in IRIS.
|
706
|
+
bool, bytes, Decimal, float, int, str, and IRISList are projected as literals in IRIS.
|
707
|
+
all other types are projected as proxy objects.
|
708
|
+
|
709
|
+
Return Value
|
710
|
+
------------
|
711
|
+
Returns None if IRIS empty string ($$$NULLOREF) is returned; otherwise, returns an IRISList.
|
712
|
+
'''
|
713
|
+
return self._execute(intersystems_iris.IRISList, intersystems_iris.IRIS.VALUE_FUNCTION, functionName, routineName, args)
|
714
|
+
|
715
|
+
def procedure(self, procedureName, routineName, *args):
|
716
|
+
'''
|
717
|
+
Calls a procedure that does not return a value.
|
718
|
+
|
719
|
+
procedure(procedureName, routineName, args...)
|
720
|
+
|
721
|
+
Parameters
|
722
|
+
----------
|
723
|
+
procedureName : name of a procedure.
|
724
|
+
routineName : name of an IRIS routine.
|
725
|
+
args... : zero or more arguments to be passed to the function, optional, variable length.
|
726
|
+
None is projected as empty string ($$$NULLOREF) in IRIS.
|
727
|
+
bool, bytes, Decimal, float, int, str, and IRISList are projected as literals in IRIS.
|
728
|
+
all other types are projected as proxy objects.
|
729
|
+
|
730
|
+
Return Value
|
731
|
+
------------
|
732
|
+
Returns None.
|
733
|
+
'''
|
734
|
+
if len(args) > 0:
|
735
|
+
self._execute(None, intersystems_iris.IRIS.VOID_PROCEDURE, procedureName, routineName, args)
|
736
|
+
else:
|
737
|
+
self._execute(None, intersystems_iris.IRIS.VOID_ROUTINE, procedureName, routineName, args)
|
738
|
+
return
|
739
|
+
|
740
|
+
def classMethodValue(self, className, methodName, *args):
|
741
|
+
'''
|
742
|
+
Invoke a classmethod that returns a value.
|
743
|
+
|
744
|
+
classMethodValue(className, methodName, args...)
|
745
|
+
|
746
|
+
Parameters
|
747
|
+
----------
|
748
|
+
className : name of a class.
|
749
|
+
methodName : name of a method.
|
750
|
+
args... : zero or more arguments to be passed to the function, optional, variable length.
|
751
|
+
None is projected as empty string ($$$NULLOREF) in IRIS.
|
752
|
+
bool, bytes, Decimal, float, int, str, and IRISList are projected as literals in IRIS.
|
753
|
+
all other types are projected as proxy objects.
|
754
|
+
|
755
|
+
Return Value
|
756
|
+
------------
|
757
|
+
Returns None if IRIS empty string ($$$NULLOREF) is returned; otherwise, returns bytes, Decimal, float, int, or str.
|
758
|
+
'''
|
759
|
+
return self._execute(object, intersystems_iris.IRIS.VALUE_CLASSMETHOD, className, methodName, args)
|
760
|
+
|
761
|
+
def classMethodObject(self, className, methodName, *args):
|
762
|
+
'''
|
763
|
+
Invoke a classmethod that returns a value.
|
764
|
+
|
765
|
+
classMethodObject(className, methodName, args...)
|
766
|
+
|
767
|
+
Parameters
|
768
|
+
----------
|
769
|
+
className : name of a class.
|
770
|
+
methodName : name of a method.
|
771
|
+
args... : zero or more arguments to be passed to the function, optional, variable length.
|
772
|
+
None is projected as empty string ($$$NULLOREF) in IRIS.
|
773
|
+
bool, bytes, Decimal, float, int, str, and IRISList are projected as literals in IRIS.
|
774
|
+
all other types are projected as proxy objects.
|
775
|
+
|
776
|
+
Return Value
|
777
|
+
------------
|
778
|
+
Returns None if IRIS empty string ($$$NULLOREF) is returned; otherwise, returns bytes, Decimal, float, int, or str.
|
779
|
+
'''
|
780
|
+
return self._execute(object, intersystems_iris.IRIS.VALUE_CLASSMETHOD, className, methodName, args)
|
781
|
+
|
782
|
+
def classMethodBoolean(self, className, methodName, *args):
|
783
|
+
'''
|
784
|
+
Invoke a classmethod that returns a value as a boolean.
|
785
|
+
|
786
|
+
classMethodBoolean(className, methodName, args...)
|
787
|
+
|
788
|
+
Parameters
|
789
|
+
----------
|
790
|
+
className : name of a class.
|
791
|
+
methodName : name of a method.
|
792
|
+
args... : zero or more arguments to be passed to the function, optional, variable length.
|
793
|
+
None is projected as empty string ($$$NULLOREF) in IRIS.
|
794
|
+
bool, bytes, Decimal, float, int, str, and IRISList are projected as literals in IRIS.
|
795
|
+
all other types are projected as proxy objects.
|
796
|
+
|
797
|
+
Return Value
|
798
|
+
------------
|
799
|
+
Returns None if IRIS empty string ($$$NULLOREF) is returned; otherwise, returns a bool.
|
800
|
+
'''
|
801
|
+
return self._execute(bool, intersystems_iris.IRIS.VALUE_CLASSMETHOD, className, methodName, args)
|
802
|
+
|
803
|
+
def classMethodBytes(self, className, methodName, *args):
|
804
|
+
'''
|
805
|
+
Invoke a classmethod that returns a value as bytes.
|
806
|
+
|
807
|
+
classMethodBytes(className, methodName, args...)
|
808
|
+
|
809
|
+
Parameters
|
810
|
+
----------
|
811
|
+
className : name of a class.
|
812
|
+
methodName : name of a method.
|
813
|
+
args... : zero or more arguments to be passed to the function, optional, variable length.
|
814
|
+
None is projected as empty string ($$$NULLOREF) in IRIS.
|
815
|
+
bool, bytes, Decimal, float, int, str, and IRISList are projected as literals in IRIS.
|
816
|
+
all other types are projected as proxy objects.
|
817
|
+
|
818
|
+
Return Value
|
819
|
+
------------
|
820
|
+
Returns None if IRIS empty string ($$$NULLOREF) is returned; otherwise, returns bytes.
|
821
|
+
'''
|
822
|
+
return self._execute(bytes, intersystems_iris.IRIS.VALUE_CLASSMETHOD, className, methodName, args)
|
823
|
+
|
824
|
+
def classMethodDecimal(self, className, methodName, *args):
|
825
|
+
'''
|
826
|
+
Invoke a classmethod that returns a value as a Decimal.
|
827
|
+
|
828
|
+
classMethodDecimal(className, methodName, args...)
|
829
|
+
|
830
|
+
Parameters
|
831
|
+
----------
|
832
|
+
className : name of a class.
|
833
|
+
methodName : name of a method.
|
834
|
+
args... : zero or more arguments to be passed to the function, optional, variable length.
|
835
|
+
None is projected as empty string ($$$NULLOREF) in IRIS.
|
836
|
+
bool, bytes, Decimal, float, int, str, and IRISList are projected as literals in IRIS.
|
837
|
+
all other types are projected as proxy objects.
|
838
|
+
|
839
|
+
Return Value
|
840
|
+
------------
|
841
|
+
Returns None if IRIS empty string ($$$NULLOREF) is returned; otherwise, returns a Decimal.
|
842
|
+
'''
|
843
|
+
return self._execute(decimal.Decimal, intersystems_iris.IRIS.VALUE_CLASSMETHOD, className, methodName, args)
|
844
|
+
|
845
|
+
def classMethodFloat(self, className, methodName, *args):
|
846
|
+
'''
|
847
|
+
Invoke a classmethod that returns a value as a float.
|
848
|
+
|
849
|
+
classMethodFloat(className, methodName, args...)
|
850
|
+
|
851
|
+
Parameters
|
852
|
+
----------
|
853
|
+
className : name of a class.
|
854
|
+
methodName : name of a method.
|
855
|
+
args... : zero or more arguments to be passed to the function, optional, variable length.
|
856
|
+
None is projected as empty string ($$$NULLOREF) in IRIS.
|
857
|
+
bool, bytes, Decimal, float, int, str, and IRISList are projected as literals in IRIS.
|
858
|
+
all other types are projected as proxy objects.
|
859
|
+
|
860
|
+
Return Value
|
861
|
+
------------
|
862
|
+
Returns None if IRIS empty string ($$$NULLOREF) is returned; otherwise, returns a float.
|
863
|
+
'''
|
864
|
+
return self._execute(float, intersystems_iris.IRIS.VALUE_CLASSMETHOD, className, methodName, args)
|
865
|
+
|
866
|
+
def classMethodInteger(self, className, methodName, *args):
|
867
|
+
'''
|
868
|
+
Invoke a classmethod that returns a value as a integer.
|
869
|
+
|
870
|
+
classMethodInteger(className, methodName, args...)
|
871
|
+
|
872
|
+
Parameters
|
873
|
+
----------
|
874
|
+
className : name of a class.
|
875
|
+
methodName : name of a method.
|
876
|
+
args... : zero or more arguments to be passed to the function, optional, variable length.
|
877
|
+
None is projected as empty string ($$$NULLOREF) in IRIS.
|
878
|
+
bool, bytes, Decimal, float, int, str, and IRISList are projected as literals in IRIS.
|
879
|
+
all other types are projected as proxy objects.
|
880
|
+
|
881
|
+
Return Value
|
882
|
+
------------
|
883
|
+
Returns None if IRIS empty string ($$$NULLOREF) is returned; otherwise, returns a int.
|
884
|
+
'''
|
885
|
+
return self._execute(int, intersystems_iris.IRIS.VALUE_CLASSMETHOD, className, methodName, args)
|
886
|
+
|
887
|
+
def classMethodString(self, className, methodName, *args):
|
888
|
+
'''
|
889
|
+
Invoke a classmethod that returns a value as a string.
|
890
|
+
|
891
|
+
classMethodString(className, methodName, args...)
|
892
|
+
|
893
|
+
Parameters
|
894
|
+
----------
|
895
|
+
className : name of a class.
|
896
|
+
methodName : name of a method.
|
897
|
+
args... : zero or more arguments to be passed to the function, optional, variable length.
|
898
|
+
None is projected as empty string ($$$NULLOREF) in IRIS.
|
899
|
+
bool, bytes, Decimal, float, int, str, and IRISList are projected as literals in IRIS.
|
900
|
+
all other types are projected as proxy objects.
|
901
|
+
|
902
|
+
Return Value
|
903
|
+
------------
|
904
|
+
Returns None if IRIS empty string ($$$NULLOREF) is returned; otherwise, returns a string.
|
905
|
+
'''
|
906
|
+
return self._execute(str, intersystems_iris.IRIS.VALUE_CLASSMETHOD, className, methodName, args)
|
907
|
+
|
908
|
+
def classMethodIRISList(self, className, methodName, *args):
|
909
|
+
'''
|
910
|
+
Invoke a classmethod that returns a value as an IRISList.
|
911
|
+
|
912
|
+
classMethodIRISList(className, methodName, args...)
|
913
|
+
|
914
|
+
Parameters
|
915
|
+
----------
|
916
|
+
className : name of a class.
|
917
|
+
methodName : name of a method.
|
918
|
+
args... : zero or more arguments to be passed to the function, optional, variable length.
|
919
|
+
None is projected as empty string ($$$NULLOREF) in IRIS.
|
920
|
+
bool, bytes, Decimal, float, int, str, and IRISList are projected as literals in IRIS.
|
921
|
+
all other types are projected as proxy objects.
|
922
|
+
|
923
|
+
Return Value
|
924
|
+
------------
|
925
|
+
Returns None if IRIS empty string ($$$NULLOREF) is returned; otherwise, returns an IRISList.
|
926
|
+
'''
|
927
|
+
return self._execute(intersystems_iris.IRISList, intersystems_iris.IRIS.VALUE_CLASSMETHOD, className, methodName, args)
|
928
|
+
|
929
|
+
def classMethodVoid(self, className, methodName, *args):
|
930
|
+
'''
|
931
|
+
Invoke a classmethod that does not return a value.
|
932
|
+
|
933
|
+
classMethodVoid(className, methodName, args...)
|
934
|
+
|
935
|
+
Parameters
|
936
|
+
----------
|
937
|
+
className : name of a class.
|
938
|
+
methodName : name of a method.
|
939
|
+
args... : zero or more arguments to be passed to the function, optional, variable length.
|
940
|
+
None is projected as empty string ($$$NULLOREF) in IRIS.
|
941
|
+
bool, bytes, Decimal, float, int, str, and IRISList are projected as literals in IRIS.
|
942
|
+
all other types are projected as proxy objects.
|
943
|
+
|
944
|
+
Return Value
|
945
|
+
------------
|
946
|
+
Returns None.
|
947
|
+
'''
|
948
|
+
self._execute(None, intersystems_iris.IRIS.VOID_CLASSMETHOD, className, methodName, args)
|
949
|
+
return
|
950
|
+
|
951
|
+
def _execute(self, return_type, function_code, name_or_object, secondary_name, args, *post_values, allowedErrors = None, mode = MODE_RUNTIME, honorByReference = True):
|
952
|
+
if mode == intersystems_iris.IRIS.MODE_GLOBAL:
|
953
|
+
honorByReference = False
|
954
|
+
self._out_message.wire._write_header_sysio(function_code)
|
955
|
+
if name_or_object != None:
|
956
|
+
if isinstance(name_or_object, intersystems_iris.IRISObject):
|
957
|
+
self._out_message.wire._set(intersystems_iris._IRISOREF._IRISOREF(name_or_object._oref))
|
958
|
+
else:
|
959
|
+
self._out_message.wire._set(name_or_object, True)
|
960
|
+
if secondary_name != None:
|
961
|
+
self._out_message.wire._set(secondary_name)
|
962
|
+
if args != None:
|
963
|
+
self._marshal_parameters(*args, mode = mode, honorByReference = honorByReference)
|
964
|
+
for i in range(len(post_values)):
|
965
|
+
self._marshal_one_parameter(post_values[i], mode = mode, honorByReference = honorByReference)
|
966
|
+
allowedErrors = [intersystems_iris.IRIS.ERROR_UNDEFINED] if mode == intersystems_iris.IRIS.MODE_GLOBAL else None
|
967
|
+
with self._connection._lock:
|
968
|
+
sequence_number = self._connection._get_new_sequence_number()
|
969
|
+
self._out_message._send(sequence_number)
|
970
|
+
code = self._in_message._read_message_sysio(sequence_number, allowedErrors)
|
971
|
+
if code != 0:
|
972
|
+
return None
|
973
|
+
if return_type == None:
|
974
|
+
returned_value = None
|
975
|
+
elif return_type == tuple:
|
976
|
+
returned_value = (self._unmarshal_return_value(str, mode, self._locale, self._is_unicode, self._connection.compact_double), self._unmarshal_return_value(object, mode, self._locale, self._is_unicode, self._connection.compact_double))
|
977
|
+
else:
|
978
|
+
returned_value = self._unmarshal_return_value(return_type, mode, self._locale, self._is_unicode, self._connection.compact_double)
|
979
|
+
if honorByReference and args != None:
|
980
|
+
self._process_pass_by_reference(*args)
|
981
|
+
self._release_closed_iris_object()
|
982
|
+
return returned_value
|
983
|
+
|
984
|
+
def _marshal_parameters(self, *args, mode, honorByReference):
|
985
|
+
self._out_message.wire._set(len(args))
|
986
|
+
for arg in args:
|
987
|
+
self._marshal_one_parameter(arg, mode = mode, honorByReference = honorByReference)
|
988
|
+
return
|
989
|
+
|
990
|
+
def _marshal_one_parameter(self, arg, *, mode, honorByReference):
|
991
|
+
is_reference = honorByReference and type(arg) == intersystems_iris.IRISReference
|
992
|
+
if is_reference:
|
993
|
+
arg = arg.get_value()
|
994
|
+
self._out_message.wire._save_current_offset()
|
995
|
+
if intersystems_iris._PythonGateway._PythonGateway._is_datatype(type(arg)):
|
996
|
+
self._out_message.wire._set(arg, True)
|
997
|
+
elif mode == intersystems_iris.IRIS.MODE_GLOBAL and type(arg) == bytearray:
|
998
|
+
self._out_message.wire._set(arg)
|
999
|
+
elif type(arg) == intersystems_iris.IRISList:
|
1000
|
+
if not self._connection.compact_double and arg.compact_double:
|
1001
|
+
raise ValueError("Cannot store an IRISList with Compact Double enabled on a server with Compact Double disabled")
|
1002
|
+
self._out_message.wire._set(arg.getBuffer())
|
1003
|
+
else:
|
1004
|
+
if mode == intersystems_iris.IRIS.MODE_GLOBAL:
|
1005
|
+
raise TypeError("Unsupported type as global subscript: " + type(arg).__name__)
|
1006
|
+
oref = self._connection._oref_registry_lookup(arg)
|
1007
|
+
if oref is None:
|
1008
|
+
oref = self._connection._map_local_object_to_oref(self._in_message_secondary, self._out_message_secondary, arg)
|
1009
|
+
if oref != None:
|
1010
|
+
self._out_message.wire._set(intersystems_iris._IRISOREF._IRISOREF(oref))
|
1011
|
+
else:
|
1012
|
+
raise _GatewayException._GatewayException("Unable to map object: " + arg)
|
1013
|
+
if is_reference:
|
1014
|
+
self._out_message.wire._set_saved_offset_type_as_pass_by_reference()
|
1015
|
+
return
|
1016
|
+
|
1017
|
+
def _unmarshal_return_value(self, return_type, mode, locale, is_unicode, compact_double):
|
1018
|
+
asBytes = return_type != str and return_type != object
|
1019
|
+
value = self._in_message.wire._get(asBytes, True)
|
1020
|
+
if self._in_message.wire.list_item.is_undefined:
|
1021
|
+
return None
|
1022
|
+
if type(value) == intersystems_iris._IRISOREF._IRISOREF:
|
1023
|
+
if return_type == object:
|
1024
|
+
return self._connection._map_local_object_from_oref(value._oref)
|
1025
|
+
else:
|
1026
|
+
self._connection._close_unused_oref(value._oref)
|
1027
|
+
value = value._oref
|
1028
|
+
if return_type == bool:
|
1029
|
+
return intersystems_iris.IRIS._convertToBoolean(value, mode, locale)
|
1030
|
+
elif return_type == bytes:
|
1031
|
+
return intersystems_iris.IRIS._convertToBytes(value, mode, locale, is_unicode)
|
1032
|
+
elif return_type == bytearray:
|
1033
|
+
return bytearray(intersystems_iris.IRIS._convertToBytes(value, mode, locale, is_unicode))
|
1034
|
+
elif return_type == decimal.Decimal:
|
1035
|
+
return intersystems_iris.IRIS._convertToDecimal(value, mode, locale)
|
1036
|
+
elif return_type == float:
|
1037
|
+
return intersystems_iris.IRIS._convertToFloat(value, mode, locale)
|
1038
|
+
elif return_type == int:
|
1039
|
+
return intersystems_iris.IRIS._convertToInteger(value, mode, locale)
|
1040
|
+
elif return_type == str:
|
1041
|
+
return intersystems_iris.IRIS._convertToString(value, mode, locale)
|
1042
|
+
elif return_type == object:
|
1043
|
+
return intersystems_iris.IRIS._convertToObject(value, mode, locale)
|
1044
|
+
elif return_type == intersystems_iris.IRISList:
|
1045
|
+
if value == None:
|
1046
|
+
return intersystems_iris.IRISList(None, locale, is_unicode, compact_double) if mode == intersystems_iris.IRIS.MODE_GLOBAL else None
|
1047
|
+
return intersystems_iris.IRISList(intersystems_iris.IRIS._convertToBytes(value, mode, locale, is_unicode), locale, is_unicode, compact_double)
|
1048
|
+
else:
|
1049
|
+
return intersystems_iris.IRIS._convertToObject(value, mode, locale)
|
1050
|
+
|
1051
|
+
def _process_pass_by_reference(self, *args):
|
1052
|
+
for arg in args:
|
1053
|
+
if type(arg) == intersystems_iris.IRISReference:
|
1054
|
+
value = self._unmarshal_return_value(object, intersystems_iris.IRIS.MODE_RUNTIME, self._locale, self._is_unicode, self._connection.compact_double)
|
1055
|
+
arg._value = value
|
1056
|
+
arg._locale = self._locale
|
1057
|
+
arg._is_unicode = self._is_unicode
|
1058
|
+
return
|
1059
|
+
|
1060
|
+
@staticmethod
|
1061
|
+
def __parse_iris_number(value, return_type):
|
1062
|
+
if len(value)==0:
|
1063
|
+
return return_type(0)
|
1064
|
+
if type(value) == bytes:
|
1065
|
+
value = value.decode("latin-1")
|
1066
|
+
if value[0:3].lower() == "inf":
|
1067
|
+
return 0 if return_type == int else return_type("inf")
|
1068
|
+
if value[0:4].lower() == "-inf":
|
1069
|
+
return 0 if return_type == int else return_type("-inf")
|
1070
|
+
if value[0:3].lower() == "nan" or value[0:4].lower() == "-nan" or value[0:4].lower() == "snan" or value[0:5].lower() == "-snan":
|
1071
|
+
return 0 if return_type == int else return_type("nan")
|
1072
|
+
beginning = True
|
1073
|
+
acceptDot = True
|
1074
|
+
negative = False
|
1075
|
+
base = ""
|
1076
|
+
i = 0
|
1077
|
+
for i in range(len(value)):
|
1078
|
+
if value[i] == "+" and beginning:
|
1079
|
+
continue
|
1080
|
+
if value[i] == "-" and beginning:
|
1081
|
+
negative = not negative
|
1082
|
+
continue
|
1083
|
+
if value[i] == "." and acceptDot:
|
1084
|
+
base = base + "."
|
1085
|
+
beginning = False
|
1086
|
+
acceptDot = False
|
1087
|
+
continue
|
1088
|
+
if ord(value[i]) >= 48 and ord(value[i]) <= 57:
|
1089
|
+
base = base + value[i]
|
1090
|
+
beginning = False
|
1091
|
+
continue
|
1092
|
+
break
|
1093
|
+
power = ""
|
1094
|
+
if value[i] == "E" or value[i] == "e":
|
1095
|
+
i = i+1
|
1096
|
+
if value[i] == "+" or value[i] == "-":
|
1097
|
+
power = value[i]
|
1098
|
+
i = i+1
|
1099
|
+
for j in range(i, len(value), 1):
|
1100
|
+
if 48 <= ord(value[j]) <= 57 :
|
1101
|
+
power = power + value[j]
|
1102
|
+
continue
|
1103
|
+
break
|
1104
|
+
if power == "" or power == "+" or power == "-":
|
1105
|
+
result = ("-" if negative else "") + base
|
1106
|
+
else:
|
1107
|
+
result = ("-" if negative else "") + base + "E" + power
|
1108
|
+
if len(result)==0:
|
1109
|
+
return return_type(0)
|
1110
|
+
if return_type == float:
|
1111
|
+
return float(result)
|
1112
|
+
result = intersystems_iris.IRIS._remove_scientific_notation(result)
|
1113
|
+
if return_type == int:
|
1114
|
+
return int(result.split(".")[0])
|
1115
|
+
else:
|
1116
|
+
return decimal.Decimal(result)
|
1117
|
+
|
1118
|
+
@staticmethod
|
1119
|
+
def _convertToBoolean(value, mode, locale):
|
1120
|
+
if value == None:
|
1121
|
+
return False if mode == intersystems_iris.IRIS.MODE_GLOBAL else None
|
1122
|
+
if type(value) == bool:
|
1123
|
+
return value
|
1124
|
+
return intersystems_iris.IRIS._convertToFloat(value, mode, locale) != 0
|
1125
|
+
|
1126
|
+
@staticmethod
|
1127
|
+
def _convertToBytes(value, mode, locale, is_unicode):
|
1128
|
+
if value == None:
|
1129
|
+
return bytes() if mode == intersystems_iris.IRIS.MODE_GLOBAL else None
|
1130
|
+
if type(value) == bool:
|
1131
|
+
return b'1' if value else b'0'
|
1132
|
+
if type(value) == bytes:
|
1133
|
+
return value
|
1134
|
+
if type(value) == decimal.Decimal:
|
1135
|
+
return bytes(intersystems_iris.IRIS._convert_decimal_to_str(value),"latin_1")
|
1136
|
+
if type(value) == float:
|
1137
|
+
return bytes(intersystems_iris.IRIS._convert_float_to_str(value),"latin_1")
|
1138
|
+
if type(value) == int:
|
1139
|
+
return bytes(str(value),"latin_1")
|
1140
|
+
if type(value) == str:
|
1141
|
+
try:
|
1142
|
+
return value.encode(locale)
|
1143
|
+
except UnicodeEncodeError as e:
|
1144
|
+
if is_unicode:
|
1145
|
+
return value.encode("utf-16LE")
|
1146
|
+
else:
|
1147
|
+
raise e
|
1148
|
+
raise RuntimeError("the value of this node cannot be interpreted as a bytes.")
|
1149
|
+
|
1150
|
+
@staticmethod
|
1151
|
+
def _convertToDecimal(value, mode, locale):
|
1152
|
+
if value == None:
|
1153
|
+
return decimal.Decimal(0) if mode == intersystems_iris.IRIS.MODE_GLOBAL else None
|
1154
|
+
if type(value) == bytes:
|
1155
|
+
return intersystems_iris.IRIS.__parse_iris_number(value, decimal.Decimal)
|
1156
|
+
if type(value) == bool:
|
1157
|
+
return decimal.Decimal(1) if value else decimal.Decimal(0)
|
1158
|
+
if type(value) == decimal.Decimal:
|
1159
|
+
return value
|
1160
|
+
if type(value) == float:
|
1161
|
+
return decimal.Decimal(value)
|
1162
|
+
if type(value) == int:
|
1163
|
+
return decimal.Decimal(value)
|
1164
|
+
if type(value) == str:
|
1165
|
+
return intersystems_iris.IRIS.__parse_iris_number(value, decimal.Decimal)
|
1166
|
+
raise RuntimeError("the value of this node cannot be interpreted as a decimal.Decimal.")
|
1167
|
+
|
1168
|
+
@staticmethod
|
1169
|
+
def _convertToFloat(value, mode, locale):
|
1170
|
+
if value == None:
|
1171
|
+
return 0.0 if mode == intersystems_iris.IRIS.MODE_GLOBAL else None
|
1172
|
+
if type(value) == bool:
|
1173
|
+
return 1.0 if value else 0.0
|
1174
|
+
if type(value) == bytes:
|
1175
|
+
return intersystems_iris.IRIS.__parse_iris_number(value, float)
|
1176
|
+
if type(value) == decimal.Decimal:
|
1177
|
+
return float(value)
|
1178
|
+
if type(value) == float:
|
1179
|
+
return value
|
1180
|
+
if type(value) == int:
|
1181
|
+
return float(value)
|
1182
|
+
if type(value) == str:
|
1183
|
+
return intersystems_iris.IRIS.__parse_iris_number(value, float)
|
1184
|
+
raise RuntimeError("the value of this node cannot be interpreted as a float.")
|
1185
|
+
|
1186
|
+
@staticmethod
|
1187
|
+
def _convertToInteger(value, mode, locale):
|
1188
|
+
if value == None:
|
1189
|
+
return 0 if mode == intersystems_iris.IRIS.MODE_GLOBAL else None
|
1190
|
+
if type(value) == bool:
|
1191
|
+
return 1 if value else 0
|
1192
|
+
if type(value) == bytes:
|
1193
|
+
return intersystems_iris.IRIS.__parse_iris_number(value, int)
|
1194
|
+
if type(value) == decimal.Decimal:
|
1195
|
+
return int(value)
|
1196
|
+
if type(value) == float:
|
1197
|
+
return int(value)
|
1198
|
+
if type(value) == int:
|
1199
|
+
return value
|
1200
|
+
if type(value) == str:
|
1201
|
+
return intersystems_iris.IRIS.__parse_iris_number(value, int)
|
1202
|
+
raise RuntimeError("the value of this node cannot be interpreted as a int.")
|
1203
|
+
|
1204
|
+
@staticmethod
|
1205
|
+
def _convertToString(value, mode, locale):
|
1206
|
+
if value == None:
|
1207
|
+
return "" if mode == intersystems_iris.IRIS.MODE_GLOBAL else None
|
1208
|
+
if type(value) == bool:
|
1209
|
+
return "1" if value else "0"
|
1210
|
+
if type(value) == bytes:
|
1211
|
+
return value.decode(locale)
|
1212
|
+
if type(value) == decimal.Decimal:
|
1213
|
+
return intersystems_iris.IRIS._convert_decimal_to_str(value)
|
1214
|
+
if type(value) == float:
|
1215
|
+
return intersystems_iris.IRIS._convert_float_to_str(value)
|
1216
|
+
if type(value) == int:
|
1217
|
+
return str(value)
|
1218
|
+
if type(value) == str:
|
1219
|
+
return value
|
1220
|
+
raise RuntimeError("the value of this node cannot be interpreted as a str.")
|
1221
|
+
|
1222
|
+
@staticmethod
|
1223
|
+
def _convertToObject(value, mode, locale):
|
1224
|
+
if value == None:
|
1225
|
+
return "" if mode == intersystems_iris.IRIS.MODE_GLOBAL else None
|
1226
|
+
return value
|
1227
|
+
|
1228
|
+
@staticmethod
|
1229
|
+
def _convert_float_to_str(value):
|
1230
|
+
if math.isinf(value) and value > 0:
|
1231
|
+
return "INF"
|
1232
|
+
if math.isinf(value) and value < 0:
|
1233
|
+
return "-INF"
|
1234
|
+
if math.isnan(value):
|
1235
|
+
return "NAN"
|
1236
|
+
float_context = decimal.Context(prec=20, rounding=decimal.ROUND_05UP, Emin=-308, Emax=308, capitals=1)
|
1237
|
+
value = str(float_context.create_decimal(value))
|
1238
|
+
return intersystems_iris.IRIS._remove_scientific_notation(value)
|
1239
|
+
|
1240
|
+
@staticmethod
|
1241
|
+
def _convert_decimal_to_str(value):
|
1242
|
+
return intersystems_iris.IRIS._remove_scientific_notation(str(value))
|
1243
|
+
|
1244
|
+
@staticmethod
|
1245
|
+
def _remove_scientific_notation(value):
|
1246
|
+
if value.startswith("-"):
|
1247
|
+
negative_sign = "-"
|
1248
|
+
value = value[1:]
|
1249
|
+
else:
|
1250
|
+
negative_sign = ""
|
1251
|
+
if "E" in value:
|
1252
|
+
number = value.split("E")[0]
|
1253
|
+
exponent = int(value.split("E")[1])
|
1254
|
+
else:
|
1255
|
+
number = value
|
1256
|
+
exponent = 0
|
1257
|
+
if exponent>0:
|
1258
|
+
if "." in number:
|
1259
|
+
index = number.index(".")
|
1260
|
+
if exponent - len(number) + index + 1 >0:
|
1261
|
+
number = number + "0" * (exponent - len(number) + index + 1)
|
1262
|
+
number = number[0:index] + number[index+1:index+exponent+1] + "." + number[index+exponent+1:]
|
1263
|
+
if number.endswith("."):
|
1264
|
+
number = number[:-1]
|
1265
|
+
else:
|
1266
|
+
number = number + ("0" * exponent)
|
1267
|
+
elif exponent<0:
|
1268
|
+
exponent = abs(exponent)
|
1269
|
+
if "." not in value:
|
1270
|
+
number = number + "."
|
1271
|
+
index = number.index(".")
|
1272
|
+
if index < exponent:
|
1273
|
+
number = ("0" * (exponent - index)) + number
|
1274
|
+
index = exponent
|
1275
|
+
number = number[0:index-exponent]+"."+number[index-exponent:index]+number[index+1:]
|
1276
|
+
if "." in number:
|
1277
|
+
while number.endswith("0"): number = number[:-1]
|
1278
|
+
if number.endswith("."): number = number[:-1]
|
1279
|
+
while number.startswith("0"):
|
1280
|
+
number = number[1:]
|
1281
|
+
if number == "" or number == ".":
|
1282
|
+
return "0"
|
1283
|
+
return negative_sign + number
|
1284
|
+
|
1285
|
+
def _release_closed_iris_object(self, force = False):
|
1286
|
+
if not force and len(self._connection._iris_object_proxy_closed) <= intersystems_iris.IRISConnection.CLOSED_PROXY_UPDATE_THRESHOLD:
|
1287
|
+
return
|
1288
|
+
closed_iris_objects = self._connection._get_closed_iris_objects()
|
1289
|
+
closed_orefs = self._execute(str, intersystems_iris.IRIS.VALUE_CLASSMETHOD, "%Net.Remote.Gateway", "%ReleaseObjects", [closed_iris_objects])
|
1290
|
+
if closed_orefs != None:
|
1291
|
+
closed_orefs_list = closed_orefs.split(",")
|
1292
|
+
for i in range(len(closed_orefs_list)):
|
1293
|
+
del self._connection._oref_registry[closed_orefs_list[i]]
|
1294
|
+
return
|