Repository navigation
Database
Joe91 edited this page Nov 1, 2026
·
3 revisions
If you contribute to fun-bots please don't use the SQL library of Venice Unleashed directly. We provide our own class named Database (ext/Server/Database.lua, server side only); it writes to the mod.db of the mod.
local m_Database = require('Database')Field types: DatabaseField.ID, Text, PrimaryText (unique text), Integer, Float, Boolean, Time, NULL.
m_Database:CreateTable('TestName', {
DatabaseField.ID,
DatabaseField.Text,
DatabaseField.Integer,
DatabaseField.Time
}, {
'ID',
'Key',
'Value',
'Time'
})local s_LastId = m_Database:Insert('TestName', {
ID = DatabaseField.NULL,
Key = 'Hello',
Value = 'World',
Time = m_Database:Now()
})The third argument names the field to match; its value is taken from the parameters.
m_Database:Update('TestName', {
Key = 'Hello',
Value = 'Universe'
}, 'Key')m_Database:Delete('TestName', {
ID = 0
})local s_Single = m_Database:Single('SELECT * FROM `TestName` WHERE `Key`=' .. m_Database:Quote('Hello'))local s_All = m_Database:Fetch('SELECT * FROM `TestName` WHERE `Key`=' .. m_Database:Quote('Hello'))m_Database:Query(query) runs any other statement, m_Database:GetError() returns the last error. Always pass values from players through m_Database:Quote().
Download latest release⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ToDo⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀Bugs & Issues