summaryrefslogtreecommitdiff
path: root/rhnop-client
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2014-03-11 14:53:00 (GMT)
committerChristian Pointner <equinox@helsinki.at>2014-03-11 14:53:00 (GMT)
commit11669547c1caf8af430dfb806d413149f21dc9c9 (patch)
treec1564dd89d706005e4a7c4ffa3d1c2b64c0fd158 /rhnop-client
parent22a221190e7a81ca3b32578ee19c0a8503be957f (diff)
forcing utf-8
Diffstat (limited to 'rhnop-client')
-rw-r--r--rhnop-client/db.lua19
1 files changed, 14 insertions, 5 deletions
diff --git a/rhnop-client/db.lua b/rhnop-client/db.lua
index 18c925a..bf27bef 100644
--- a/rhnop-client/db.lua
+++ b/rhnop-client/db.lua
@@ -22,14 +22,18 @@
luasql = require "luasql.mysql"
-- for destination database
--- CREATE DATABASE nop
--- GRANT select,insert,update,delete ON nop.* TO 'nopcollectd' IDENTIFIED BY '<password>';
--- GRANT select ON nop.* TO 'nop' IDENTIFIED BY '<password>';
+-- CREATE DATABASE nop CHARACTER SET utf8 COLLATE utf8_unicode_ci;
+-- GRANT select,insert,update,delete ON nop.master TO 'nopcollectd'@'localhost' IDENTIFIED BY '<password>';
+-- GRANT select,insert,update,delete ON nop.standby TO 'nopcollectd'@'localhost';
+-- GRANT select,insert,update ON nop.state TO 'nopsysstated'@'localhost' IDENTIFIED BY '<password>';
+-- GRANT select ON nop.* TO 'nop'@'localhost' IDENTIFIED BY '<password>';
-- USE nop
-- CREATE TABLE IF NOT EXISTS master (timestamp BIGINT UNSIGNED PRIMARY KEY NOT NULL, cart INT NOT NULL, len INT, showtitle VARCHAR(255), title VARCHAR(255), artist VARCHAR(255), album VARCHAR(255), ismusic BOOLEAN);
+-- ALTER TABLE master CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;
-- CREATE TABLE IF NOT EXISTS standby (timestamp BIGINT UNSIGNED PRIMARY KEY NOT NULL, cart INT NOT NULL, len INT, showtitle VARCHAR(255), title VARCHAR(255), artist VARCHAR(255), album VARCHAR(255), ismusic BOOLEAN);
+-- ALTER TABLE standby CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;
-- CREATE TABLE IF NOT EXISTS state (timestamp BIGINT UNSIGNED PRIMARY KEY NOT NULL, state VARCHAR(32));
--- GRANT select,insert,update ON nop.state TO 'nopsysstated' IDENTIFIED BY '<password>';
+-- ALTER TABLE state CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;
local db = {}
@@ -50,7 +54,12 @@ function db.init(db, user, pwd, host, port, table)
return nil, err
end
- local ret, err = mydb.con:setautocommit(true)
+ local ret, err = self.con:execute("SET CHARACTER SET utf8")
+ if ret == nil then
+ return nil, err
+ end
+
+ ret, err = mydb.con:setautocommit(true)
if ret == nil then
return nil, err
end