diff --git a/src/config/index.ts b/src/config/index.ts index e9a547f..5cc3555 100644 --- a/src/config/index.ts +++ b/src/config/index.ts @@ -26,3 +26,29 @@ export const mysql_transaction_isolation_level = (() => { return `${query} READ COMMITTED`; } })(); + +RegisterCommand( + 'oxmysql_debug', + (source: number, args: string[]) => { + if (source !== 0) return console.log('^3This command can only be run server side^0'); + switch (args[0]) { + case 'add': + if (!Array.isArray(mysql_debug)) mysql_debug = []; + mysql_debug.push(args[1]); + return console.log(`^3Added ${args[1]} to mysql_debug^0`); + + case 'remove': + if (Array.isArray(mysql_debug)) { + const index = mysql_debug.indexOf(args[1]); + if (index === -1) return; + mysql_debug.splice(index, 1); + if (mysql_debug.length === 0) mysql_debug = false; + return console.log(`^3Removed ${args[1]} from mysql_debug^0`); + } + + default: + return console.log(`^3Usage: oxmysql add|remove ^0`); + } + }, + true +);