2016-11-10 20:15:16 -05:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
let helpers = require('../helpers');
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Driver for Firebird databases
|
|
|
|
*
|
|
|
|
* @module drivers/firebird
|
|
|
|
*/
|
|
|
|
module.exports = (() => {
|
|
|
|
delete require.cache[require.resolve('../Driver')];
|
|
|
|
let driver = require('../Driver');
|
|
|
|
|
|
|
|
driver.hasTruncate = false;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the limit clause
|
|
|
|
|
|
|
|
* @param {String} origSql - SQL statement to modify
|
|
|
|
* @param {Number} limit - Maximum number of rows to fetch
|
|
|
|
* @param {Number|null} offset - Number of rows to skip
|
|
|
|
* @return {String} - Modified SQL statement
|
|
|
|
*/
|
|
|
|
driver.limit = (origSql, limit, offset) => {
|
|
|
|
let sql = `FIRST ${limit}`;
|
|
|
|
|
2016-11-18 21:59:22 -05:00
|
|
|
if (helpers.isNumber(offset)) {
|
2016-11-10 20:15:16 -05:00
|
|
|
sql += ` SKIP ${offset}`;
|
|
|
|
}
|
|
|
|
|
|
|
|
return origSql.replace(/SELECT/i, `SELECT ${sql}`);
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* SQL to insert a group of rows
|
|
|
|
*
|
|
|
|
* @return {void}
|
|
|
|
* @throws {Error}
|
|
|
|
*/
|
|
|
|
driver.insertBatch = () => {
|
|
|
|
throw new Error('Not Implemented');
|
|
|
|
};
|
|
|
|
|
|
|
|
return driver;
|
2016-11-18 21:59:22 -05:00
|
|
|
})();
|