mirror of
https://github.com/darksaid98/oxmysql.git
synced 2026-12-02 14:38:50 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
12e9ccbc8a | ||
|
|
2a9b14ce54 | ||
|
|
f7949db0d3 | ||
|
|
2a14ab1e21 | ||
|
|
9de50f684f | ||
|
|
2c90290c84 | ||
|
|
9fc06c2132 | ||
|
|
def891268b | ||
|
|
8a3fa20408 | ||
|
|
5d6ca06f49 |
No files matched your search
@@ -32,8 +32,6 @@ jobs:
|
|||||||
- name: Bundle files
|
- name: Bundle files
|
||||||
run: |
|
run: |
|
||||||
mv dist oxmysql
|
mv dist oxmysql
|
||||||
mkdir oxmysql/lib
|
|
||||||
mv lib/MySQL.lua oxmysql/lib/MySQL.lua
|
|
||||||
zip -r oxmysql-${{ env.RELEASE_VERSION }}.zip oxmysql
|
zip -r oxmysql-${{ env.RELEASE_VERSION }}.zip oxmysql
|
||||||
|
|
||||||
- name: Create Release
|
- name: Create Release
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ game 'common'
|
|||||||
|
|
||||||
name 'oxmysql'
|
name 'oxmysql'
|
||||||
description 'Database wrapper for FiveM utilising node-mysql2 offering improved performance and security.'
|
description 'Database wrapper for FiveM utilising node-mysql2 offering improved performance and security.'
|
||||||
version '1.7.0'
|
version '1.7.1'
|
||||||
url 'https://github.com/overextended/oxmysql'
|
url 'https://github.com/overextended/oxmysql'
|
||||||
author 'overextended'
|
author 'overextended'
|
||||||
use_fxv2_oal 'yes'
|
use_fxv2_oal 'yes'
|
||||||
@@ -14,4 +14,4 @@ server_scripts {
|
|||||||
'wrapper.lua'
|
'wrapper.lua'
|
||||||
}
|
}
|
||||||
|
|
||||||
provide 'mysql-async'
|
provide 'mysql-async'
|
||||||
File renamed without changes.
@@ -1,10 +1,40 @@
|
|||||||
|
local oxmysql = exports.oxmysql
|
||||||
|
|
||||||
|
CreateThread(function()
|
||||||
|
Wait(1000)
|
||||||
|
local resource = GetCurrentResourceName()
|
||||||
|
local url = GetResourceMetadata(resource, 'url', 0)
|
||||||
|
local version = GetResourceMetadata(resource, 'version', 0)
|
||||||
|
|
||||||
|
PerformHttpRequest(('%s/main/lua/fxmanifest.lua'):format(url:gsub('github.com', 'raw.githubusercontent.com')), function(error, response)
|
||||||
|
if error == 200 then
|
||||||
|
local latest = response:match('%d%.%d+%.%d+')
|
||||||
|
if version ~= latest then
|
||||||
|
local curMajor, curMinor = string.strsplit('.', version)
|
||||||
|
local newMajor, newMinor = string.strsplit('.', response:match('%d%.%d+%.%d+'))
|
||||||
|
local link = ('%s/releases/download/v%s/oxmysql-v%s.zip'):format(url, latest, latest)
|
||||||
|
|
||||||
|
if tonumber(curMajor) < tonumber(newMajor) then
|
||||||
|
latest = 'A major update'
|
||||||
|
elseif tonumber(curMinor) < tonumber(newMinor) then
|
||||||
|
latest = 'An update'
|
||||||
|
else
|
||||||
|
latest = 'A patch'
|
||||||
|
end
|
||||||
|
|
||||||
|
print(('^3%s is available for oxmysql - please update to the latest release (current version: %s)\n ^3- %s^0'):format(latest, version, link))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end, 'GET')
|
||||||
|
end)
|
||||||
|
|
||||||
---@param query string
|
---@param query string
|
||||||
---@param parameters? table
|
---@param parameters? table
|
||||||
---@return integer result
|
---@return integer result
|
||||||
---returns array of matching rows or result data
|
---returns array of matching rows or result data
|
||||||
exports('executeSync', function(query, parameters)
|
exports('executeSync', function(query, parameters)
|
||||||
local p = promise.new()
|
local p = promise.new()
|
||||||
exports['oxmysql']:execute(query, parameters, function(result)
|
oxmysql:execute(query, parameters, function(result)
|
||||||
p:resolve(result)
|
p:resolve(result)
|
||||||
end, GetInvokingResource())
|
end, GetInvokingResource())
|
||||||
return Citizen.Await(p)
|
return Citizen.Await(p)
|
||||||
@@ -16,7 +46,7 @@ end)
|
|||||||
---returns array of matching rows or result data
|
---returns array of matching rows or result data
|
||||||
exports('fetchSync', function(query, parameters)
|
exports('fetchSync', function(query, parameters)
|
||||||
local p = promise.new()
|
local p = promise.new()
|
||||||
exports['oxmysql']:fetch(query, parameters, function(result)
|
oxmysql:fetch(query, parameters, function(result)
|
||||||
p:resolve(result)
|
p:resolve(result)
|
||||||
end, GetInvokingResource())
|
end, GetInvokingResource())
|
||||||
return Citizen.Await(p)
|
return Citizen.Await(p)
|
||||||
@@ -28,7 +58,7 @@ end)
|
|||||||
---returns table containing key value pairs
|
---returns table containing key value pairs
|
||||||
exports('singleSync', function(query, parameters)
|
exports('singleSync', function(query, parameters)
|
||||||
local p = promise.new()
|
local p = promise.new()
|
||||||
exports['oxmysql']:single(query, parameters, function(result)
|
oxmysql:single(query, parameters, function(result)
|
||||||
p:resolve(result)
|
p:resolve(result)
|
||||||
end, GetInvokingResource())
|
end, GetInvokingResource())
|
||||||
return Citizen.Await(p)
|
return Citizen.Await(p)
|
||||||
@@ -40,7 +70,7 @@ end)
|
|||||||
---returns value of the first column of a single row
|
---returns value of the first column of a single row
|
||||||
exports('scalarSync', function(query, parameters)
|
exports('scalarSync', function(query, parameters)
|
||||||
local p = promise.new()
|
local p = promise.new()
|
||||||
exports['oxmysql']:scalar(query, parameters, function(result)
|
oxmysql:scalar(query, parameters, function(result)
|
||||||
p:resolve(result)
|
p:resolve(result)
|
||||||
end, GetInvokingResource())
|
end, GetInvokingResource())
|
||||||
return Citizen.Await(p)
|
return Citizen.Await(p)
|
||||||
@@ -52,7 +82,7 @@ end)
|
|||||||
---returns the last inserted id
|
---returns the last inserted id
|
||||||
exports('insertSync', function(query, parameters)
|
exports('insertSync', function(query, parameters)
|
||||||
local p = promise.new()
|
local p = promise.new()
|
||||||
exports['oxmysql']:insert(query, parameters, function(result)
|
oxmysql:insert(query, parameters, function(result)
|
||||||
p:resolve(result)
|
p:resolve(result)
|
||||||
end, GetInvokingResource())
|
end, GetInvokingResource())
|
||||||
return Citizen.Await(p)
|
return Citizen.Await(p)
|
||||||
@@ -64,7 +94,7 @@ end)
|
|||||||
---returns number of rows updated by the executed query
|
---returns number of rows updated by the executed query
|
||||||
exports('updateSync', function(query, parameters)
|
exports('updateSync', function(query, parameters)
|
||||||
local p = promise.new()
|
local p = promise.new()
|
||||||
exports['oxmysql']:update(query, parameters, function(result)
|
oxmysql:update(query, parameters, function(result)
|
||||||
p:resolve(result)
|
p:resolve(result)
|
||||||
end, GetInvokingResource())
|
end, GetInvokingResource())
|
||||||
return Citizen.Await(p)
|
return Citizen.Await(p)
|
||||||
@@ -76,7 +106,7 @@ end)
|
|||||||
---returns true when the transaction has succeeded
|
---returns true when the transaction has succeeded
|
||||||
exports('transactionSync', function(queries, parameters)
|
exports('transactionSync', function(queries, parameters)
|
||||||
local p = promise.new()
|
local p = promise.new()
|
||||||
exports['oxmysql']:transaction(queries, parameters, function(result)
|
oxmysql:transaction(queries, parameters, function(result)
|
||||||
p:resolve(result)
|
p:resolve(result)
|
||||||
end, GetInvokingResource())
|
end, GetInvokingResource())
|
||||||
return Citizen.Await(p)
|
return Citizen.Await(p)
|
||||||
@@ -90,7 +120,7 @@ end)
|
|||||||
---return value is based on the number of results and the type of query used
|
---return value is based on the number of results and the type of query used
|
||||||
exports('prepareSync', function(query, parameters)
|
exports('prepareSync', function(query, parameters)
|
||||||
local p = promise.new()
|
local p = promise.new()
|
||||||
exports['oxmysql']:prepare(query, parameters, function(result)
|
oxmysql:prepare(query, parameters, function(result)
|
||||||
p:resolve(result)
|
p:resolve(result)
|
||||||
end, GetInvokingResource())
|
end, GetInvokingResource())
|
||||||
return Citizen.Await(p)
|
return Citizen.Await(p)
|
||||||
+1
-2
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "oxmysql",
|
"name": "oxmysql",
|
||||||
"version": "1.7.0",
|
"version": "1.0.0",
|
||||||
"main": "oxmysql.js",
|
"main": "oxmysql.js",
|
||||||
"description": "node-mysql2 resource for Cfx",
|
"description": "node-mysql2 resource for Cfx",
|
||||||
"repository": "[email protected]:overextended/oxmysql.git",
|
"repository": "[email protected]:overextended/oxmysql.git",
|
||||||
@@ -14,7 +14,6 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@citizenfx/server": "^2.0.4793-1",
|
"@citizenfx/server": "^2.0.4793-1",
|
||||||
"connection-string-parser": "^1.0.4",
|
"connection-string-parser": "^1.0.4",
|
||||||
"github-version-checker": "^2.2.0",
|
|
||||||
"mysql2": "https://github.com/overextended/node-mysql2.git",
|
"mysql2": "https://github.com/overextended/node-mysql2.git",
|
||||||
"postinstall-postinstall": "^2.1.0"
|
"postinstall-postinstall": "^2.1.0"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,12 +0,0 @@
|
|||||||
diff --git a/node_modules/github-version-checker/lib/check.js b/node_modules/github-version-checker/lib/check.js
|
|
||||||
index 7f00060..cf0e231 100644
|
|
||||||
--- a/node_modules/github-version-checker/lib/check.js
|
|
||||||
+++ b/node_modules/github-version-checker/lib/check.js
|
|
||||||
@@ -88,7 +88,6 @@ const rest = (options, callback) => {
|
|
||||||
|
|
||||||
if (found) {
|
|
||||||
const mapped = schemeMapper[options.fetchTags ? 'tag' : 'release'](version);
|
|
||||||
- console.log(mapped);
|
|
||||||
callback(null, mapped);
|
|
||||||
} else {
|
|
||||||
callback(null, null);
|
|
||||||
@@ -1,6 +1,3 @@
|
|||||||
import versionCheck from 'github-version-checker';
|
|
||||||
import currentVersion from '../package.json';
|
|
||||||
|
|
||||||
const slowQueryWarning = GetConvarInt('mysql_slow_query_warning', 150);
|
const slowQueryWarning = GetConvarInt('mysql_slow_query_warning', 150);
|
||||||
const debug = GetConvar('mysql_debug', 'false') === 'true';
|
const debug = GetConvar('mysql_debug', 'false') === 'true';
|
||||||
|
|
||||||
@@ -22,23 +19,3 @@ const isolationLevel = (() => {
|
|||||||
const resourceName = GetCurrentResourceName() || 'oxmysql';
|
const resourceName = GetCurrentResourceName() || 'oxmysql';
|
||||||
|
|
||||||
export { slowQueryWarning, debug, isolationLevel, resourceName };
|
export { slowQueryWarning, debug, isolationLevel, resourceName };
|
||||||
|
|
||||||
setImmediate(async () => {
|
|
||||||
const versionCheckConfig = {
|
|
||||||
repo: 'oxmysql',
|
|
||||||
owner: 'overextended',
|
|
||||||
currentVersion: currentVersion.version,
|
|
||||||
latest: true,
|
|
||||||
};
|
|
||||||
|
|
||||||
try {
|
|
||||||
const update = await versionCheck(versionCheckConfig);
|
|
||||||
if (update) {
|
|
||||||
console.log(
|
|
||||||
`^3Your version of oxmysql is outdated (v${versionCheckConfig.currentVersion})! Please update to the latest version (${update.name}) here: \nhttps://github.com/overextended/oxmysql/releases/latest^0`
|
|
||||||
);
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
console.log(`^3Could not fetch updates for oxmysql!^0\n${e}`);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
+2
-1
@@ -26,7 +26,8 @@ const parseTypes = (field, next) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const parseParameters = (query, parameters) => {
|
const parseParameters = (query, parameters) => {
|
||||||
if (query === undefined) throw new FormatError(`Undefined query passed`);
|
if (typeof query !== 'string')
|
||||||
|
throw new Error(`Non-string query passed. Make sure you use "oxmysql:execute" instead of "oxmysql.execute" when calling exports.`);
|
||||||
|
|
||||||
if (!parameters || typeof parameters === 'function') return [query, []];
|
if (!parameters || typeof parameters === 'function') return [query, []];
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -31,7 +31,7 @@ const createConnection = () => {
|
|||||||
port: options.port || 3306,
|
port: options.port || 3306,
|
||||||
user: options.username || options.user || options.userid || 'root',
|
user: options.username || options.user || options.userid || 'root',
|
||||||
password: options.password || options.pass || '',
|
password: options.password || options.pass || '',
|
||||||
database: options.endpoint || options.database || 'es_extended',
|
database: options.endpoint || options.database,
|
||||||
charset: 'utf8mb4_unicode_ci',
|
charset: 'utf8mb4_unicode_ci',
|
||||||
connectTimeout: 30000,
|
connectTimeout: 30000,
|
||||||
...options.options,
|
...options.options,
|
||||||
@@ -53,7 +53,7 @@ const createConnection = () => {
|
|||||||
port: options.hosts[0].port || 3306,
|
port: options.hosts[0].port || 3306,
|
||||||
user: options.username || 'root',
|
user: options.username || 'root',
|
||||||
password: options.password || '',
|
password: options.password || '',
|
||||||
database: options.endpoint || 'es_extended',
|
database: options.endpoint,
|
||||||
charset: 'utf8mb4_unicode_ci',
|
charset: 'utf8mb4_unicode_ci',
|
||||||
connectTimeout: 30000,
|
connectTimeout: 30000,
|
||||||
...options.options,
|
...options.options,
|
||||||
|
|||||||
+4
-1
@@ -15,12 +15,15 @@ module.exports = {
|
|||||||
contextRegExp: /./,
|
contextRegExp: /./,
|
||||||
}),
|
}),
|
||||||
new CopyPlugin({
|
new CopyPlugin({
|
||||||
patterns: ["fxmanifest.lua", "wrapper.lua", "README.md", "LICENSE.md"],
|
patterns: ["./lua", "./lua", "README.md", "LICENSE.md"],
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
output: {
|
output: {
|
||||||
filename: "oxmysql.js",
|
filename: "oxmysql.js",
|
||||||
path: path.resolve(__dirname, "dist"),
|
path: path.resolve(__dirname, "dist"),
|
||||||
},
|
},
|
||||||
|
optimization: {
|
||||||
|
minimize: false,
|
||||||
|
},
|
||||||
target: "node",
|
target: "node",
|
||||||
};
|
};
|
||||||
@@ -571,19 +571,6 @@ get-stream@^6.0.0:
|
|||||||
resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-6.0.1.tgz#a262d8eef67aced57c2852ad6167526a43cbf7b7"
|
resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-6.0.1.tgz#a262d8eef67aced57c2852ad6167526a43cbf7b7"
|
||||||
integrity sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==
|
integrity sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==
|
||||||
|
|
||||||
github-graphql-client@^1.0.0:
|
|
||||||
version "1.0.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/github-graphql-client/-/github-graphql-client-1.0.0.tgz#d5acacc31bb9f6b77e5c502812e90c844f727bca"
|
|
||||||
integrity sha1-1ayswxu59rd+XFAoEukMhE9ye8o=
|
|
||||||
|
|
||||||
github-version-checker@^2.2.0:
|
|
||||||
version "2.2.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/github-version-checker/-/github-version-checker-2.2.0.tgz#08a2b52f9ef9cd3dd05b898537750a91b73facec"
|
|
||||||
integrity sha512-Ttj/Uzg++TGfycfn5ga8BfMJ8QYB1+DhG24rtasrN8tHYWgqqrEMAQ52y2qGnPNWzSF8AUdjm6dBcoPdUhKhDQ==
|
|
||||||
dependencies:
|
|
||||||
github-graphql-client "^1.0.0"
|
|
||||||
semver "^5.5.1"
|
|
||||||
|
|
||||||
glob-parent@^5.1.2:
|
glob-parent@^5.1.2:
|
||||||
version "5.1.2"
|
version "5.1.2"
|
||||||
resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4"
|
resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4"
|
||||||
@@ -1137,7 +1124,7 @@ schema-utils@^3.0.0, schema-utils@^3.1.0, schema-utils@^3.1.1:
|
|||||||
ajv "^6.12.5"
|
ajv "^6.12.5"
|
||||||
ajv-keywords "^3.5.2"
|
ajv-keywords "^3.5.2"
|
||||||
|
|
||||||
semver@^5.5.0, semver@^5.5.1, semver@^5.6.0:
|
semver@^5.5.0, semver@^5.6.0:
|
||||||
version "5.7.1"
|
version "5.7.1"
|
||||||
resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7"
|
resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7"
|
||||||
integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==
|
integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==
|
||||||
|
|||||||
Reference in new issue
Block a user