Passed
Push — master ( 47c3cf...c030a9 )
by P.R.
01:09
created

pystratum_mssql.backend.MsSqlRoutineWrapperGeneratorWorker   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 14
dl 0
loc 35
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A MsSqlRoutineWrapperGeneratorWorker.__init__() 0 8 1
A MsSqlRoutineWrapperGeneratorWorker._write_routine_function() 0 8 1
1
from configparser import ConfigParser
2
from typing import Any, Dict
3
4
from pystratum_backend.StratumStyle import StratumStyle
5
from pystratum_common.backend.CommonRoutineWrapperGeneratorWorker import CommonRoutineWrapperGeneratorWorker
6
7
from pystratum_mssql.backend.MsSqlWorker import MsSqlWorker
8
from pystratum_mssql.wrapper import create_routine_wrapper
9
10
11
class MsSqlRoutineWrapperGeneratorWorker(MsSqlWorker, CommonRoutineWrapperGeneratorWorker):
12
    """
13
    Class for generating a class with wrapper methods for calling stored routines in a SQL Server database.
14
    """
15
16
    # ------------------------------------------------------------------------------------------------------------------
17
    def __init__(self, io: StratumStyle, config: ConfigParser):
18
        """
19
        Object constructor.
20
21
        :param pystratum.style.PyStratumStyle.PyStratumStyle io: The output decorator.
22
        """
23
        MsSqlWorker.__init__(self, io, config)
24
        CommonRoutineWrapperGeneratorWorker.__init__(self, io, config)
25
26
    # ------------------------------------------------------------------------------------------------------------------
27
    def _write_routine_function(self, routine: Dict[str, Any]) -> None:
28
        """
29
        Generates a complete wrapper method for a stored routine.
30
31
        :param dict 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
36
# ----------------------------------------------------------------------------------------------------------------------
37