|
None | __init__ (self, int success=0, int error=84, bool debug=False) |
|
str | protect_sql_cell (self, str cell) |
|
Union[List[str], str] | escape_risky_column_names (self, Union[List[str], str] columns) |
|
Union[List[str], str] | escape_risky_column_names_where_mode (self, Union[List[str], str] columns) |
|
str | check_sql_cell (self, str cell) |
|
Union[List[Dict[str, Any]], int] | beautify_table (self, List[str] column_names, List[List[Any]] table_content) |
|
str | compile_update_line (self, List line, List column, int column_length) |
|
str | process_sql_line (self, List[str] line, List[str] column, int column_length=(-1)) |
|
_summary_
Definition at line 13 of file sql_sanitisation_functions.py.
◆ __init__()
None src.lib.sql.sql_sanitisation_functions.SQLSanitiseFunctions.__init__ |
( |
| self, |
|
|
int | success = 0, |
|
|
int | error = 84, |
|
|
bool | debug = False ) |
_summary_
This is the class that contains functions in charge of sanitising sql queries.
Args:
debug (bool, optional): _description_. Defaults to False.: enable debug mode
Definition at line 17 of file sql_sanitisation_functions.py.
◆ _protect_value()
str src.lib.sql.sql_sanitisation_functions.SQLSanitiseFunctions._protect_value |
( |
| self, |
|
|
str | value ) |
|
protected |
Ensures the value is safely passed as a string in an SQL query.
It wraps the value in single quotes and escapes any single quotes within the value.
Args:
value (str): The value that needs to be protected.
Returns:
str: The value with protection applied, safe for SQL queries.
Definition at line 104 of file sql_sanitisation_functions.py.
◆ beautify_table()
Union[List[Dict[str, Any]], int] src.lib.sql.sql_sanitisation_functions.SQLSanitiseFunctions.beautify_table |
( |
| self, |
|
|
List[str] | column_names, |
|
|
List[List[Any]] | table_content ) |
_summary_
Convert the table to an easier version for navigating.
Args:
column_names (List[str]): _description_
table_content (List[List[Any]]): _description_
Returns:
Union[List[Dict[str, Any]], int]: _description_: the formated content or self.error if an error occured.
Definition at line 237 of file sql_sanitisation_functions.py.
◆ check_sql_cell()
str src.lib.sql.sql_sanitisation_functions.SQLSanitiseFunctions.check_sql_cell |
( |
| self, |
|
|
str | cell ) |
_summary_
Check if the cell is a string or a number.
Args:
cell (str): _description_
Returns:
str: _description_
Definition at line 208 of file sql_sanitisation_functions.py.
◆ compile_update_line()
str src.lib.sql.sql_sanitisation_functions.SQLSanitiseFunctions.compile_update_line |
( |
| self, |
|
|
List | line, |
|
|
List | column, |
|
|
int | column_length ) |
_summary_
Compile the line required for an sql update to work.
Args:
line (List): _description_
column (List): _description_
column_length (int): _description_
Returns:
str: _description_
Definition at line 283 of file sql_sanitisation_functions.py.
◆ escape_risky_column_names()
Union[List[str], str] src.lib.sql.sql_sanitisation_functions.SQLSanitiseFunctions.escape_risky_column_names |
( |
| self, |
|
|
Union[List[str], str] | columns ) |
_summary_
Escape the risky column names.
Args:
columns (List[str]): _description_
Returns:
List[str]: _description_
Definition at line 65 of file sql_sanitisation_functions.py.
◆ escape_risky_column_names_where_mode()
Union[List[str], str] src.lib.sql.sql_sanitisation_functions.SQLSanitiseFunctions.escape_risky_column_names_where_mode |
( |
| self, |
|
|
Union[List[str], str] | columns ) |
Escape the risky column names in where mode, except for those in keyword_logic_gates.
Args:
columns (Union[str, List[str]]): Column names to be processed.
Returns:
Union[List[str], str]: Processed column names with risky ones escaped.
Definition at line 160 of file sql_sanitisation_functions.py.
◆ process_sql_line()
str src.lib.sql.sql_sanitisation_functions.SQLSanitiseFunctions.process_sql_line |
( |
| self, |
|
|
List[str] | line, |
|
|
List[str] | column, |
|
|
int | column_length = (-1) ) |
_summary_
Convert a List of strings to an sql line so that it can be inserted into a table.
Args:
line (List[str]): _description_
Returns:
str: _description_
Definition at line 308 of file sql_sanitisation_functions.py.
◆ protect_sql_cell()
str src.lib.sql.sql_sanitisation_functions.SQLSanitiseFunctions.protect_sql_cell |
( |
| self, |
|
|
str | cell ) |
_summary_
This is a function in charge of cleaning by nullifying (escaping) characters that could cause the sql command to break.
Args:
cells (str): _description_: The cell to be checked
Returns:
str: _description_: A (hopfully) clean string.
Definition at line 43 of file sql_sanitisation_functions.py.
◆ debug
bool src.lib.sql.sql_sanitisation_functions.SQLSanitiseFunctions.debug = debug |
◆ disp
Disp src.lib.sql.sql_sanitisation_functions.SQLSanitiseFunctions.disp |
Initial value:= Disp(
TOML_CONF,
SAVE_TO_FILE,
FILE_NAME,
debug=self.debug,
logger=self.__class__.__name__
)
Definition at line 28 of file sql_sanitisation_functions.py.
◆ error
int src.lib.sql.sql_sanitisation_functions.SQLSanitiseFunctions.error = error |
◆ keyword_logic_gates
List[str] src.lib.sql.sql_sanitisation_functions.SQLSanitiseFunctions.keyword_logic_gates = SCONST.KEYWORD_LOGIC_GATES |
◆ risky_keywords [1/2]
str src.lib.sql.sql_sanitisation_functions.SQLSanitiseFunctions.risky_keywords = SCONST.RISKY_KEYWORDS |
◆ risky_keywords [2/2]
str src.lib.sql.sql_sanitisation_functions.SQLSanitiseFunctions.risky_keywords = f"`{key}`={value}" |
◆ sql_time_manipulation
SQLTimeManipulation src.lib.sql.sql_sanitisation_functions.SQLSanitiseFunctions.sql_time_manipulation |
◆ success
int src.lib.sql.sql_sanitisation_functions.SQLSanitiseFunctions.success = success |
The documentation for this class was generated from the following file: