|
1 | 1 | local promise = promise
|
2 | 2 | local Await = Citizen.Await
|
3 |
| -local GetCurrentResourceName = GetCurrentResourceName() |
| 3 | +local resourceName = GetCurrentResourceName() |
4 | 4 | local GetResourceState = GetResourceState
|
5 | 5 |
|
| 6 | +local options = { |
| 7 | + return_callback_errors = false |
| 8 | +} |
| 9 | + |
| 10 | +for i = 1, GetNumResourceMetadata(resourceName, 'mysql_option') do |
| 11 | + local option = GetResourceMetadata(resourceName, 'mysql_option', i - 1) |
| 12 | + options[option] = true |
| 13 | +end |
| 14 | + |
6 | 15 | local function await(fn, query, parameters)
|
7 | 16 | local p = promise.new()
|
| 17 | + |
8 | 18 | fn(nil, query, parameters, function(result, error)
|
9 | 19 | if error then
|
10 | 20 | return p:reject(error)
|
11 | 21 | end
|
12 | 22 |
|
13 | 23 | p:resolve(result)
|
14 |
| - end, GetCurrentResourceName, true) |
| 24 | + end, resourceName, true) |
| 25 | + |
15 | 26 | return Await(p)
|
16 | 27 | end
|
17 | 28 |
|
@@ -60,7 +71,7 @@ local oxmysql = exports.oxmysql
|
60 | 71 | local mysql_method_mt = {
|
61 | 72 | __call = function(self, query, parameters, cb)
|
62 | 73 | query, parameters, cb = safeArgs(query, parameters, cb, self.method == 'transaction')
|
63 |
| - return oxmysql[self.method](nil, query, parameters, cb, GetCurrentResourceName, false) |
| 74 | + return oxmysql[self.method](nil, query, parameters, cb, resourceName, options.return_callback_errors) |
64 | 75 | end
|
65 | 76 | }
|
66 | 77 |
|
|
0 commit comments