diff options
author | mh <mh@immerda.ch> | 2010-04-04 12:21:33 +0200 |
---|---|---|
committer | mh <mh@immerda.ch> | 2010-04-04 12:21:33 +0200 |
commit | d40e1130bc3b8ed5f929406952d1bb598c92a381 (patch) | |
tree | 5744f1b8f05e2d9768c59de9e5fd7dae337f2953 /files | |
parent | c85d3a719cae04a656076b8454e56a7c9553e877 (diff) |
escape table and db names
Diffstat (limited to 'files')
-rw-r--r-- | files/scripts/optimize_tables.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/files/scripts/optimize_tables.rb b/files/scripts/optimize_tables.rb index 4eaaaa4..1aaf51c 100644 --- a/files/scripts/optimize_tables.rb +++ b/files/scripts/optimize_tables.rb @@ -5,7 +5,7 @@ ENV['HOME'] = '/root' tables = %x{mysql -Bse "SELECT TABLE_SCHEMA,TABLE_NAME FROM information_schema.TABLES WHERE TABLE_SCHEMA NOT IN ('information_schema','mysql') AND Data_free > 0 AND ENGINE IN ('MyISAM','InnoDB','ARCHIVE')"} tables.each { |table| tableitems = table.chomp.split(/\t/) - system "mysql #{tableitems[0]} -Bse \"OPTIMIZE TABLE #{tableitems[0]}.#{tableitems[1]}\" | grep -q OK" + system "mysql #{tableitems[0]} -Bse \"OPTIMIZE TABLE \`#{tableitems[0]}\`.\`#{tableitems[1]}\`\" | grep -q OK" if $?.to_i > 0 then puts "error while optimizing #{tableitems[0]}.#{tableitems[1]}" end |