26 lines
617 B
JavaScript
26 lines
617 B
JavaScript
import { readFileSync } from 'fs';
|
|
import { MariaDB } from '../build/esm/index.js';
|
|
|
|
const credentials = JSON.parse(readFileSync('./credentials.json', { encoding: 'utf-8' }));
|
|
|
|
const maria = new MariaDB({
|
|
createLogger: () =>
|
|
{
|
|
return {
|
|
debug: console.log,
|
|
info: console.log,
|
|
status: console.log,
|
|
warn: console.log,
|
|
error: console.error
|
|
};
|
|
}
|
|
}, {
|
|
load: true,
|
|
credentials
|
|
});
|
|
|
|
await maria.init();
|
|
|
|
await maria.query('INSERT INTO `test` (`dingle`, `bingle`) VALUES ?', [[ 1, 2 ], [ 3, 4 ], [ 5, 6 ]]);
|
|
|
|
await maria.close(); |