Total Complexity | 2 |
Total Lines | 35 |
Duplicated Lines | 0 % |
Coverage | 69.23% |
Changes | 0 |
1 | 1 | from configparser import ConfigParser |
|
2 | 1 | from typing import Any, Dict |
|
3 | |||
4 | 1 | from pystratum_backend.StratumIO import StratumIO |
|
5 | from pystratum_common.backend.CommonRoutineWrapperGeneratorWorker import CommonRoutineWrapperGeneratorWorker |
||
6 | 1 | ||
7 | 1 | from pystratum_mysql.backend.MySqlWorker import MySqlWorker |
|
8 | 1 | from pystratum_mysql.wrapper import create_routine_wrapper |
|
9 | |||
10 | |||
11 | 1 | class MySqlRoutineWrapperGeneratorWorker(MySqlWorker, CommonRoutineWrapperGeneratorWorker): |
|
12 | """ |
||
13 | Class for generating a class with wrapper methods for calling stored routines in a MySQL database. |
||
14 | """ |
||
15 | |||
16 | # ------------------------------------------------------------------------------------------------------------------ |
||
17 | 1 | def __init__(self, io: StratumIO, config: ConfigParser): |
|
18 | """ |
||
19 | Object constructor. |
||
20 | |||
21 | :param io: The output decorator. |
||
22 | """ |
||
23 | MySqlWorker.__init__(self, io, config) |
||
24 | CommonRoutineWrapperGeneratorWorker.__init__(self, io, config) |
||
25 | |||
26 | # ------------------------------------------------------------------------------------------------------------------ |
||
27 | 1 | def _write_routine_function(self, routine: Dict[str, Any]) -> None: |
|
28 | """ |
||
29 | Generates a complete wrapper method for a stored routine. |
||
30 | |||
31 | :param routine: The metadata of the stored routine. |
||
32 | """ |
||
33 | wrapper = create_routine_wrapper(routine, self._lob_as_string_flag) |
||
34 | self._code += wrapper.write_routine_method(routine) |
||
35 | |||
37 |