Closed thiagodp closed 6 years ago
With the current implementation, the driver is loaded with a require. Since there were several packages with those names, I opted to use the longer names.
We could use a scheme like:
function loadModule(driver_name) {
try {
require.resolve(driver_name);
return require(driver_name);
} catch (e) {
return false;
}
}
driver = loadModule('database-js-' + driver_name) || loadModule('jsdbc-' + driver_name) || require(driver_name);
That would allow database-js-* drivers to be loaded by their simple name.
Added in 8512ad58171c1b0a30ef0870ea3690d8dd7f631b, and tagged in v1.3.1
Simple names (e.g. postgres, mysql) will now resolve to database-js-simplename or jsdbc-simplename.
Instead of using
database-js-driver://
, the project could adopt justdriver://
.Examples (JDBC-like):
mysql
for MySQL databases (currentlydatabase-js-mysql
)postgresql
for PostgreSQL databases (currentlydatabase-js-postgres
)sqlite
for SQLite databases (currentlydatabase-js-sqlite
)firebase
for Firebase databases (currentlydatabase-js-firebase
)ado
for ActiveX Data Objects, like MS Excel tables and MS Access databases (currentlydatabase-js-adodb
)ini
for INI files (currentlydatabase-js-ini
)Other examples (for future use?):
json
for JSON filesxml
for XML filesodbc
for ODBC access to databasesoracle
for Oracle databasessqlserver
for MS SQL Server databasesfirebirdsql
for Firebird databasesmariadb
for MariaDB (as an alternative driver to MySQL)