ansible-for-i
ansible-for-i copied to clipboard
SQL is converted to uppercase prior to execution
ISSUE
The ibmi_sql_execute and ibmi_sql_query modules convert the SQL to uppercase prior to execution. This will cause a problem for any query that uses string literals.
EXAMPLE
Take a task like the following:
- ibmi_sql_execute:
sql: >
INSERT INTO mytable (key, value)
VALUES('KEY', 'Value')
I would actually end up with a row that looks like this:
key | value |
---|---|
KEY | VALUE |
Instead of the expected:
key | value |
---|---|
KEY | Value |
FIX
I think this is as straightforward as removing the .upper()
for the sql in these two modules:
https://github.com/IBM/ansible-for-i/blob/5c6d28b7909faa4d191d8df777737baf9834ebde/plugins/modules/ibmi_sql_execute.py#L167 https://github.com/IBM/ansible-for-i/blob/5c6d28b7909faa4d191d8df777737baf9834ebde/plugins/modules/ibmi_sql_query.py#L202
If you would like me to submit a pull request, please let me know!
Thanks for testing this, I will fix it. Thanks!
I think this issue is present in other modules as well. Like https://github.com/IBM/ansible-for-i/blob/5c6d28b7909faa4d191d8df777737baf9834ebde/plugins/modules/ibmi_user_and_group.py#L296 (User text / description is converted to uppercase) or https://github.com/IBM/ansible-for-i/blob/5c6d28b7909faa4d191d8df777737baf9834ebde/plugins/modules/ibmi_user_and_group.py#L297 (all parameters are converted to uppercase -> might cause problems with HOMEDIR & ACTCDE)