You will also need to perform modifications, insert, update, delete; over the data on the database, for that the Connection provides another set of functions:

3.3.1 prepare()

Prepare a given SQL statement and return the Statement\Statement instance:

let params = {
    'dbname': 'test',
    'host': 'localhost',
    'port': '3306',
    'username': 'root',
    'password': 'password'
};
let driver = new Driver();
let connection = new Connection(params, driver);
let sql = "SELECT * FROM post WHERE id = ?";
let sqlParams = [1];
let statement = connection.prepare(sql, sqlParams);

statement.execute()
    .then(function(response){
      // do something with the data
    })
    .catch(function(error){
      // do something with the error
    });

3.3.2. executeUpdate()

Executes a statement with the given SQL and parameters and returns the affected rows count:

let sql = "UPDATE post SET title = ? WHERE id = ?";
let sqlParams = ['The post title was updated', 1];
return connection.executeUpdate(sql, sqlParams)
    .then(function(response){
      // do something with the data response.affectedRows
    })
    .catch(function(error){
      // do something with the error
    });

3.3.3. executeQuery()

Executes a statement with the given SQL and parameters and returns the rows that match the query:

let sql = "UPDATE post SET title = ? WHERE id = ?";
let sqlParams = ['The post title was updated', 1];
return connection.executeQuery(sql, sqlParams)
    .then(function(response){
      // do something with the data response.affectedRows
    })
    .catch(function(error){
      // do something with the error
    });

3.3.4. fetchColumn()

Retrieve only the given column of the first result row.

let sql = "SELECT title FROM post WHERE id = ?";
let sqlParams = [1];

connection.fetchColumn(sql, sqlParams)
    .then(function (response) {
        // response should be like response === 'Test';
    })
    .catch(function (error) {
        // do something with the error
    });

3.3.5. fetchAssoc()

Retrieve assoc row of the first result row.

let sql = "SELECT * FROM post WHERE id = ?";
let sqlParams = [1];

connection.fetchAssoc(sql, sqlParams)
    .then(function (response) {
        // response should be something like {id: 1,"customer_id": "8a6sd876as87d6ad",title: 'Test',body: 'This is a test'};
    })
    .catch(function (error) {
        // do something with the error
    });

3.3.6. delete()

Delete all rows of a table matching the given identifier, where keys are column names.

let table = "link";
let condition = {
    id: 1
};

return connection.dlete(table, condition)
    .then(function (response) {
        // response should have affectedRows property with value 1;
    })
    .catch(function (error) {
        // do something with the error
    });

3.3.7. insert()

Insert a row into the given table name using the key value pairs of data.

let table = "post";
let data = {
    "customer_id": "8a6sd876as87d6ad",
    title: 'bitgandtter',
    body: 'inserted by nodetrine'
};

return connection.insert(table, data)
    .then(function (response) {
        // INSERT INTO post (customer_id, title, body) VALUES (?, ?, ?) ("8a6sd876as87d6ad", "bitgandtter", "inserted by nodetrine")
        // response should have insertId property with value "8a6sd876as87d6ad";
    })
    .catch(function (error) {
        // do something with the error
    });

3.3.8. update()

Update all rows for the matching key value identifiers with the given data.

let table = "post";
let data = {
    title: 'bitgandtter',
    body: 'updated by nodetrine'
};
let condition = {
    id: 1
};

return connection.update(table, data, condition)
.then(function (response) {
        // UPDATE post SET title = ?, body = ? WHERE id = ? ('bitgandtter', 'updated by nodetrine', 1)
        // response should have affectedRows property with value 1;
    })
    .catch(function (error) {
        // do something with the error
    });