Commit graph

9 commits

Author SHA1 Message Date
Adam Chainz
967de3cdf9 Fix sync_binlog name in mysql_variables example
The previous sync_binary_log is not a real MySQL variable.
2014-05-06 12:25:11 +01:00
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
James Tanner
ad837709bd Addresses #5023 Fix import comments 2013-12-02 15:13:49 -05:00
James Tanner
6000d636b3 Fixes #5023 Convert all modules to use new snippet import pattern 2013-12-02 15:11:23 -05:00
Maykel Moya
3db7ec8356 Fail if requested variable is not available 2013-10-22 09:30:19 +02:00
Maykel Moya
b90a250165 Improve change detection in mysql_variables
mysql_variables bindly executes a SET var = value query even when
the variable already has the requested value.

With this patch the query is executed only if the current value is
different to the requested one.
2013-10-17 19:13:58 +02:00
James Cammarata
3adb91a4b4 Added version_added to the mysql_variables module doc section 2013-09-06 12:32:08 -05:00
Balazs Pocze
19bb81a7df EXAMPLES section added 2013-08-08 11:28:26 +02:00
Balazs Pocze
85f2a90322 MySQL variables module 2013-07-30 16:59:32 +02:00