1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00
community.general/library/database
Maykel Moya 811aa2611e Add support for string values
The SET GLOBAL statement requires properly quoting of values. For example, the
following correct queries will fail if quotes are toggled:

mysql> SET GLOBAL innodb_lru_scan_depth = 2000;
mysql> SET GLOBAL master_info_repository = "TABLE";

`mysql_variable` module doesn't quote the value argument, therefore
string values will fail.

  # this task will pass, 2000 is passed without quotes
  - name: set a numeric value
    mysql_variable: variable=innodb_lru_scan_depth value=2000

  # this task will fail, TABLE is passed without quotes
  - name: set a string value
    mysql_variable: variable=master_info_repository value=TABLE

With this patch prepared statements are used. Proper quoting will be
done automatically based on the type of the variables thus an attempt
to convert to int, then to float is done in first place.

Booleans values, ie: ON, OFF, are not specially handled because they
can be quoted. For example, the following queries are correct and
equivalent, they all set _innodb_file_per_table_ to logical _True_:

mysql> SET GLOBAL innodb_file_per_table = "ON";
mysql> SET GLOBAL innodb_file_per_table = ON;
mysql> SET GLOBAL innodb_file_per_table = 1;

Tested in mysql 5.5 and 5.6.
2014-02-12 12:44:28 +01:00
..
mongodb_user reword "except Error as e:" into "except Error, e:" to be compatible with Python 2.5 (#5852) 2014-02-03 13:00:40 -06:00
mysql_db Add quotes to password argument for dump/import 2014-01-02 12:04:03 -08:00
mysql_replication Addresses #5023 Fix import comments 2013-12-02 15:13:49 -05:00
mysql_user Documentation update to yield example of "WITH GRANT OPTION" which is undocumented previous 2014-01-14 12:04:32 +00:00
mysql_variables Add support for string values 2014-02-12 12:44:28 +01:00
postgresql_db Added port documentation to postgresql_db and postgresql_user 2014-02-07 18:27:55 +02:00
postgresql_privs Addresses #5023 Fix import comments 2013-12-02 15:13:49 -05:00
postgresql_user Added port documentation to postgresql_db and postgresql_user 2014-02-07 18:27:55 +02:00
redis Addresses #5023 Fix import comments 2013-12-02 15:13:49 -05:00
riak Addresses #5023 Fix import comments 2013-12-02 15:13:49 -05:00