Compare commits

...
2 Commits
Author SHA1 Message Date
dunak-debug af75f140ac fix(config): Throw error when connection string not found 2022-01-01 23:37:59 +01:00
Linden 8f7fc7bee7 Update README.md 2021-12-31 01:20:47 +11:00
2 changed files with 4 additions and 0 deletions

No files matched your search

+2
View File
@@ -6,6 +6,8 @@ Oxmysql is an alternative to the unmaintained mysql-async/ghmattimysql resources
As of v1.9.0 the preferred method of utilising oxmysql is via lib/MySQL, which can be loaded by adding `@oxmysql/lib/MySQL.lua` to your resource manifests. This resource should be 100% backwards compatible with mysql-async functionality on top of providing newer export wrappers and functionality. As of v1.9.0 the preferred method of utilising oxmysql is via lib/MySQL, which can be loaded by adding `@oxmysql/lib/MySQL.lua` to your resource manifests. This resource should be 100% backwards compatible with mysql-async functionality on top of providing newer export wrappers and functionality.
Refer to [issue #77](https://github.com/overextended/oxmysql/issues/77) for information on replacing your queries from older versions of oxmysql or ghmattimysql.
### Features ### Features
- Support for URI connection strings and semicolon separated values - Support for URI connection strings and semicolon separated values
- Asynchronous queries utilising mysql2/promises connection pool - Asynchronous queries utilising mysql2/promises connection pool
+2
View File
@@ -2,6 +2,8 @@ import { createPool } from 'mysql2/promise';
import { mysql_connection_string, mysql_transaction_isolation_level, typeCast } from '../config.js'; import { mysql_connection_string, mysql_transaction_isolation_level, typeCast } from '../config.js';
const connectionString = (() => { const connectionString = (() => {
if (mysql_connection_string === '') throw new Error(`^1Missing mysql_connection_string in server.cfg! Refer to the documentation^0`);
if (mysql_connection_string.includes('mysql://')) return { uri: mysql_connection_string }; if (mysql_connection_string.includes('mysql://')) return { uri: mysql_connection_string };
const options = mysql_connection_string const options = mysql_connection_string