Skip to content

Commit

Permalink
Consistent naming of internal functions
Browse files Browse the repository at this point in the history
  • Loading branch information
amochin committed Aug 14, 2024
1 parent e882f25 commit 59d3b26
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/DatabaseLibrary/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def query(
try:
cur = db_connection.client.cursor()
logger.info(f"Executing : Query | {selectStatement} ")
self.__execute_sql(cur, selectStatement, parameters=parameters)
self._execute_sql(cur, selectStatement, parameters=parameters)
all_rows = cur.fetchall()
col_names = [c[0] for c in cur.description]
self._log_query_result(col_names, all_rows)
Expand Down Expand Up @@ -124,7 +124,7 @@ def row_count(
try:
cur = db_connection.client.cursor()
logger.info(f"Executing : Row Count | {selectStatement}")
self.__execute_sql(cur, selectStatement, parameters=parameters)
self._execute_sql(cur, selectStatement, parameters=parameters)
data = cur.fetchall()
col_names = [c[0] for c in cur.description]
if db_connection.module_name in ["sqlite3", "ibm_db", "ibm_db_dbi", "pyodbc"]:
Expand Down Expand Up @@ -178,7 +178,7 @@ def description(
try:
cur = db_connection.client.cursor()
logger.info("Executing : Description | {selectStatement}")
self.__execute_sql(cur, selectStatement, parameters=parameters)
self._execute_sql(cur, selectStatement, parameters=parameters)
description = list(cur.description)
if sys.version_info[0] < 3:
for row in range(0, len(description)):
Expand Down Expand Up @@ -208,7 +208,7 @@ def delete_all_rows_from_table(self, tableName: str, sansTran: bool = False, ali
try:
cur = db_connection.client.cursor()
logger.info(f"Executing : Delete All Rows From Table | {query}")
result = self.__execute_sql(cur, query)
result = self._execute_sql(cur, query)
if result is not None:
if not sansTran:
db_connection.client.commit()
Expand Down Expand Up @@ -292,7 +292,7 @@ def execute_sql_script(
logger.info(f"Executing : Execute SQL Script | {sqlScriptFileName}")
if not split:
logger.info("Statements splitting disabled - pass entire script content to the database module")
self.__execute_sql(cur, sql_file.read())
self._execute_sql(cur, sql_file.read())
else:
logger.info("Splitting script file into statements...")
statements_to_execute = []
Expand Down Expand Up @@ -358,7 +358,7 @@ def execute_sql_script(
logger.info(f"Executing statement from script file: {statement}")
line_ends_with_proc_end = re.compile(r"(\s|;)" + proc_end_pattern.pattern + "$")
omit_semicolon = not line_ends_with_proc_end.search(statement.lower())
self.__execute_sql(cur, statement, omit_semicolon)
self._execute_sql(cur, statement, omit_semicolon)
if not sansTran:
db_connection.client.commit()
finally:
Expand Down Expand Up @@ -403,7 +403,7 @@ def execute_sql_string(
try:
cur = db_connection.client.cursor()
logger.info(f"Executing : Execute SQL String | {sqlString}")
self.__execute_sql(cur, sqlString, omit_trailing_semicolon=omitTrailingSemicolon, parameters=parameters)
self._execute_sql(cur, sqlString, omit_trailing_semicolon=omitTrailingSemicolon, parameters=parameters)
if not sansTran:
db_connection.client.commit()
finally:
Expand Down Expand Up @@ -552,7 +552,7 @@ def call_stored_procedure(
if cur and not sansTran:
db_connection.client.rollback()

def __execute_sql(
def _execute_sql(
self,
cur,
sql_statement: str,
Expand Down

0 comments on commit 59d3b26

Please sign in to comment.