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,360 @@
|
|
1
|
+
import intersystems_iris._DBList
|
2
|
+
import intersystems_iris._ListReader
|
3
|
+
import intersystems_iris._ListWriter
|
4
|
+
import intersystems_iris._IRIS
|
5
|
+
|
6
|
+
class _IRISList(object):
|
7
|
+
'''
|
8
|
+
This class provides an interface to interact with IRIS $LIST data.
|
9
|
+
'''
|
10
|
+
|
11
|
+
def __init__(self, buffer = None, locale = "latin-1", is_unicode = True, compact_double = False):
|
12
|
+
self._list_data = []
|
13
|
+
self._locale = locale
|
14
|
+
self._is_unicode = is_unicode
|
15
|
+
self.compact_double = compact_double
|
16
|
+
try:
|
17
|
+
if buffer == None:
|
18
|
+
return
|
19
|
+
if type(buffer) == intersystems_iris.IRISList:
|
20
|
+
buffer = buffer.getBuffer()
|
21
|
+
if type(buffer) == bytes or type(buffer) == bytearray:
|
22
|
+
list_reader = intersystems_iris._ListReader._ListReader(buffer, locale)
|
23
|
+
while not list_reader._is_end():
|
24
|
+
value = list_reader._get(True)
|
25
|
+
if value is None and list_reader.list_item.type != intersystems_iris._DBList._DBList.ITEM_UNDEF:
|
26
|
+
value = bytes()
|
27
|
+
self._list_data.append(value)
|
28
|
+
return
|
29
|
+
except Exception as ex:
|
30
|
+
pass
|
31
|
+
raise Exception("data is not valid for IRISList format")
|
32
|
+
|
33
|
+
def get(self, index):
|
34
|
+
'''
|
35
|
+
Returns the value at a given index.
|
36
|
+
|
37
|
+
get(index)
|
38
|
+
|
39
|
+
Parameters
|
40
|
+
----------
|
41
|
+
index : one-based index of the IRISList.
|
42
|
+
|
43
|
+
Return Value
|
44
|
+
------------
|
45
|
+
Returns bytes, Decimal, float, int, str, or IRISList.
|
46
|
+
'''
|
47
|
+
raw_data = self._list_data[index-1]
|
48
|
+
if type(raw_data) == intersystems_iris.IRISList:
|
49
|
+
raw_data = raw_data.getBuffer()
|
50
|
+
if type(raw_data) == bytes:
|
51
|
+
return intersystems_iris.IRIS._convertToString(raw_data, intersystems_iris.IRIS.MODE_LIST, self._locale)
|
52
|
+
return raw_data
|
53
|
+
|
54
|
+
def getBoolean(self, index):
|
55
|
+
'''
|
56
|
+
Returns the value at a given index as a boolean.
|
57
|
+
|
58
|
+
getBoolean(index)
|
59
|
+
|
60
|
+
Parameters
|
61
|
+
----------
|
62
|
+
index : one-based index of the IRISList.
|
63
|
+
|
64
|
+
Return Value
|
65
|
+
------------
|
66
|
+
Returns bool.
|
67
|
+
'''
|
68
|
+
raw_data = self._list_data[index-1]
|
69
|
+
if type(raw_data) == intersystems_iris.IRISList:
|
70
|
+
raw_data = raw_data.getBuffer()
|
71
|
+
return intersystems_iris.IRIS._convertToBoolean(raw_data, intersystems_iris.IRIS.MODE_LIST, self._locale)
|
72
|
+
|
73
|
+
def getBytes(self, index):
|
74
|
+
'''
|
75
|
+
Returns the value at a given index as bytes.
|
76
|
+
|
77
|
+
getBytes(index)
|
78
|
+
|
79
|
+
Parameters
|
80
|
+
----------
|
81
|
+
index : one-based index of the IRISList.
|
82
|
+
|
83
|
+
Return Value
|
84
|
+
------------
|
85
|
+
Returns bytes.
|
86
|
+
'''
|
87
|
+
raw_data = self._list_data[index-1]
|
88
|
+
if type(raw_data) == intersystems_iris.IRISList:
|
89
|
+
return raw_data.getBuffer()
|
90
|
+
return intersystems_iris.IRIS._convertToBytes(raw_data, intersystems_iris.IRIS.MODE_LIST, self._locale, self._is_unicode)
|
91
|
+
|
92
|
+
def getDecimal(self, index):
|
93
|
+
'''
|
94
|
+
Returns the value at a given index as a Decimal.
|
95
|
+
|
96
|
+
getDecimal(index)
|
97
|
+
|
98
|
+
Parameters
|
99
|
+
----------
|
100
|
+
index : one-based index of the IRISList.
|
101
|
+
|
102
|
+
Return Value
|
103
|
+
------------
|
104
|
+
Returns Decimal.
|
105
|
+
'''
|
106
|
+
raw_data = self._list_data[index-1]
|
107
|
+
if type(raw_data) == intersystems_iris.IRISList:
|
108
|
+
raw_data = raw_data.getBuffer()
|
109
|
+
return intersystems_iris.IRIS._convertToDecimal(raw_data, intersystems_iris.IRIS.MODE_LIST, self._locale)
|
110
|
+
|
111
|
+
def getFloat(self, index):
|
112
|
+
'''
|
113
|
+
Returns the value at a given index as a float.
|
114
|
+
|
115
|
+
getFloat(index)
|
116
|
+
|
117
|
+
Parameters
|
118
|
+
----------
|
119
|
+
index : one-based index of the IRISList.
|
120
|
+
|
121
|
+
Return Value
|
122
|
+
------------
|
123
|
+
Returns float.
|
124
|
+
'''
|
125
|
+
raw_data = self._list_data[index-1]
|
126
|
+
if type(raw_data) == intersystems_iris.IRISList:
|
127
|
+
raw_data = raw_data.getBuffer()
|
128
|
+
return intersystems_iris.IRIS._convertToFloat(raw_data, intersystems_iris.IRIS.MODE_LIST, self._locale)
|
129
|
+
|
130
|
+
def getInteger(self, index):
|
131
|
+
'''
|
132
|
+
Returns the value at a given index as an integer.
|
133
|
+
|
134
|
+
getInteger(index)
|
135
|
+
|
136
|
+
Parameters
|
137
|
+
----------
|
138
|
+
index : one-based index of the IRISList.
|
139
|
+
|
140
|
+
Return Value
|
141
|
+
------------
|
142
|
+
Returns int.
|
143
|
+
'''
|
144
|
+
raw_data = self._list_data[index-1]
|
145
|
+
if type(raw_data) == intersystems_iris.IRISList:
|
146
|
+
raw_data = raw_data.getBuffer()
|
147
|
+
return intersystems_iris.IRIS._convertToInteger(raw_data, intersystems_iris.IRIS.MODE_LIST, self._locale)
|
148
|
+
|
149
|
+
def getString(self, index):
|
150
|
+
'''
|
151
|
+
Returns the value at a given index as a string.
|
152
|
+
|
153
|
+
getString(index)
|
154
|
+
|
155
|
+
Parameters
|
156
|
+
----------
|
157
|
+
index : one-based index of the IRISList.
|
158
|
+
|
159
|
+
Return Value
|
160
|
+
------------
|
161
|
+
Returns str.
|
162
|
+
'''
|
163
|
+
raw_data = self._list_data[index-1]
|
164
|
+
if type(raw_data) == intersystems_iris.IRISList:
|
165
|
+
raw_data = raw_data.getBuffer()
|
166
|
+
return intersystems_iris.IRIS._convertToString(raw_data, intersystems_iris.IRIS.MODE_LIST, self._locale)
|
167
|
+
|
168
|
+
def getIRISList(self, index):
|
169
|
+
'''
|
170
|
+
Returns the value at a given index as an IRISList.
|
171
|
+
|
172
|
+
getBytes(index)
|
173
|
+
|
174
|
+
Parameters
|
175
|
+
----------
|
176
|
+
index : one-based index of the IRISList.
|
177
|
+
|
178
|
+
Return Value
|
179
|
+
------------
|
180
|
+
Returns IRISList.
|
181
|
+
'''
|
182
|
+
raw_data = self._list_data[index-1]
|
183
|
+
if type(raw_data) == intersystems_iris.IRISList or raw_data == None:
|
184
|
+
return raw_data
|
185
|
+
return intersystems_iris.IRISList(intersystems_iris.IRIS._convertToBytes(raw_data, intersystems_iris.IRIS.MODE_LIST, self._locale, self._is_unicode), self._locale, self._is_unicode, self.compact_double)
|
186
|
+
|
187
|
+
def add(self, value):
|
188
|
+
'''
|
189
|
+
Adds a data element at the end of the IRISList.
|
190
|
+
|
191
|
+
add(value)
|
192
|
+
|
193
|
+
Parameters
|
194
|
+
----------
|
195
|
+
value : value of the data to be added.
|
196
|
+
|
197
|
+
Return Value
|
198
|
+
------------
|
199
|
+
Returns the current IRISList object.
|
200
|
+
'''
|
201
|
+
self._list_data.append(self._convertToInternal(value))
|
202
|
+
return self
|
203
|
+
|
204
|
+
def set(self, index, value):
|
205
|
+
'''
|
206
|
+
Change data element at a given index location. If the index is beyond the length of the IRISList, IRISList will be first expanded to that many elements, paded with None elements.
|
207
|
+
|
208
|
+
set(index, value)
|
209
|
+
|
210
|
+
Parameters
|
211
|
+
----------
|
212
|
+
index: index at which the data is set to. index is one-based.
|
213
|
+
value : value of the data to be added.
|
214
|
+
|
215
|
+
Return Value
|
216
|
+
------------
|
217
|
+
Returns the current IRISList object.
|
218
|
+
'''
|
219
|
+
if index>len(self._list_data):
|
220
|
+
self._list_data.extend([None]*(index-len(self._list_data)))
|
221
|
+
self._list_data[index-1] = self._convertToInternal(value)
|
222
|
+
return self
|
223
|
+
|
224
|
+
def _convertToInternal(self, value):
|
225
|
+
if type(value) == bytearray:
|
226
|
+
return bytes(value)
|
227
|
+
if type(value) == intersystems_iris.IRISList:
|
228
|
+
if not self.compact_double and value.compact_double:
|
229
|
+
raise ValueError("Cannot embed an IRISList with Compact Double enabled into an IRISList with Compact Double disabled")
|
230
|
+
return intersystems_iris.IRISList(value.getBuffer(), value._locale, value._is_unicode, value.compact_double)
|
231
|
+
return value
|
232
|
+
|
233
|
+
def remove(self, index):
|
234
|
+
'''
|
235
|
+
Remove a data element at a given index location.
|
236
|
+
|
237
|
+
remove(index, value)
|
238
|
+
|
239
|
+
Parameters
|
240
|
+
----------
|
241
|
+
index: index at which the data is to be removed. index is one-based.
|
242
|
+
|
243
|
+
Return Value
|
244
|
+
------------
|
245
|
+
Returns the current IRISList object.
|
246
|
+
'''
|
247
|
+
del self._list_data[index-1]
|
248
|
+
return self
|
249
|
+
|
250
|
+
def size(self):
|
251
|
+
'''
|
252
|
+
Return the length of the data buffer
|
253
|
+
|
254
|
+
size()
|
255
|
+
|
256
|
+
Return Value
|
257
|
+
------------
|
258
|
+
Returns int.
|
259
|
+
'''
|
260
|
+
return len(self.getBuffer())
|
261
|
+
|
262
|
+
def count(self):
|
263
|
+
'''
|
264
|
+
Return the unmber of data elements in the IRISList.
|
265
|
+
|
266
|
+
count()
|
267
|
+
|
268
|
+
Return Value
|
269
|
+
------------
|
270
|
+
Returns int.
|
271
|
+
'''
|
272
|
+
return len(self._list_data)
|
273
|
+
|
274
|
+
def clear(self):
|
275
|
+
'''
|
276
|
+
Clears out all data in the IRISList.
|
277
|
+
|
278
|
+
clear()
|
279
|
+
|
280
|
+
Return Value
|
281
|
+
------------
|
282
|
+
Returns the current IRISList object.
|
283
|
+
'''
|
284
|
+
self._list_data = []
|
285
|
+
return self
|
286
|
+
|
287
|
+
def equals(self, irislist2):
|
288
|
+
'''
|
289
|
+
Returns a boolean indicate if the IRISList is the same as the IRISList of the argument
|
290
|
+
|
291
|
+
equals(irislist2)
|
292
|
+
|
293
|
+
Parameters
|
294
|
+
----------
|
295
|
+
irislist2: the second IRISList object to which to compare.
|
296
|
+
|
297
|
+
Return Value
|
298
|
+
------------
|
299
|
+
Returns bool.
|
300
|
+
'''
|
301
|
+
if type(irislist2) != intersystems_iris.IRISList:
|
302
|
+
raise TypeError("Argument must be an instance of iris.IRISList")
|
303
|
+
if len(self._list_data) != len(irislist2._list_data):
|
304
|
+
return False
|
305
|
+
for i in range(len(self._list_data)):
|
306
|
+
if self.get(i+1) != irislist2.get(i+1):
|
307
|
+
return False
|
308
|
+
return True
|
309
|
+
|
310
|
+
def __str__(self):
|
311
|
+
display = []
|
312
|
+
for i in range(len(self._list_data)):
|
313
|
+
raw_data = self._list_data[i]
|
314
|
+
if type(raw_data) == intersystems_iris.IRISList:
|
315
|
+
raw_data = raw_data.__str__()
|
316
|
+
elif type(raw_data) == bool:
|
317
|
+
raw_data = 1 if raw_data else 0
|
318
|
+
if type(raw_data) == bytes:
|
319
|
+
try:
|
320
|
+
if len(raw_data) == 0:
|
321
|
+
one_value = "empty"
|
322
|
+
else:
|
323
|
+
one_value = intersystems_iris.IRISList(raw_data).__str__()
|
324
|
+
except Exception:
|
325
|
+
one_value = str(raw_data)
|
326
|
+
elif type(raw_data) == str:
|
327
|
+
try:
|
328
|
+
if len(raw_data) == 0:
|
329
|
+
one_value = "empty"
|
330
|
+
else:
|
331
|
+
one_value = intersystems_iris.IRISList(bytes(raw_data,"latin-1")).__str__()
|
332
|
+
except Exception:
|
333
|
+
one_value = str(raw_data)
|
334
|
+
elif type(raw_data) == int:
|
335
|
+
one_value = raw_data
|
336
|
+
else:
|
337
|
+
one_value = str(raw_data)
|
338
|
+
display.append(one_value)
|
339
|
+
return "$lb(" + ', '.join([repr(item) for item in display]) + ")"
|
340
|
+
|
341
|
+
def getBuffer(self):
|
342
|
+
'''
|
343
|
+
Returns a byte array that contains the $LIST format of all the data elements.
|
344
|
+
|
345
|
+
getBuffer()
|
346
|
+
|
347
|
+
Return Value
|
348
|
+
------------
|
349
|
+
Returns bytes.
|
350
|
+
'''
|
351
|
+
list_writer = intersystems_iris._ListWriter._ListWriter(self._locale, self._is_unicode, self.compact_double)
|
352
|
+
for i in range(len(self._list_data)):
|
353
|
+
if self._list_data[i] == None:
|
354
|
+
list_writer._set_undefined()
|
355
|
+
elif type(self._list_data[i]) == intersystems_iris.IRISList:
|
356
|
+
buffer = self._list_data[i].getBuffer()
|
357
|
+
list_writer._set(buffer)
|
358
|
+
else:
|
359
|
+
list_writer._set(self._list_data[i], True)
|
360
|
+
return bytes(list_writer._get_buffer())
|
@@ -0,0 +1,208 @@
|
|
1
|
+
import sys
|
2
|
+
import ssl
|
3
|
+
import intersystems_iris._PythonGateway
|
4
|
+
import intersystems_iris._IRIS
|
5
|
+
import intersystems_iris._IRISConnection
|
6
|
+
|
7
|
+
def connect(
|
8
|
+
*args,
|
9
|
+
connectionstr = None,
|
10
|
+
hostname = None,
|
11
|
+
port = None,
|
12
|
+
namespace = None,
|
13
|
+
username = None,
|
14
|
+
password = None,
|
15
|
+
timeout = None,
|
16
|
+
sharedmemory = None,
|
17
|
+
logfile = None,
|
18
|
+
sslcontext = None,
|
19
|
+
autoCommit=None,
|
20
|
+
isolationLevel=None,
|
21
|
+
featureOptions=None,
|
22
|
+
application_name=None,
|
23
|
+
):
|
24
|
+
'''Return a new open connection to an IRIS instance.
|
25
|
+
|
26
|
+
iris.connect(hostname,port,namespace,username,password,timeout,sharedmemory,logfile,sslcontext,autoCommit,isolationLevel,featureOptions)
|
27
|
+
|
28
|
+
iris.connect(connectionstr,username,password,timeout,sharedmemory,logfile,sslcontext,autoCommit,isolationLevel,featureOptions)
|
29
|
+
|
30
|
+
Parameters may be passed by position or keyword.
|
31
|
+
|
32
|
+
Parameters
|
33
|
+
----------
|
34
|
+
hostname : Unicode string
|
35
|
+
IRIS instance URL
|
36
|
+
port : int/long
|
37
|
+
IRIS superserver port number
|
38
|
+
namespace : Unicode string
|
39
|
+
IRIS namespace
|
40
|
+
username : Unicode string
|
41
|
+
IRIS user
|
42
|
+
password : Unicode string
|
43
|
+
IRIS user password
|
44
|
+
timeout : int/long, optional
|
45
|
+
maximum number of seconds to wait while attempting the connection. defaults to 10
|
46
|
+
sharedmemory : bool, optional
|
47
|
+
set to True to attempt a shared memory connection when the hostname
|
48
|
+
is localhost or 127.0.0.1. set to false to force a connection over
|
49
|
+
TCP/IP. defaults to True.
|
50
|
+
logfile : Unicode string, optional
|
51
|
+
client-side log file path. the maximum path length is 255 ASCII characters.
|
52
|
+
connectionstr : Unicode string, optional
|
53
|
+
"hostname:port/namespace". use this instead of the hostname, port,
|
54
|
+
and namespace
|
55
|
+
sslcontext : ssl.SSLContext object, optional
|
56
|
+
SSL context to be used for SSL connection
|
57
|
+
If None, a non-SSL connection will be used
|
58
|
+
autoCommit : bool, optional
|
59
|
+
Indicates if IRIS auto-commit is enabled
|
60
|
+
isolationLevel : int, optional
|
61
|
+
Indicates iris.dbapi isolation level
|
62
|
+
PLEASE NOTE: isolationLevel is currently deactivated. Any value passed in is ignored.
|
63
|
+
featureOptions : int, optional
|
64
|
+
With a series of bit flags, it specifies whether certain features are enabled or disabled.
|
65
|
+
|
66
|
+
Returns
|
67
|
+
-------
|
68
|
+
iris.IRISConnection
|
69
|
+
A new client connection to an IRIS server
|
70
|
+
'''
|
71
|
+
has_TypeError = True
|
72
|
+
while True:
|
73
|
+
if connectionstr != None:
|
74
|
+
if len(args) > 0:
|
75
|
+
break
|
76
|
+
if hostname != None or port != None or namespace != None:
|
77
|
+
break
|
78
|
+
if username == None or password == None:
|
79
|
+
break
|
80
|
+
hostname = connectionstr.split(":")[0]
|
81
|
+
port = int(connectionstr.split(":")[1].split("/")[0])
|
82
|
+
namespace = connectionstr.split(":")[1].split("/")[1]
|
83
|
+
has_TypeError = False
|
84
|
+
break
|
85
|
+
if hostname != None:
|
86
|
+
if len(args) > 0:
|
87
|
+
break
|
88
|
+
if port == None or namespace == None or username == None or password == None:
|
89
|
+
break
|
90
|
+
has_TypeError = False
|
91
|
+
break
|
92
|
+
if len(args) <= 0:
|
93
|
+
break
|
94
|
+
if ":" in args[0]:
|
95
|
+
hostname = args[0].split(":")[0]
|
96
|
+
port = int(args[0].split(":")[1].split("/")[0])
|
97
|
+
namespace = args[0].split(":")[1].split("/")[1]
|
98
|
+
consumed = 1
|
99
|
+
else:
|
100
|
+
if len(args)<3:
|
101
|
+
break
|
102
|
+
hostname = args[0]
|
103
|
+
port = args[1]
|
104
|
+
namespace = args[2]
|
105
|
+
consumed = 3
|
106
|
+
if len(args) <= consumed:
|
107
|
+
has_TypeError = False
|
108
|
+
break
|
109
|
+
if username != None:
|
110
|
+
break
|
111
|
+
username = args[consumed]
|
112
|
+
consumed += 1
|
113
|
+
if len(args) <= consumed:
|
114
|
+
has_TypeError = False
|
115
|
+
break
|
116
|
+
if password != None:
|
117
|
+
break
|
118
|
+
password = args[consumed]
|
119
|
+
consumed += 1
|
120
|
+
if len(args) <= consumed:
|
121
|
+
has_TypeError = False
|
122
|
+
break
|
123
|
+
if timeout != None:
|
124
|
+
break
|
125
|
+
timeout = args[consumed]
|
126
|
+
consumed += 1
|
127
|
+
if len(args) <= consumed:
|
128
|
+
has_TypeError = False
|
129
|
+
break
|
130
|
+
if sharedmemory != None:
|
131
|
+
break
|
132
|
+
sharedmemory = args[consumed]
|
133
|
+
consumed += 1
|
134
|
+
if len(args) <= consumed:
|
135
|
+
has_TypeError = False
|
136
|
+
break
|
137
|
+
if logfile != None:
|
138
|
+
break
|
139
|
+
logfile = args[consumed]
|
140
|
+
consumed += 1
|
141
|
+
if len(args) <= consumed:
|
142
|
+
has_TypeError = False
|
143
|
+
break
|
144
|
+
if sslcontext != None:
|
145
|
+
break
|
146
|
+
sslcontext = args[consumed]
|
147
|
+
consumed += 1
|
148
|
+
if len(args) <= consumed:
|
149
|
+
has_TypeError = False
|
150
|
+
break
|
151
|
+
if autoCommit != None:
|
152
|
+
break
|
153
|
+
autoCommit = args[consumed]
|
154
|
+
consumed += 1
|
155
|
+
if len(args) <= consumed:
|
156
|
+
has_TypeError = False
|
157
|
+
break
|
158
|
+
if isolationLevel != None:
|
159
|
+
break
|
160
|
+
isolationLevel = args[consumed]
|
161
|
+
consumed += 1
|
162
|
+
if len(args) <= consumed:
|
163
|
+
has_TypeError = False
|
164
|
+
break
|
165
|
+
if featureOptions != None:
|
166
|
+
break
|
167
|
+
featureOptions = args[consumed]
|
168
|
+
consumed += 1
|
169
|
+
if len(args) <= consumed:
|
170
|
+
has_TypeError = False
|
171
|
+
break
|
172
|
+
break
|
173
|
+
if has_TypeError or username == None or password == None:
|
174
|
+
raise TypeError("invalid arguments: hostname, port, namespace, username, password are required. timeout, sharedmemory, logfile are optional.")
|
175
|
+
timeout = 10 if timeout == None else timeout
|
176
|
+
sharedmemory = True if sharedmemory == None else sharedmemory
|
177
|
+
logfile = "" if logfile == None else logfile
|
178
|
+
autoCommit = True if autoCommit == None else bool(autoCommit)
|
179
|
+
isolationLevel = 1
|
180
|
+
featureOptions = intersystems_iris._IRISConnection.Feature.optionDefaultOptions if featureOptions == None else int(featureOptions)
|
181
|
+
connection = intersystems_iris.IRISConnection()
|
182
|
+
connection._disable_output_redirect = True
|
183
|
+
connection._connect(hostname, port, namespace, username, password, timeout, sharedmemory, logfile, sslcontext, autoCommit, isolationLevel, featureOptions, application_name)
|
184
|
+
return connection
|
185
|
+
|
186
|
+
def createIRIS(connection):
|
187
|
+
'''Return a new iris.IRIS object that uses the given connection.
|
188
|
+
|
189
|
+
iris.createIRIS(conn)
|
190
|
+
|
191
|
+
Throw an exception if the connection is closed.
|
192
|
+
|
193
|
+
Parameters
|
194
|
+
----------
|
195
|
+
conn : iris.IRISConnection
|
196
|
+
connection object to use
|
197
|
+
|
198
|
+
Returns
|
199
|
+
-------
|
200
|
+
iris.IRIS
|
201
|
+
A new IRIS object that uses the given connection.
|
202
|
+
'''
|
203
|
+
return intersystems_iris.IRIS(connection)
|
204
|
+
|
205
|
+
def createConnection(*args, **kwargs):
|
206
|
+
'''This method has been deprecated. Please use connect() method instead.
|
207
|
+
'''
|
208
|
+
return connect(*args, **kwargs)
|