Posted by deekayen on May 30, 2009 at 3:31am
3 followers
Jump to:
| Project: | Database tweaks |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
Issue Summary
To reproduce, put the db_tweaks module in a site that hasn't had it before. Go to modules page, check the module, and save. When the page refreshes, this is in the errors at the top for Drupal 6.12 and MySQL 5.0.75:
# user warning: Variable 'sql_big_selects' can't be set to the value of '' query: SET SESSION sql_big_selects = "" in /var/www/dev/sites/all/modules/db_tweaks/db_tweaks.module on line 80.
# user warning: Incorrect argument type to variable 'max_join_size' query: SET SESSION max_join_size = "" in /var/www/dev/sites/all/modules/db_tweaks/db_tweaks.module on line 80.
# user warning: Incorrect argument type to variable 'max_allowed_packet' query: SET SESSION max_allowed_packet = "" in /var/www/dev/sites/all/modules/db_tweaks/db_tweaks.module on line 80.
# user warning: Incorrect argument type to variable 'wait_timeout' query: SET SESSION wait_timeout = "" in /var/www/dev/sites/all/modules/db_tweaks/db_tweaks.module on line 80.
Comments
#1
Seems to be worse than just installation. On the user permissions page, it has all of
* user warning: Variable 'sql_big_selects' can't be set to the value of '' query: SET SESSION sql_big_selects = "" in /var/www/dev/sites/all/modules/db_tweaks/db_tweaks.module on line 80.* user warning: Incorrect argument type to variable 'max_join_size' query: SET SESSION max_join_size = "" in /var/www/dev/sites/all/modules/db_tweaks/db_tweaks.module on line 80.
* user warning: Incorrect argument type to variable 'max_allowed_packet' query: SET SESSION max_allowed_packet = "" in /var/www/dev/sites/all/modules/db_tweaks/db_tweaks.module on line 80.
* user warning: Incorrect argument type to variable 'wait_timeout' query: SET SESSION wait_timeout = "" in /var/www/dev/sites/all/modules/db_tweaks/db_tweaks.module on line 80.
* user warning: Variable 'sql_big_selects' can't be set to the value of '' query: SET SESSION sql_big_selects = "" in /var/www/dev/sites/all/modules/db_tweaks/db_tweaks.module on line 80.
* Cannot set variable `sql_big_selects` to `` in your database configuration!
Probably you do not have proper privileges.
* user warning: Incorrect argument type to variable 'max_join_size' query: SET SESSION max_join_size = "" in /var/www/dev/sites/all/modules/db_tweaks/db_tweaks.module on line 80.
* Cannot set variable `max_join_size` to `` in your database configuration!
Probably you do not have proper privileges.
* user warning: Incorrect argument type to variable 'max_allowed_packet' query: SET SESSION max_allowed_packet = "" in /var/www/dev/sites/all/modules/db_tweaks/db_tweaks.module on line 80.
* Cannot set variable `max_allowed_packet` to `` in your database configuration!
Probably you do not have proper privileges.
* user warning: Incorrect argument type to variable 'wait_timeout' query: SET SESSION wait_timeout = "" in /var/www/dev/sites/all/modules/db_tweaks/db_tweaks.module on line 80.
* Cannot set variable `wait_timeout` to `` in your database configuration!
Probably you do not have proper privileges.
#2
I'll test it.
Probably temporary fix could be:
<?phpfunction db_tweaks_set_mysql_variable($variable_name, $value, $type = 'SESSION') {
if (is_numeric($value)) {
return db_query('SET %s %s = %d', $type, $variable_name, $value);
} else if (!empty($value)) { // <!-- ADDITIONAL CONDITION HERE
return db_query('SET %s %s = "%s"', $type, $variable_name, $value);
}
?>
or proper fix (changed in first part):
<?php
function db_tweaks_get_mysql_configuration() {
$mysql_conf = array();
// get actual variables from database
$mysql_conf['sql_big_selects']['mysql'] = $default_sql_big_selects = db_tweaks_get_mysql_variable('sql_big_selects');
$mysql_conf['max_join_size']['mysql'] = $default_max_join_size = db_tweaks_get_mysql_variable('max_join_size');
$mysql_conf['max_allowed_packet']['mysql'] = $default_max_allowed_packet = db_tweaks_get_mysql_variable('max_allowed_packet')/1024;
$mysql_conf['wait_timeout']['mysql'] = $default_wait_timeout = db_tweaks_get_mysql_variable('wait_timeout');
$mysql_conf['sql_mode']['mysql'] = db_tweaks_get_mysql_variable('sql_mode');
// get actual variables from configuration
$mysql_conf['sql_big_selects']['conf'] = variable_get('mysql_sql_big_selects', $default_sql_big_selects);
$mysql_conf['max_join_size']['conf'] = variable_get('mysql_max_join_size', $default_max_join_size);
$mysql_conf['max_allowed_packet']['conf'] = variable_get('mysql_max_allowed_packet', $default_max_allowed_packet);
$mysql_conf['wait_timeout']['conf'] = variable_get('mysql_wait_timeout', $default_wait_timeout);
$mysql_conf['sql_mode']['conf'] = implode(',', variable_get('mysql_sql_mode', array()));
return $mysql_conf;
}
?>
Variables were undeclared after I've moved them into function.
#3
Fixed.
http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/db_tweaks/d...
#4
Automatically closed -- issue fixed for 2 weeks with no activity.