Skip to content

Examples INI Connection

Thiago Delgado Pinto edited this page Dec 15, 2017 · 2 revisions

The INI file driver connects to a local INI file. The INI file driver does not support transactions.

In the INI file, sections are treated as tables, anything before the first section is treated as being in the ROOT section. As such tables only contain a single row. INI files are currently read-only.

Connection URL

ini:///file_path

Usage

const Connection = require('database-js2').Connection;

var connection = new Connection('ini:///data.ini');

Select Some Data

var Connection = require('database-js2').Connection;

(async () => {
    let connection, statement, rows;
    connection = new Connection('ini:///test.ini');
    try {
        statement = await connection.prepareStatement("SELECT * FROM ROOT");
        rows = await statement.query();
        console.log(rows);
    } catch (error) {
        console.log(error);
    } finally {
        await connection.close();
    }
})();