Skip to content

SeaLife/CDB

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 

Repository files navigation

Central Database Mod

This Addon was created by SeaLife

Hooks

Hook Name Action
CentralDatabase::ConnectedPools Will be called if all Pools are connected

How to create a Database Pool

DatabasePool.new(
	"demoPool", 	-- Name of Pool (for Internal Usage)
	"db.host.com",  -- Host of Database
	3306, 			-- Port of Database
	"demouser", 	-- User for Authentication
	"password", 	-- Password for Authentication
	"demodb"		-- Database Name
)

How to get a Database Pool

Function Arguments Returns
CentralDatabase.GetPool string poolName returns the pool object for poolName
CentralDatabase.GetPool( String poolName )

Example

local db = nil

local function onDatabaseConnected()
	db = CentralDatabase.GetPool("demoPool")
end

hook.Add("CentralDatabase::ConnectedPools", "TestOnDatabaseConnected", onDatabaseConnected)

How to use a Database Pool

db:Query( String sql, Function callback, Function errorCallback )

About

Garrys Mod Database Control Addon

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages