diff options
Diffstat (limited to 'nopsyncd/tempstorage.lua')
-rw-r--r-- | nopsyncd/tempstorage.lua | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/nopsyncd/tempstorage.lua b/nopsyncd/tempstorage.lua index d40ee42..4ae437a 100644 --- a/nopsyncd/tempstorage.lua +++ b/nopsyncd/tempstorage.lua @@ -41,7 +41,7 @@ function tempstorage:init() return nil, err end - local rows, err = self.con:execute("CREATE TABLE IF NOT EXISTS now (timestamp INT PRIMARY KEY ASC NOT NULL, cart INT NOT NULL, len INT, showtitle VARCHAR(255), title VARCHAR(255), artist VARCHAR(255), album VARCHAR(255), ismusic BOOLEAN)") + local rows, err = self.con:execute("CREATE TABLE IF NOT EXISTS now (timestamp VARCHAR(16) PRIMARY KEY ASC NOT NULL, cart INT NOT NULL, len INT, showtitle VARCHAR(255), title VARCHAR(255), artist VARCHAR(255), album VARCHAR(255), ismusic BOOLEAN)") if rows == nil then return nil, err end @@ -61,7 +61,6 @@ function tempstorage:getLastCart() end function tempstorage:insertMusic(timestamp, cart, len, title, artist, album) - timestamp = tonumber(timestamp) cart = tonumber(cart) len = tonumber(len) if cart < 400000 or cart > 450000 then @@ -70,7 +69,7 @@ function tempstorage:insertMusic(timestamp, cart, len, title, artist, album) poolnum = math.floor(cart/1000) - 399 end -- usage of undocumented escape function... - local cur, err = self.con:execute("INSERT into now VALUES(" .. timestamp .. ", " .. cart .. ", " .. len .. ", 'Musikpool " .. poolnum .. "', '" .. self.con:escape(title) .. "', '" .. self.con:escape(artist) .."', '" .. self.con:escape(album) .. "', 1)") + local cur, err = self.con:execute("INSERT into now VALUES(" .. self.con:escape(timestamp) .. ", " .. cart .. ", " .. len .. ", 'Musikpool " .. poolnum .. "', '" .. self.con:escape(title) .. "', '" .. self.con:escape(artist) .."', '" .. self.con:escape(album) .. "', 1)") if cur == nil then return nil, err end |