node-query/lib/drivers/Firebird.js

47 lines
996 B
JavaScript

"use strict";
let helpers = require('../helpers');
/**
* Driver for Firebird databases
*
* @module drivers/firebird
*/
module.exports = (function() {
delete require.cache[require.resolve('../Driver')];
let driver = require('../Driver');
driver.hasTruncate = false;
/**
* Generate a limit clause for firebird, which uses the syntax closest to the SQL standard
*
* @param {String} sql
* @param {Number} limit
* @param {Number} offset
* @return {String}
*/
driver.limit = function(origSql, limit, offset) {
let sql = 'FIRST ' + limit;
if (helpers.isNumber(offset))
{
sql += ' SKIP ' + offset;
}
return origSql.replace(/SELECT/i, "SELECT " + sql);;
};
/**
* SQL to insert a group of rows
*
* @param {String} table - The table to insert to
* @param {Array} [data] - The array of object containing data to insert
* @return {String}
*/
driver.insertBatch = function(table, data) {
throw new Error("Not Implemented");
};
return driver;
}());