Skip to content

Commit

Permalink
Merge pull request #106 from szampier/config_use_prepared_stmts_for_c…
Browse files Browse the repository at this point in the history
…lients

Add 'DbUsePreparedStatements' to ngas rc file
  • Loading branch information
rtobar committed Mar 19, 2024
2 parents a1270f7 + 8ab7537 commit a37caff
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/ngamsUtils/ngamsUtils/ngasUtilsLib.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
NGAS_RC_PAR_DB_INT = "DbInterface"
NGAS_RC_PAR_DB_PARAMS = "DbParameters"
NGAS_RC_PAR_DB_USE_FILE_IGNORE = "DbUseFileIgnore"
NGAS_RC_PAR_DB_USE_PREPARED_STATEMENTS = "DbUsePreparedStatements"
NGAS_RC_PAR_SMTP_HOST = "SmtpHost"
NGAS_RC_PAR_NOTIF_EMAIL = "EmailNotification"
NGAS_RC_PAR_HOST = "NgasHost"
Expand Down Expand Up @@ -185,7 +186,9 @@ def get_db_parameters():
params = json.loads(params_str)
use_file_ignore_str = get_parameter_ngas_resource_file(NGAS_RC_PAR_DB_USE_FILE_IGNORE, required=False)
use_file_ignore = True if use_file_ignore_str is None or use_file_ignore_str in ('yes', 'true') else False
return interface, params, use_file_ignore
use_prepared_statements_str = get_parameter_ngas_resource_file(NGAS_RC_PAR_DB_USE_PREPARED_STATEMENTS, required=False)
use_prepared_statements = True if use_prepared_statements_str is None or use_prepared_statements_str in ('yes', 'true') else False
return interface, params, use_file_ignore, use_prepared_statements


def send_email(subject, to, message, content_type=None, attachment_name=None):
Expand Down Expand Up @@ -573,5 +576,6 @@ def get_db_connection():
"""
Open a database connection using property values read from the resource file
"""
interface, params, use_file_ignore = get_db_parameters()
return ngamsDb.ngamsDb(interface, params, use_file_ignore=use_file_ignore)
interface, params, use_file_ignore, use_prepared_statements = get_db_parameters()
return ngamsDb.ngamsDb(interface, params, use_file_ignore=use_file_ignore,
use_prepared_statements=use_prepared_statements)

0 comments on commit a37caff

Please sign in to comment.