mirror of
https://github.com/darksaid98/oxmysql.git
synced 2026-12-03 06:28:53 +00:00
feat: provide exports for ghmattimysql
Rather than people weirdly renaming the resource, just provide event handlers for ghmattimysql exports.
This commit is contained in:
1 parent
1477812b38
commit
613570167c
2 files changed
+20
No files matched your search
@@ -22,6 +22,7 @@ files {
|
|||||||
ui_page 'ui/build/index.html'
|
ui_page 'ui/build/index.html'
|
||||||
|
|
||||||
provide 'mysql-async'
|
provide 'mysql-async'
|
||||||
|
provide 'ghmattimysql'
|
||||||
|
|
||||||
convar_category 'OxMySQL' {
|
convar_category 'OxMySQL' {
|
||||||
'Configuration',
|
'Configuration',
|
||||||
|
|||||||
@@ -78,6 +78,23 @@ MySQL.prepare = (
|
|||||||
MySQL.execute = MySQL.query;
|
MySQL.execute = MySQL.query;
|
||||||
MySQL.fetch = MySQL.query;
|
MySQL.fetch = MySQL.query;
|
||||||
|
|
||||||
|
function provide(name: string, cb: Function, sync: Function) {
|
||||||
|
on(`__cfx_export_ghmattimysql_${name}`, (setCb: Function) => setCb(cb));
|
||||||
|
on(`__cfx_export_ghmattimysql_${name}Sync`, (setCb: Function) => setCb(sync));
|
||||||
|
}
|
||||||
|
|
||||||
|
// provide the "store" and "storeSync" exports, to provide compatibility for ghmattimysql
|
||||||
|
// these are not actually used to do anything, simply returning the query as-is
|
||||||
|
provide(
|
||||||
|
'store',
|
||||||
|
(query: string, cb: Function) => {
|
||||||
|
cb(query);
|
||||||
|
},
|
||||||
|
(query: string) => {
|
||||||
|
return query;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
for (const key in MySQL) {
|
for (const key in MySQL) {
|
||||||
global.exports(key, MySQL[key]);
|
global.exports(key, MySQL[key]);
|
||||||
|
|
||||||
@@ -98,4 +115,6 @@ for (const key in MySQL) {
|
|||||||
|
|
||||||
global.exports(`${key}_async`, exp);
|
global.exports(`${key}_async`, exp);
|
||||||
global.exports(`${key}Sync`, exp);
|
global.exports(`${key}Sync`, exp);
|
||||||
|
|
||||||
|
if (key === 'execute' || key === 'scalar' || key === 'transaction') provide(key, MySQL[key], exp);
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user