autodoc_server_functions
JO Functions > jo.database.addColumn()
A function to create a column in a specific table if not exist <br>
JO Functions > jo.database.addColumn() > Syntax
jo.database.addColumn(tableName, name, definition)
JO Functions > jo.database.addColumn() > Parameters
tableName : string
The name of the table
name : string
The name of the column
definition : string
The definition of the column
JO Functions > jo.database.addColumn() > Return Value
Type : boolean
Return
trueif the column is created,falseotherwise
JO Functions > jo.database.addColumn() > Example
local isColumnAdded = jo.database.addColumn('table_name', 'column_name', 'INT NOT NULL DEFAULT "0" AFTER TABLE table_name')
JO Functions > jo.database.addTable()
A function to create a table if not exist <br>
JO Functions > jo.database.addTable() > Syntax
jo.database.addTable(tableName, definition)
JO Functions > jo.database.addTable() > Parameters
tableName : string
The name of the table
definition : string
The definition of the table
JO Functions > jo.database.addTable() > Return Value
Type : boolean
Return
trueif the table is created,falseotherwise
JO Functions > jo.database.addTable() > Example
local isTableCreated = jo.database.addTable(
'your_table_name',
[[id INT NOT NULL AUTO_INCREMENT,
first_column VARCHAR(50) NOT NULL DEFAULT '',
second_column VARCHAR(50) NOT NULL DEFAULT '',]]
)
JO Functions > jo.database.addTrigger()
A function to create a trigger if not exist <br>
JO Functions > jo.database.addTrigger() > Syntax
jo.database.addTrigger(triggerName, definition)
JO Functions > jo.database.addTrigger() > Parameters
triggerName : string
The name of the trigger
definition : string
The definition of the trigger
JO Functions > jo.database.addTrigger() > Return Value
Type : boolean
Return
trueif the trigger is created,falseotherwise
JO Functions > jo.database.addTrigger() > Example
local isTriggerCreated = jo.database.addTrigger(
'the_name_of_the_trigger',
"AFTER DELETE ON `table` FOR EACH ROW UPDATE `table2` SET column = 0 WHERE equiped_on = OLD.id"
)
JO Functions > jo.database.doesTableExist()
A function to check if a table exists <br>
JO Functions > jo.database.doesTableExist() > Syntax
jo.database.doesTableExist(tableName)
JO Functions > jo.database.doesTableExist() > Parameters
tableName : string
The name of the table
JO Functions > jo.database.doesTableExist() > Return Value
Type : boolean
Return
trueif the table exists,falseotherwise