diff options
Diffstat (limited to 'src/db.lua')
-rw-r--r-- | src/db.lua | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -24,9 +24,9 @@ luasql = require "luasql.mysql" -- for destination database -- CREATE DATABASE nop CHARACTER SET utf8 COLLATE utf8_unicode_ci; -- 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); +-- 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), carttype ENUM('show','pool','jingle')); -- 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); +-- 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), carttype ENUM('show','pool','jingle')); -- 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)); -- ALTER TABLE state CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci; @@ -112,9 +112,9 @@ function db.init(db, user, pwd, host, port, table) local title = self.con:escape(data.title) local artist = self.con:escape(data.artist) local album = self.con:escape(data.album) - local ismusic = self.con:escape(data.ismusic) + local carttype = self.con:escape(data.carttype) - local cur, err = self.con:execute("REPLACE INTO " .. self.table .. " VALUES('" .. timestamp .. "', '" .. cart .. "', '" .. len .. "', '" .. showtitle .. "', '" .. title .. "', '" .. artist .."', '" .. album .. "', '" .. ismusic .. "')") + local cur, err = self.con:execute("REPLACE INTO " .. self.table .. " VALUES('" .. timestamp .. "', '" .. cart .. "', '" .. len .. "', '" .. showtitle .. "', '" .. title .. "', '" .. artist .."', '" .. album .. "', '" .. carttype .. "')") if cur == nil then return nil, err end |