21
21
from com .inductiveautomation .ignition .common import BasicDataset
22
22
from java .lang import Thread
23
23
24
- from incendium .helper .types import DictIntStringAny , SProcResult , String
24
+ from incendium .helper .types import AnyStr , DictIntStringAny , SProcResult
25
25
26
26
27
27
class DisposableConnection (object ):
@@ -32,11 +32,11 @@ class DisposableConnection(object):
32
32
resources.
33
33
"""
34
34
35
- database = None # type: String
35
+ database = None # type: AnyStr
36
36
retries = None # type: int
37
37
38
38
def __init__ (self , database , retries = 3 ):
39
- # type: (String , int) -> None
39
+ # type: (AnyStr , int) -> None
40
40
"""Disposable Connection initializer.
41
41
42
42
Args:
@@ -89,7 +89,7 @@ def __exit__(
89
89
90
90
@property
91
91
def status (self ):
92
- # type: () -> String
92
+ # type: () -> AnyStr
93
93
"""Get connection status."""
94
94
connection_info = system .db .getConnectionInfo (self .database )
95
95
return str (connection_info .getValueAt (0 , "Status" ))
@@ -100,7 +100,7 @@ class Param(object):
100
100
101
101
def __init__ (
102
102
self ,
103
- name_or_index , # type: Union[int, String ]
103
+ name_or_index , # type: Union[int, AnyStr ]
104
104
type_code , # type: int
105
105
value = None , # type: Optional[Any]
106
106
):
@@ -132,7 +132,7 @@ def __str__(self): # type: ignore[no-untyped-def]
132
132
133
133
@property
134
134
def name_or_index (self ):
135
- # type: () -> Union[int, String ]
135
+ # type: () -> Union[int, AnyStr ]
136
136
"""Get value of name_or_index."""
137
137
return self ._name_or_index
138
138
@@ -153,7 +153,7 @@ class InParam(Param):
153
153
"""Class used for declaring INPUT parameters."""
154
154
155
155
def __init__ (self , name_or_index , type_code , value ):
156
- # type: (Union[int, String ], int, Any) -> None
156
+ # type: (Union[int, AnyStr ], int, Any) -> None
157
157
"""Create an instance of InParam.
158
158
159
159
Args:
@@ -169,7 +169,7 @@ class OutParam(Param):
169
169
"""Class used for declaring OUTPUT parameters."""
170
170
171
171
def __init__ (self , name_or_index , type_code ):
172
- # type: (Union[int, String ], int) -> None
172
+ # type: (Union[int, AnyStr ], int) -> None
173
173
"""Create an instance of OutParam.
174
174
175
175
Args:
@@ -181,9 +181,9 @@ def __init__(self, name_or_index, type_code):
181
181
182
182
183
183
def _execute_sp (
184
- stored_procedure , # type: String
185
- database = "" , # type: String
186
- transaction = None , # type: Optional[String ]
184
+ stored_procedure , # type: AnyStr
185
+ database = "" , # type: AnyStr
186
+ transaction = None , # type: Optional[AnyStr ]
187
187
skip_audit = False , # type: bool
188
188
in_params = None , # type: Optional[List[InParam]]
189
189
out_params = None , # type: Optional[List[OutParam]]
@@ -262,7 +262,7 @@ def _execute_sp(
262
262
263
263
264
264
def check (stored_procedure , database = "" , params = None ):
265
- # type: (String, String , Optional[List[InParam]]) -> Optional[bool]
265
+ # type: (AnyStr, AnyStr , Optional[List[InParam]]) -> Optional[bool]
266
266
"""Execute a stored procedure against the connection.
267
267
268
268
This will return a flag set to TRUE or FALSE.
@@ -286,9 +286,9 @@ def check(stored_procedure, database="", params=None):
286
286
287
287
288
288
def execute_non_query (
289
- stored_procedure , # type: String
290
- database = "" , # type: String
291
- transaction = None , # type: Optional[String ]
289
+ stored_procedure , # type: AnyStr
290
+ database = "" , # type: AnyStr
291
+ transaction = None , # type: Optional[AnyStr ]
292
292
params = None , # type: Optional[List[InParam]]
293
293
):
294
294
# type: (...) -> int
@@ -322,8 +322,8 @@ def execute_non_query(
322
322
323
323
324
324
def get_data (
325
- stored_procedure , # type: String
326
- database = "" , # type: String
325
+ stored_procedure , # type: AnyStr
326
+ database = "" , # type: AnyStr
327
327
params = None , # type: Optional[List[InParam]]
328
328
):
329
329
# type: (...) -> BasicDataset
@@ -352,10 +352,10 @@ def get_data(
352
352
353
353
354
354
def get_output_params (
355
- stored_procedure , # type: String
355
+ stored_procedure , # type: AnyStr
356
356
output , # type: List[OutParam]
357
- database = "" , # type: String
358
- transaction = None , # type: Optional[String ]
357
+ database = "" , # type: AnyStr
358
+ transaction = None , # type: Optional[AnyStr ]
359
359
params = None , # type: Optional[List[InParam]]
360
360
):
361
361
# type: (...) -> DictIntStringAny
@@ -389,10 +389,10 @@ def get_output_params(
389
389
390
390
391
391
def get_return_value (
392
- stored_procedure , # type: String
392
+ stored_procedure , # type: AnyStr
393
393
return_type_code , # type: int
394
- database = "" , # type: String
395
- transaction = None , # type: Optional[String ]
394
+ database = "" , # type: AnyStr
395
+ transaction = None , # type: Optional[AnyStr ]
396
396
params = None , # type: Optional[List[InParam]]
397
397
):
398
398
# type: (...) -> Optional[int]
@@ -425,10 +425,10 @@ def get_return_value(
425
425
426
426
427
427
def o_execute_non_query (
428
- stored_procedure , # type: String
428
+ stored_procedure , # type: AnyStr
429
429
out_params , # type: List[OutParam]
430
- database = "" , # type: String
431
- transaction = None , # type: Optional[String ]
430
+ database = "" , # type: AnyStr
431
+ transaction = None , # type: Optional[AnyStr ]
432
432
in_params = None , # type: Optional[List[InParam]]
433
433
):
434
434
# type: (...) -> Tuple[int, DictIntStringAny]
@@ -467,9 +467,9 @@ def o_execute_non_query(
467
467
468
468
469
469
def o_get_data (
470
- stored_procedure , # type: String
470
+ stored_procedure , # type: AnyStr
471
471
out_params , # type: List[OutParam]
472
- database = "" , # type: String
472
+ database = "" , # type: AnyStr
473
473
in_params = None , # type: Optional[List[InParam]]
474
474
):
475
475
# type: (...) -> Tuple[BasicDataset, DictIntStringAny]
0 commit comments