MyQui API Documentation
Here you will learn to use our official libraries.
Installation
You can install this NPM using the command: npm install myqui --save. It is recommended to use NodeJS 14.15.1 LTS for this package.
Learning to use methods
createConnection
createConnection is needed to stablish a connection to make working the database. Also, this will create a .quiconfig.yaml config with some parameters to apply.
const db = require('myqui')
db.createConnection({
host: '127.0.0.1', // 127.0.0.1 is the localhost IP, but you can set simply 'localhost' string.
port: 25560, // this is the default port for MyQui. You can change it.
user: 'root', // root haves all the permissions of the database.
pass: 'aidak1234' // intended to login into the database.
})
connect
connect() will only work if you used createConnection before.
db.connect()
prepare
prepare function is intended to prepare data to later assign changes to the query function.
db.prepare({ db: 'test', key: 'id1', value: 'Jake' })
query
query is intended to execute SQL language for creating db files. You need to use prepare first to use query.
//insert
db.query('INSERT ON DATABASE test PARAMETERS (id1, Jake)') // previosly used on prepare
//select
db.query('SELECT VALUE FROM DATABASE test WHERE KEY = id1')
//evaluate result (check if an object exists)
db.query('EVALUATE RESULT FROM DATABASE test WHERE KEY = id1')
viewSettings
viewSettings allows you to see the current configuration.
db.viewSettings() // returns the content of the current configuration file