Add initial version of dijkstra backend cloudron image
This commit is contained in:
20
node_modules/knex/lib/dialects/oracle/formatter.js
generated
vendored
Normal file
20
node_modules/knex/lib/dialects/oracle/formatter.js
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
const Formatter = require('../../formatter');
|
||||
const { ReturningHelper } = require('./utils');
|
||||
|
||||
class Oracle_Formatter extends Formatter {
|
||||
alias(first, second) {
|
||||
return first + ' ' + second;
|
||||
}
|
||||
|
||||
parameter(value, notSetValue) {
|
||||
// Returning helper uses always ROWID as string
|
||||
if (value instanceof ReturningHelper && this.client.driver) {
|
||||
value = new this.client.driver.OutParam(this.client.driver.OCCISTRING);
|
||||
} else if (typeof value === 'boolean') {
|
||||
value = value ? 1 : 0;
|
||||
}
|
||||
return super.parameter(value, notSetValue);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Oracle_Formatter;
|
||||
196
node_modules/knex/lib/dialects/oracle/index.js
generated
vendored
Normal file
196
node_modules/knex/lib/dialects/oracle/index.js
generated
vendored
Normal file
@@ -0,0 +1,196 @@
|
||||
// Oracle Client
|
||||
// -------
|
||||
const { map, flatten, values } = require('lodash');
|
||||
const { promisify } = require('util');
|
||||
|
||||
const inherits = require('inherits');
|
||||
const Client = require('../../client');
|
||||
const Bluebird = require('bluebird');
|
||||
const { bufferToString } = require('../../query/string');
|
||||
const Formatter = require('./formatter');
|
||||
|
||||
const Transaction = require('./transaction');
|
||||
const QueryCompiler = require('./query/compiler');
|
||||
const SchemaCompiler = require('./schema/compiler');
|
||||
const ColumnBuilder = require('./schema/columnbuilder');
|
||||
const ColumnCompiler = require('./schema/columncompiler');
|
||||
const TableCompiler = require('./schema/tablecompiler');
|
||||
const { ReturningHelper, isConnectionError } = require('./utils');
|
||||
|
||||
// Always initialize with the "QueryBuilder" and "QueryCompiler"
|
||||
// objects, which extend the base 'lib/query/builder' and
|
||||
// 'lib/query/compiler', respectively.
|
||||
function Client_Oracle(config) {
|
||||
Client.call(this, config);
|
||||
}
|
||||
|
||||
inherits(Client_Oracle, Client);
|
||||
|
||||
Object.assign(Client_Oracle.prototype, {
|
||||
dialect: 'oracle',
|
||||
|
||||
driverName: 'oracle',
|
||||
|
||||
_driver() {
|
||||
return require('oracle');
|
||||
},
|
||||
|
||||
transaction() {
|
||||
return new Transaction(this, ...arguments);
|
||||
},
|
||||
|
||||
formatter() {
|
||||
return new Formatter(this, ...arguments);
|
||||
},
|
||||
|
||||
queryCompiler() {
|
||||
return new QueryCompiler(this, ...arguments);
|
||||
},
|
||||
|
||||
schemaCompiler() {
|
||||
return new SchemaCompiler(this, ...arguments);
|
||||
},
|
||||
|
||||
columnBuilder() {
|
||||
return new ColumnBuilder(this, ...arguments);
|
||||
},
|
||||
|
||||
columnCompiler() {
|
||||
return new ColumnCompiler(this, ...arguments);
|
||||
},
|
||||
|
||||
tableCompiler() {
|
||||
return new TableCompiler(this, ...arguments);
|
||||
},
|
||||
|
||||
prepBindings(bindings) {
|
||||
return map(bindings, (value) => {
|
||||
// returning helper uses always ROWID as string
|
||||
if (value instanceof ReturningHelper && this.driver) {
|
||||
return new this.driver.OutParam(this.driver.OCCISTRING);
|
||||
} else if (typeof value === 'boolean') {
|
||||
return value ? 1 : 0;
|
||||
} else if (Buffer.isBuffer(value)) {
|
||||
return bufferToString(value);
|
||||
}
|
||||
return value;
|
||||
});
|
||||
},
|
||||
|
||||
// Get a raw connection, called by the `pool` whenever a new
|
||||
// connection needs to be added to the pool.
|
||||
acquireRawConnection() {
|
||||
return new Bluebird((resolver, rejecter) => {
|
||||
this.driver.connect(this.connectionSettings, (err, connection) => {
|
||||
if (err) return rejecter(err);
|
||||
Bluebird.promisifyAll(connection);
|
||||
if (this.connectionSettings.prefetchRowCount) {
|
||||
connection.setPrefetchRowCount(
|
||||
this.connectionSettings.prefetchRowCount
|
||||
);
|
||||
}
|
||||
resolver(connection);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
// Used to explicitly close a connection, called internally by the pool
|
||||
// when a connection times out or the pool is shutdown.
|
||||
async destroyRawConnection(connection) {
|
||||
const close = promisify((cb) => connection.close(cb));
|
||||
return close();
|
||||
},
|
||||
|
||||
// Return the database for the Oracle client.
|
||||
database() {
|
||||
return this.connectionSettings.database;
|
||||
},
|
||||
|
||||
// Position the bindings for the query.
|
||||
positionBindings(sql) {
|
||||
let questionCount = 0;
|
||||
return sql.replace(/\?/g, function() {
|
||||
questionCount += 1;
|
||||
return `:${questionCount}`;
|
||||
});
|
||||
},
|
||||
|
||||
_stream(connection, obj, stream, options) {
|
||||
return new Bluebird(function(resolver, rejecter) {
|
||||
stream.on('error', (err) => {
|
||||
if (isConnectionError(err)) {
|
||||
connection.__knex__disposed = err;
|
||||
}
|
||||
rejecter(err);
|
||||
});
|
||||
stream.on('end', resolver);
|
||||
const queryStream = connection.queryStream(
|
||||
obj.sql,
|
||||
obj.bindings,
|
||||
options
|
||||
);
|
||||
queryStream.pipe(stream);
|
||||
queryStream.on('error', function(error) {
|
||||
rejecter(error);
|
||||
stream.emit('error', error);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
// Runs the query on the specified connection, providing the bindings
|
||||
// and any other necessary prep work.
|
||||
_query(connection, obj) {
|
||||
if (!obj.sql) throw new Error('The query is empty');
|
||||
|
||||
return connection
|
||||
.executeAsync(obj.sql, obj.bindings)
|
||||
.then(function(response) {
|
||||
if (!obj.returning) return response;
|
||||
const rowIds = obj.outParams.map(
|
||||
(v, i) => response[`returnParam${i ? i : ''}`]
|
||||
);
|
||||
return connection.executeAsync(obj.returningSql, rowIds);
|
||||
})
|
||||
.then(function(response) {
|
||||
obj.response = response;
|
||||
obj.rowsAffected = response.updateCount;
|
||||
return obj;
|
||||
})
|
||||
.catch((err) => {
|
||||
if (isConnectionError(err)) {
|
||||
connection.__knex__disposed = err;
|
||||
}
|
||||
throw err;
|
||||
});
|
||||
},
|
||||
|
||||
// Process the response as returned from the query.
|
||||
processResponse(obj, runner) {
|
||||
let { response } = obj;
|
||||
const { method } = obj;
|
||||
if (obj.output) return obj.output.call(runner, response);
|
||||
switch (method) {
|
||||
case 'select':
|
||||
case 'pluck':
|
||||
case 'first':
|
||||
if (obj.method === 'pluck') response = map(response, obj.pluck);
|
||||
return obj.method === 'first' ? response[0] : response;
|
||||
case 'insert':
|
||||
case 'del':
|
||||
case 'update':
|
||||
case 'counter':
|
||||
if (obj.returning) {
|
||||
if (obj.returning.length > 1 || obj.returning[0] === '*') {
|
||||
return response;
|
||||
}
|
||||
// return an array with values if only one returning value was specified
|
||||
return flatten(map(response, values));
|
||||
}
|
||||
return obj.rowsAffected;
|
||||
default:
|
||||
return response;
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
module.exports = Client_Oracle;
|
||||
325
node_modules/knex/lib/dialects/oracle/query/compiler.js
generated
vendored
Normal file
325
node_modules/knex/lib/dialects/oracle/query/compiler.js
generated
vendored
Normal file
@@ -0,0 +1,325 @@
|
||||
/* eslint max-len:0 */
|
||||
|
||||
// Oracle Query Builder & Compiler
|
||||
// ------
|
||||
const {
|
||||
assign,
|
||||
isPlainObject,
|
||||
isEmpty,
|
||||
isString,
|
||||
map,
|
||||
reduce,
|
||||
compact,
|
||||
identity,
|
||||
} = require('lodash');
|
||||
const inherits = require('inherits');
|
||||
const QueryCompiler = require('../../../query/compiler');
|
||||
const { ReturningHelper } = require('../utils');
|
||||
|
||||
const components = [
|
||||
'columns',
|
||||
'join',
|
||||
'where',
|
||||
'union',
|
||||
'group',
|
||||
'having',
|
||||
'order',
|
||||
'lock',
|
||||
];
|
||||
|
||||
// Query Compiler
|
||||
// -------
|
||||
|
||||
// Set the "Formatter" to use for the queries,
|
||||
// ensuring that all parameterized values (even across sub-queries)
|
||||
// are properly built into the same query.
|
||||
function QueryCompiler_Oracle(client, builder) {
|
||||
QueryCompiler.call(this, client, builder);
|
||||
}
|
||||
|
||||
inherits(QueryCompiler_Oracle, QueryCompiler);
|
||||
|
||||
assign(QueryCompiler_Oracle.prototype, {
|
||||
// Compiles an "insert" query, allowing for multiple
|
||||
// inserts using a single query statement.
|
||||
insert() {
|
||||
let insertValues = this.single.insert || [];
|
||||
let { returning } = this.single;
|
||||
|
||||
if (!Array.isArray(insertValues) && isPlainObject(this.single.insert)) {
|
||||
insertValues = [this.single.insert];
|
||||
}
|
||||
|
||||
// always wrap returning argument in array
|
||||
if (returning && !Array.isArray(returning)) {
|
||||
returning = [returning];
|
||||
}
|
||||
|
||||
if (
|
||||
Array.isArray(insertValues) &&
|
||||
insertValues.length === 1 &&
|
||||
isEmpty(insertValues[0])
|
||||
) {
|
||||
return this._addReturningToSqlAndConvert(
|
||||
`insert into ${this.tableName} (${this.formatter.wrap(
|
||||
this.single.returning
|
||||
)}) values (default)`,
|
||||
returning,
|
||||
this.tableName
|
||||
);
|
||||
}
|
||||
|
||||
if (
|
||||
isEmpty(this.single.insert) &&
|
||||
typeof this.single.insert !== 'function'
|
||||
) {
|
||||
return '';
|
||||
}
|
||||
|
||||
const insertData = this._prepInsert(insertValues);
|
||||
|
||||
const sql = {};
|
||||
|
||||
if (isString(insertData)) {
|
||||
return this._addReturningToSqlAndConvert(
|
||||
`insert into ${this.tableName} ${insertData}`,
|
||||
returning
|
||||
);
|
||||
}
|
||||
|
||||
if (insertData.values.length === 1) {
|
||||
return this._addReturningToSqlAndConvert(
|
||||
`insert into ${this.tableName} (${this.formatter.columnize(
|
||||
insertData.columns
|
||||
)}) values (${this.formatter.parameterize(insertData.values[0])})`,
|
||||
returning,
|
||||
this.tableName
|
||||
);
|
||||
}
|
||||
|
||||
const insertDefaultsOnly = insertData.columns.length === 0;
|
||||
|
||||
sql.sql =
|
||||
'begin ' +
|
||||
map(insertData.values, (value) => {
|
||||
let returningHelper;
|
||||
const parameterizedValues = !insertDefaultsOnly
|
||||
? this.formatter.parameterize(value, this.client.valueForUndefined)
|
||||
: '';
|
||||
const returningValues = Array.isArray(returning)
|
||||
? returning
|
||||
: [returning];
|
||||
let subSql = `insert into ${this.tableName} `;
|
||||
|
||||
if (returning) {
|
||||
returningHelper = new ReturningHelper(returningValues.join(':'));
|
||||
sql.outParams = (sql.outParams || []).concat(returningHelper);
|
||||
}
|
||||
|
||||
if (insertDefaultsOnly) {
|
||||
// no columns given so only the default value
|
||||
subSql += `(${this.formatter.wrap(
|
||||
this.single.returning
|
||||
)}) values (default)`;
|
||||
} else {
|
||||
subSql += `(${this.formatter.columnize(
|
||||
insertData.columns
|
||||
)}) values (${parameterizedValues})`;
|
||||
}
|
||||
subSql += returning
|
||||
? ` returning ROWID into ${this.formatter.parameter(returningHelper)}`
|
||||
: '';
|
||||
|
||||
// pre bind position because subSql is an execute immediate parameter
|
||||
// later position binding will only convert the ? params
|
||||
|
||||
subSql = this.formatter.client.positionBindings(subSql);
|
||||
|
||||
const parameterizedValuesWithoutDefault = parameterizedValues
|
||||
.replace('DEFAULT, ', '')
|
||||
.replace(', DEFAULT', '');
|
||||
return (
|
||||
`execute immediate '${subSql.replace(/'/g, "''")}` +
|
||||
(parameterizedValuesWithoutDefault || returning ? "' using " : '') +
|
||||
parameterizedValuesWithoutDefault +
|
||||
(parameterizedValuesWithoutDefault && returning ? ', ' : '') +
|
||||
(returning ? 'out ?' : '') +
|
||||
';'
|
||||
);
|
||||
}).join(' ') +
|
||||
'end;';
|
||||
|
||||
if (returning) {
|
||||
sql.returning = returning;
|
||||
// generate select statement with special order by to keep the order because 'in (..)' may change the order
|
||||
sql.returningSql =
|
||||
`select ${this.formatter.columnize(returning)}` +
|
||||
' from ' +
|
||||
this.tableName +
|
||||
' where ROWID in (' +
|
||||
sql.outParams.map((v, i) => `:${i + 1}`).join(', ') +
|
||||
')' +
|
||||
' order by case ROWID ' +
|
||||
sql.outParams
|
||||
.map((v, i) => `when CHARTOROWID(:${i + 1}) then ${i}`)
|
||||
.join(' ') +
|
||||
' end';
|
||||
}
|
||||
|
||||
return sql;
|
||||
},
|
||||
|
||||
// Update method, including joins, wheres, order & limits.
|
||||
update() {
|
||||
const updates = this._prepUpdate(this.single.update);
|
||||
const where = this.where();
|
||||
let { returning } = this.single;
|
||||
const sql =
|
||||
`update ${this.tableName}` +
|
||||
' set ' +
|
||||
updates.join(', ') +
|
||||
(where ? ` ${where}` : '');
|
||||
|
||||
if (!returning) {
|
||||
return sql;
|
||||
}
|
||||
|
||||
// always wrap returning argument in array
|
||||
if (!Array.isArray(returning)) {
|
||||
returning = [returning];
|
||||
}
|
||||
|
||||
return this._addReturningToSqlAndConvert(sql, returning, this.tableName);
|
||||
},
|
||||
|
||||
// Compiles a `truncate` query.
|
||||
truncate() {
|
||||
return `truncate table ${this.tableName}`;
|
||||
},
|
||||
|
||||
forUpdate() {
|
||||
return 'for update';
|
||||
},
|
||||
|
||||
forShare() {
|
||||
// lock for share is not directly supported by oracle
|
||||
// use LOCK TABLE .. IN SHARE MODE; instead
|
||||
this.client.logger.warn(
|
||||
'lock for share is not supported by oracle dialect'
|
||||
);
|
||||
return '';
|
||||
},
|
||||
|
||||
// Compiles a `columnInfo` query.
|
||||
columnInfo() {
|
||||
const column = this.single.columnInfo;
|
||||
|
||||
// The user may have specified a custom wrapIdentifier function in the config. We
|
||||
// need to run the identifiers through that function, but not format them as
|
||||
// identifiers otherwise.
|
||||
const table = this.client.customWrapIdentifier(this.single.table, identity);
|
||||
|
||||
// Node oracle drivers doesn't support LONG type (which is data_default type)
|
||||
const sql = `select * from xmltable( '/ROWSET/ROW'
|
||||
passing dbms_xmlgen.getXMLType('
|
||||
select char_col_decl_length, column_name, data_type, data_default, nullable
|
||||
from user_tab_columns where table_name = ''${table}'' ')
|
||||
columns
|
||||
CHAR_COL_DECL_LENGTH number, COLUMN_NAME varchar2(200), DATA_TYPE varchar2(106),
|
||||
DATA_DEFAULT clob, NULLABLE varchar2(1))`;
|
||||
|
||||
return {
|
||||
sql: sql,
|
||||
output(resp) {
|
||||
const out = reduce(
|
||||
resp,
|
||||
function(columns, val) {
|
||||
columns[val.COLUMN_NAME] = {
|
||||
type: val.DATA_TYPE,
|
||||
defaultValue: val.DATA_DEFAULT,
|
||||
maxLength: val.CHAR_COL_DECL_LENGTH,
|
||||
nullable: val.NULLABLE === 'Y',
|
||||
};
|
||||
return columns;
|
||||
},
|
||||
{}
|
||||
);
|
||||
return (column && out[column]) || out;
|
||||
},
|
||||
};
|
||||
},
|
||||
|
||||
select() {
|
||||
let query = this.with();
|
||||
const statements = map(components, (component) => {
|
||||
return this[component]();
|
||||
});
|
||||
query += compact(statements).join(' ');
|
||||
return this._surroundQueryWithLimitAndOffset(query);
|
||||
},
|
||||
|
||||
aggregate(stmt) {
|
||||
return this._aggregate(stmt, { aliasSeparator: ' ' });
|
||||
},
|
||||
|
||||
// for single commands only
|
||||
_addReturningToSqlAndConvert(sql, returning, tableName) {
|
||||
const res = {
|
||||
sql,
|
||||
};
|
||||
|
||||
if (!returning) {
|
||||
return res;
|
||||
}
|
||||
|
||||
const returningValues = Array.isArray(returning) ? returning : [returning];
|
||||
const returningHelper = new ReturningHelper(returningValues.join(':'));
|
||||
res.sql =
|
||||
sql +
|
||||
' returning ROWID into ' +
|
||||
this.formatter.parameter(returningHelper);
|
||||
res.returningSql = `select ${this.formatter.columnize(
|
||||
returning
|
||||
)} from ${tableName} where ROWID = :1`;
|
||||
res.outParams = [returningHelper];
|
||||
res.returning = returning;
|
||||
return res;
|
||||
},
|
||||
|
||||
_surroundQueryWithLimitAndOffset(query) {
|
||||
let { limit } = this.single;
|
||||
const { offset } = this.single;
|
||||
const hasLimit = limit || limit === 0 || limit === '0';
|
||||
limit = +limit;
|
||||
|
||||
if (!hasLimit && !offset) return query;
|
||||
query = query || '';
|
||||
|
||||
if (hasLimit && !offset) {
|
||||
return `select * from (${query}) where rownum <= ${this.formatter.parameter(
|
||||
limit
|
||||
)}`;
|
||||
}
|
||||
|
||||
const endRow = +offset + (hasLimit ? limit : 10000000000000);
|
||||
|
||||
return (
|
||||
'select * from ' +
|
||||
'(select row_.*, ROWNUM rownum_ from (' +
|
||||
query +
|
||||
') row_ ' +
|
||||
'where rownum <= ' +
|
||||
this.formatter.parameter(endRow) +
|
||||
') ' +
|
||||
'where rownum_ > ' +
|
||||
this.formatter.parameter(offset)
|
||||
);
|
||||
},
|
||||
});
|
||||
|
||||
// Compiles the `select` statement, or nested sub-selects
|
||||
// by calling each of the component compilers, trimming out
|
||||
// the empties, and returning a generated query string.
|
||||
QueryCompiler_Oracle.prototype.first = QueryCompiler_Oracle.prototype.select;
|
||||
|
||||
module.exports = QueryCompiler_Oracle;
|
||||
18
node_modules/knex/lib/dialects/oracle/schema/columnbuilder.js
generated
vendored
Normal file
18
node_modules/knex/lib/dialects/oracle/schema/columnbuilder.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
const inherits = require('inherits');
|
||||
const ColumnBuilder = require('../../../schema/columnbuilder');
|
||||
|
||||
const { toArray } = require('lodash');
|
||||
|
||||
function ColumnBuilder_Oracle() {
|
||||
ColumnBuilder.apply(this, arguments);
|
||||
}
|
||||
inherits(ColumnBuilder_Oracle, ColumnBuilder);
|
||||
|
||||
// checkIn added to the builder to allow the column compiler to change the
|
||||
// order via the modifiers ("check" must be after "default")
|
||||
ColumnBuilder_Oracle.prototype.checkIn = function() {
|
||||
this._modifiers.checkIn = toArray(arguments);
|
||||
return this;
|
||||
};
|
||||
|
||||
module.exports = ColumnBuilder_Oracle;
|
||||
139
node_modules/knex/lib/dialects/oracle/schema/columncompiler.js
generated
vendored
Normal file
139
node_modules/knex/lib/dialects/oracle/schema/columncompiler.js
generated
vendored
Normal file
@@ -0,0 +1,139 @@
|
||||
const { uniq, map } = require('lodash');
|
||||
const inherits = require('inherits');
|
||||
const Raw = require('../../../raw');
|
||||
const ColumnCompiler = require('../../../schema/columncompiler');
|
||||
const Trigger = require('./trigger');
|
||||
|
||||
// Column Compiler
|
||||
// -------
|
||||
|
||||
function ColumnCompiler_Oracle() {
|
||||
ColumnCompiler.apply(this, arguments);
|
||||
this.modifiers = ['defaultTo', 'checkIn', 'nullable', 'comment'];
|
||||
}
|
||||
inherits(ColumnCompiler_Oracle, ColumnCompiler);
|
||||
|
||||
Object.assign(ColumnCompiler_Oracle.prototype, {
|
||||
// helper function for pushAdditional in increments() and bigincrements()
|
||||
_createAutoIncrementTriggerAndSequence() {
|
||||
// TODO Add warning that sequence etc is created
|
||||
this.pushAdditional(function() {
|
||||
const tableName = this.tableCompiler.tableNameRaw;
|
||||
const createTriggerSQL = Trigger.createAutoIncrementTrigger(
|
||||
this.client.logger,
|
||||
tableName
|
||||
);
|
||||
this.pushQuery(createTriggerSQL);
|
||||
});
|
||||
},
|
||||
|
||||
increments() {
|
||||
this._createAutoIncrementTriggerAndSequence();
|
||||
return 'integer not null primary key';
|
||||
},
|
||||
|
||||
bigincrements() {
|
||||
this._createAutoIncrementTriggerAndSequence();
|
||||
return 'number(20, 0) not null primary key';
|
||||
},
|
||||
|
||||
floating(precision) {
|
||||
const parsedPrecision = this._num(precision, 0);
|
||||
return `float${parsedPrecision ? `(${parsedPrecision})` : ''}`;
|
||||
},
|
||||
|
||||
double(precision, scale) {
|
||||
// if (!precision) return 'number'; // TODO: Check If default is ok
|
||||
return `number(${this._num(precision, 8)}, ${this._num(scale, 2)})`;
|
||||
},
|
||||
|
||||
decimal(precision, scale) {
|
||||
if (precision === null) return 'decimal';
|
||||
return `decimal(${this._num(precision, 8)}, ${this._num(scale, 2)})`;
|
||||
},
|
||||
|
||||
integer(length) {
|
||||
return length ? `number(${this._num(length, 11)})` : 'integer';
|
||||
},
|
||||
|
||||
tinyint: 'smallint',
|
||||
|
||||
smallint: 'smallint',
|
||||
|
||||
mediumint: 'integer',
|
||||
|
||||
biginteger: 'number(20, 0)',
|
||||
|
||||
text: 'clob',
|
||||
|
||||
enu(allowed) {
|
||||
allowed = uniq(allowed);
|
||||
const maxLength = (allowed || []).reduce(
|
||||
(maxLength, name) => Math.max(maxLength, String(name).length),
|
||||
1
|
||||
);
|
||||
|
||||
// implicitly add the enum values as checked values
|
||||
this.columnBuilder._modifiers.checkIn = [allowed];
|
||||
|
||||
return `varchar2(${maxLength})`;
|
||||
},
|
||||
|
||||
time: 'timestamp with time zone',
|
||||
|
||||
datetime(without) {
|
||||
return without ? 'timestamp' : 'timestamp with time zone';
|
||||
},
|
||||
|
||||
timestamp(without) {
|
||||
return without ? 'timestamp' : 'timestamp with time zone';
|
||||
},
|
||||
|
||||
bit: 'clob',
|
||||
|
||||
json: 'clob',
|
||||
|
||||
bool() {
|
||||
// implicitly add the check for 0 and 1
|
||||
this.columnBuilder._modifiers.checkIn = [[0, 1]];
|
||||
return 'number(1, 0)';
|
||||
},
|
||||
|
||||
varchar(length) {
|
||||
return `varchar2(${this._num(length, 255)})`;
|
||||
},
|
||||
|
||||
// Modifiers
|
||||
// ------
|
||||
|
||||
comment(comment) {
|
||||
const columnName = this.args[0] || this.defaults('columnName');
|
||||
|
||||
this.pushAdditional(function() {
|
||||
this.pushQuery(
|
||||
`comment on column ${this.tableCompiler.tableName()}.` +
|
||||
this.formatter.wrap(columnName) +
|
||||
" is '" +
|
||||
(comment || '') +
|
||||
"'"
|
||||
);
|
||||
}, comment);
|
||||
},
|
||||
|
||||
checkIn(value) {
|
||||
// TODO: Maybe accept arguments also as array
|
||||
// TODO: value(s) should be escaped properly
|
||||
if (value === undefined) {
|
||||
return '';
|
||||
} else if (value instanceof Raw) {
|
||||
value = value.toQuery();
|
||||
} else if (Array.isArray(value)) {
|
||||
value = map(value, (v) => `'${v}'`).join(', ');
|
||||
} else {
|
||||
value = `'${value}'`;
|
||||
}
|
||||
return `check (${this.formatter.wrap(this.args[0])} in (${value}))`;
|
||||
},
|
||||
});
|
||||
|
||||
module.exports = ColumnCompiler_Oracle;
|
||||
81
node_modules/knex/lib/dialects/oracle/schema/compiler.js
generated
vendored
Normal file
81
node_modules/knex/lib/dialects/oracle/schema/compiler.js
generated
vendored
Normal file
@@ -0,0 +1,81 @@
|
||||
// Oracle Schema Compiler
|
||||
// -------
|
||||
const inherits = require('inherits');
|
||||
const SchemaCompiler = require('../../../schema/compiler');
|
||||
const utils = require('../utils');
|
||||
const Trigger = require('./trigger');
|
||||
|
||||
function SchemaCompiler_Oracle() {
|
||||
SchemaCompiler.apply(this, arguments);
|
||||
}
|
||||
inherits(SchemaCompiler_Oracle, SchemaCompiler);
|
||||
|
||||
// Rename a table on the schema.
|
||||
SchemaCompiler_Oracle.prototype.renameTable = function(tableName, to) {
|
||||
const renameTable = Trigger.renameTableAndAutoIncrementTrigger(
|
||||
this.client.logger,
|
||||
tableName,
|
||||
to
|
||||
);
|
||||
this.pushQuery(renameTable);
|
||||
};
|
||||
|
||||
// Check whether a table exists on the query.
|
||||
SchemaCompiler_Oracle.prototype.hasTable = function(tableName) {
|
||||
this.pushQuery({
|
||||
sql:
|
||||
'select TABLE_NAME from USER_TABLES where TABLE_NAME = ' +
|
||||
this.formatter.parameter(tableName),
|
||||
output(resp) {
|
||||
return resp.length > 0;
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
// Check whether a column exists on the schema.
|
||||
SchemaCompiler_Oracle.prototype.hasColumn = function(tableName, column) {
|
||||
const sql =
|
||||
`select COLUMN_NAME from USER_TAB_COLUMNS ` +
|
||||
`where TABLE_NAME = ${this.formatter.parameter(tableName)} ` +
|
||||
`and COLUMN_NAME = ${this.formatter.parameter(column)}`;
|
||||
this.pushQuery({ sql, output: (resp) => resp.length > 0 });
|
||||
};
|
||||
|
||||
SchemaCompiler_Oracle.prototype.dropSequenceIfExists = function(sequenceName) {
|
||||
this.pushQuery(
|
||||
utils.wrapSqlWithCatch(
|
||||
`drop sequence ${this.formatter.wrap(sequenceName)}`,
|
||||
-2289
|
||||
)
|
||||
);
|
||||
};
|
||||
|
||||
SchemaCompiler_Oracle.prototype._dropRelatedSequenceIfExists = function(
|
||||
tableName
|
||||
) {
|
||||
// removing the sequence that was possibly generated by increments() column
|
||||
const sequenceName = utils.generateCombinedName(
|
||||
this.client.logger,
|
||||
'seq',
|
||||
tableName
|
||||
);
|
||||
this.dropSequenceIfExists(sequenceName);
|
||||
};
|
||||
|
||||
SchemaCompiler_Oracle.prototype.dropTable = function(tableName) {
|
||||
this.pushQuery(`drop table ${this.formatter.wrap(tableName)}`);
|
||||
|
||||
// removing the sequence that was possibly generated by increments() column
|
||||
this._dropRelatedSequenceIfExists(tableName);
|
||||
};
|
||||
|
||||
SchemaCompiler_Oracle.prototype.dropTableIfExists = function(tableName) {
|
||||
this.pushQuery(
|
||||
utils.wrapSqlWithCatch(`drop table ${this.formatter.wrap(tableName)}`, -942)
|
||||
);
|
||||
|
||||
// removing the sequence that was possibly generated by increments() column
|
||||
this._dropRelatedSequenceIfExists(tableName);
|
||||
};
|
||||
|
||||
module.exports = SchemaCompiler_Oracle;
|
||||
167
node_modules/knex/lib/dialects/oracle/schema/tablecompiler.js
generated
vendored
Normal file
167
node_modules/knex/lib/dialects/oracle/schema/tablecompiler.js
generated
vendored
Normal file
@@ -0,0 +1,167 @@
|
||||
/* eslint max-len:0 */
|
||||
|
||||
const inherits = require('inherits');
|
||||
const utils = require('../utils');
|
||||
const TableCompiler = require('../../../schema/tablecompiler');
|
||||
const helpers = require('../../../helpers');
|
||||
const Trigger = require('./trigger');
|
||||
|
||||
const { map } = require('lodash');
|
||||
|
||||
// Table Compiler
|
||||
// ------
|
||||
|
||||
function TableCompiler_Oracle() {
|
||||
TableCompiler.apply(this, arguments);
|
||||
}
|
||||
inherits(TableCompiler_Oracle, TableCompiler);
|
||||
|
||||
Object.assign(TableCompiler_Oracle.prototype, {
|
||||
addColumns(columns, prefix) {
|
||||
if (columns.sql.length > 0) {
|
||||
prefix = prefix || this.addColumnsPrefix;
|
||||
|
||||
const columnSql = map(columns.sql, (column) => column);
|
||||
const alter = this.lowerCase ? 'alter table ' : 'ALTER TABLE ';
|
||||
|
||||
let sql = `${alter}${this.tableName()} ${prefix}`;
|
||||
if (columns.sql.length > 1) {
|
||||
sql += `(${columnSql.join(', ')})`;
|
||||
} else {
|
||||
sql += columnSql.join(', ');
|
||||
}
|
||||
|
||||
this.pushQuery({
|
||||
sql,
|
||||
bindings: columns.bindings,
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
// Compile a rename column command.
|
||||
renameColumn(from, to) {
|
||||
// Remove quotes around tableName
|
||||
const tableName = this.tableName().slice(1, -1);
|
||||
return this.pushQuery(
|
||||
Trigger.renameColumnTrigger(this.client.logger, tableName, from, to)
|
||||
);
|
||||
},
|
||||
|
||||
compileAdd(builder) {
|
||||
const table = this.formatter.wrap(builder);
|
||||
const columns = this.prefixArray('add column', this.getColumns(builder));
|
||||
return this.pushQuery({
|
||||
sql: `alter table ${table} ${columns.join(', ')}`,
|
||||
});
|
||||
},
|
||||
|
||||
// Adds the "create" query to the query sequence.
|
||||
createQuery(columns, ifNot) {
|
||||
const sql = `create table ${this.tableName()} (${columns.sql.join(', ')})`;
|
||||
this.pushQuery({
|
||||
// catch "name is already used by an existing object" for workaround for "if not exists"
|
||||
sql: ifNot ? utils.wrapSqlWithCatch(sql, -955) : sql,
|
||||
bindings: columns.bindings,
|
||||
});
|
||||
if (this.single.comment) this.comment(this.single.comment);
|
||||
},
|
||||
|
||||
// Compiles the comment on the table.
|
||||
comment(comment) {
|
||||
this.pushQuery(`comment on table ${this.tableName()} is '${comment}'`);
|
||||
},
|
||||
|
||||
addColumnsPrefix: 'add ',
|
||||
|
||||
alterColumnsPrefix: 'modify ',
|
||||
|
||||
dropColumn() {
|
||||
const columns = helpers.normalizeArr.apply(null, arguments);
|
||||
this.pushQuery(
|
||||
`alter table ${this.tableName()} drop (${this.formatter.columnize(
|
||||
columns
|
||||
)})`
|
||||
);
|
||||
},
|
||||
|
||||
changeType() {
|
||||
// alter table + table + ' modify ' + wrapped + '// type';
|
||||
},
|
||||
|
||||
_indexCommand(type, tableName, columns) {
|
||||
return this.formatter.wrap(
|
||||
utils.generateCombinedName(this.client.logger, type, tableName, columns)
|
||||
);
|
||||
},
|
||||
|
||||
primary(columns, constraintName) {
|
||||
constraintName = constraintName
|
||||
? this.formatter.wrap(constraintName)
|
||||
: this.formatter.wrap(`${this.tableNameRaw}_pkey`);
|
||||
this.pushQuery(
|
||||
`alter table ${this.tableName()} add constraint ${constraintName} primary key (${this.formatter.columnize(
|
||||
columns
|
||||
)})`
|
||||
);
|
||||
},
|
||||
|
||||
dropPrimary(constraintName) {
|
||||
constraintName = constraintName
|
||||
? this.formatter.wrap(constraintName)
|
||||
: this.formatter.wrap(this.tableNameRaw + '_pkey');
|
||||
this.pushQuery(
|
||||
`alter table ${this.tableName()} drop constraint ${constraintName}`
|
||||
);
|
||||
},
|
||||
|
||||
index(columns, indexName) {
|
||||
indexName = indexName
|
||||
? this.formatter.wrap(indexName)
|
||||
: this._indexCommand('index', this.tableNameRaw, columns);
|
||||
this.pushQuery(
|
||||
`create index ${indexName} on ${this.tableName()}` +
|
||||
' (' +
|
||||
this.formatter.columnize(columns) +
|
||||
')'
|
||||
);
|
||||
},
|
||||
|
||||
dropIndex(columns, indexName) {
|
||||
indexName = indexName
|
||||
? this.formatter.wrap(indexName)
|
||||
: this._indexCommand('index', this.tableNameRaw, columns);
|
||||
this.pushQuery(`drop index ${indexName}`);
|
||||
},
|
||||
|
||||
unique(columns, indexName) {
|
||||
indexName = indexName
|
||||
? this.formatter.wrap(indexName)
|
||||
: this._indexCommand('unique', this.tableNameRaw, columns);
|
||||
this.pushQuery(
|
||||
`alter table ${this.tableName()} add constraint ${indexName}` +
|
||||
' unique (' +
|
||||
this.formatter.columnize(columns) +
|
||||
')'
|
||||
);
|
||||
},
|
||||
|
||||
dropUnique(columns, indexName) {
|
||||
indexName = indexName
|
||||
? this.formatter.wrap(indexName)
|
||||
: this._indexCommand('unique', this.tableNameRaw, columns);
|
||||
this.pushQuery(
|
||||
`alter table ${this.tableName()} drop constraint ${indexName}`
|
||||
);
|
||||
},
|
||||
|
||||
dropForeign(columns, indexName) {
|
||||
indexName = indexName
|
||||
? this.formatter.wrap(indexName)
|
||||
: this._indexCommand('foreign', this.tableNameRaw, columns);
|
||||
this.pushQuery(
|
||||
`alter table ${this.tableName()} drop constraint ${indexName}`
|
||||
);
|
||||
},
|
||||
});
|
||||
|
||||
module.exports = TableCompiler_Oracle;
|
||||
126
node_modules/knex/lib/dialects/oracle/schema/trigger.js
generated
vendored
Normal file
126
node_modules/knex/lib/dialects/oracle/schema/trigger.js
generated
vendored
Normal file
@@ -0,0 +1,126 @@
|
||||
const utils = require('../utils');
|
||||
|
||||
const trigger = {
|
||||
renameColumnTrigger: function(logger, tableName, columnName, to) {
|
||||
const triggerName = utils.generateCombinedName(
|
||||
logger,
|
||||
'autoinc_trg',
|
||||
tableName
|
||||
);
|
||||
const sequenceName = utils.generateCombinedName(logger, 'seq', tableName);
|
||||
return (
|
||||
`DECLARE ` +
|
||||
`PK_NAME VARCHAR(200); ` +
|
||||
`IS_AUTOINC NUMBER := 0; ` +
|
||||
`BEGIN` +
|
||||
` EXECUTE IMMEDIATE ('ALTER TABLE "${tableName}" RENAME COLUMN "${columnName}" TO "${to}"');` +
|
||||
` SELECT COUNT(*) INTO IS_AUTOINC from "USER_TRIGGERS" where trigger_name = '${triggerName}';` +
|
||||
` IF (IS_AUTOINC > 0) THEN` +
|
||||
` SELECT cols.column_name INTO PK_NAME` +
|
||||
` FROM all_constraints cons, all_cons_columns cols` +
|
||||
` WHERE cons.constraint_type = 'P'` +
|
||||
` AND cons.constraint_name = cols.constraint_name` +
|
||||
` AND cons.owner = cols.owner` +
|
||||
` AND cols.table_name = '${tableName}';` +
|
||||
` IF ('${to}' = PK_NAME) THEN` +
|
||||
` EXECUTE IMMEDIATE ('DROP TRIGGER "${triggerName}"');` +
|
||||
` EXECUTE IMMEDIATE ('create or replace trigger "${triggerName}"` +
|
||||
` BEFORE INSERT on "${tableName}" for each row` +
|
||||
` declare` +
|
||||
` checking number := 1;` +
|
||||
` begin` +
|
||||
` if (:new."${to}" is null) then` +
|
||||
` while checking >= 1 loop` +
|
||||
` select "${sequenceName}".nextval into :new."${to}" from dual;` +
|
||||
` select count("${to}") into checking from "${tableName}"` +
|
||||
` where "${to}" = :new."${to}";` +
|
||||
` end loop;` +
|
||||
` end if;` +
|
||||
` end;');` +
|
||||
` end if;` +
|
||||
` end if;` +
|
||||
`END;`
|
||||
);
|
||||
},
|
||||
|
||||
createAutoIncrementTrigger: function(logger, tableName) {
|
||||
const triggerName = utils.generateCombinedName(
|
||||
logger,
|
||||
'autoinc_trg',
|
||||
tableName
|
||||
);
|
||||
const sequenceName = utils.generateCombinedName(logger, 'seq', tableName);
|
||||
return (
|
||||
`DECLARE ` +
|
||||
`PK_NAME VARCHAR(200); ` +
|
||||
`BEGIN` +
|
||||
` EXECUTE IMMEDIATE ('CREATE SEQUENCE "${sequenceName}"');` +
|
||||
` SELECT cols.column_name INTO PK_NAME` +
|
||||
` FROM all_constraints cons, all_cons_columns cols` +
|
||||
` WHERE cons.constraint_type = 'P'` +
|
||||
` AND cons.constraint_name = cols.constraint_name` +
|
||||
` AND cons.owner = cols.owner` +
|
||||
` AND cols.table_name = '${tableName}';` +
|
||||
` execute immediate ('create or replace trigger "${triggerName}"` +
|
||||
` BEFORE INSERT on "${tableName}"` +
|
||||
` for each row` +
|
||||
` declare` +
|
||||
` checking number := 1;` +
|
||||
` begin` +
|
||||
` if (:new."' || PK_NAME || '" is null) then` +
|
||||
` while checking >= 1 loop` +
|
||||
` select "${sequenceName}".nextval into :new."' || PK_NAME || '" from dual;` +
|
||||
` select count("' || PK_NAME || '") into checking from "${tableName}"` +
|
||||
` where "' || PK_NAME || '" = :new."' || PK_NAME || '";` +
|
||||
` end loop;` +
|
||||
` end if;` +
|
||||
` end;'); ` +
|
||||
`END;`
|
||||
);
|
||||
},
|
||||
|
||||
renameTableAndAutoIncrementTrigger: function(logger, tableName, to) {
|
||||
const triggerName = utils.generateCombinedName(
|
||||
logger,
|
||||
'autoinc_trg',
|
||||
tableName
|
||||
);
|
||||
const sequenceName = utils.generateCombinedName(logger, 'seq', tableName);
|
||||
const toTriggerName = utils.generateCombinedName(logger, 'autoinc_trg', to);
|
||||
const toSequenceName = utils.generateCombinedName(logger, 'seq', to);
|
||||
return (
|
||||
`DECLARE ` +
|
||||
`PK_NAME VARCHAR(200); ` +
|
||||
`IS_AUTOINC NUMBER := 0; ` +
|
||||
`BEGIN` +
|
||||
` EXECUTE IMMEDIATE ('RENAME "${tableName}" TO "${to}"');` +
|
||||
` SELECT COUNT(*) INTO IS_AUTOINC from "USER_TRIGGERS" where trigger_name = '${triggerName}';` +
|
||||
` IF (IS_AUTOINC > 0) THEN` +
|
||||
` EXECUTE IMMEDIATE ('DROP TRIGGER "${triggerName}"');` +
|
||||
` EXECUTE IMMEDIATE ('RENAME "${sequenceName}" TO "${toSequenceName}"');` +
|
||||
` SELECT cols.column_name INTO PK_NAME` +
|
||||
` FROM all_constraints cons, all_cons_columns cols` +
|
||||
` WHERE cons.constraint_type = 'P'` +
|
||||
` AND cons.constraint_name = cols.constraint_name` +
|
||||
` AND cons.owner = cols.owner` +
|
||||
` AND cols.table_name = '${to}';` +
|
||||
` EXECUTE IMMEDIATE ('create or replace trigger "${toTriggerName}"` +
|
||||
` BEFORE INSERT on "${to}" for each row` +
|
||||
` declare` +
|
||||
` checking number := 1;` +
|
||||
` begin` +
|
||||
` if (:new."' || PK_NAME || '" is null) then` +
|
||||
` while checking >= 1 loop` +
|
||||
` select "${toSequenceName}".nextval into :new."' || PK_NAME || '" from dual;` +
|
||||
` select count("' || PK_NAME || '") into checking from "${to}"` +
|
||||
` where "' || PK_NAME || '" = :new."' || PK_NAME || '";` +
|
||||
` end loop;` +
|
||||
` end if;` +
|
||||
` end;');` +
|
||||
` end if;` +
|
||||
`END;`
|
||||
);
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = trigger;
|
||||
77
node_modules/knex/lib/dialects/oracle/transaction.js
generated
vendored
Normal file
77
node_modules/knex/lib/dialects/oracle/transaction.js
generated
vendored
Normal file
@@ -0,0 +1,77 @@
|
||||
const Bluebird = require('bluebird');
|
||||
const Transaction = require('../../transaction');
|
||||
const { isUndefined } = require('lodash');
|
||||
const debugTx = require('debug')('knex:tx');
|
||||
|
||||
module.exports = class Oracle_Transaction extends Transaction {
|
||||
// disable autocommit to allow correct behavior (default is true)
|
||||
begin() {
|
||||
return Bluebird.resolve();
|
||||
}
|
||||
|
||||
commit(conn, value) {
|
||||
this._completed = true;
|
||||
return conn
|
||||
.commitAsync()
|
||||
.then(() => value)
|
||||
.then(this._resolver, this._rejecter);
|
||||
}
|
||||
|
||||
release(conn, value) {
|
||||
return this._resolver(value);
|
||||
}
|
||||
|
||||
rollback(conn, err) {
|
||||
this._completed = true;
|
||||
debugTx('%s: rolling back', this.txid);
|
||||
return conn
|
||||
.rollbackAsync()
|
||||
.throw(err)
|
||||
.catch((error) => {
|
||||
if (isUndefined(error)) {
|
||||
if (this.doNotRejectOnRollback) {
|
||||
this._resolver();
|
||||
return;
|
||||
}
|
||||
error = new Error(`Transaction rejected with non-error: ${error}`);
|
||||
}
|
||||
|
||||
return this._rejecter(error);
|
||||
});
|
||||
}
|
||||
|
||||
acquireConnection(config, cb) {
|
||||
const configConnection = config && config.connection;
|
||||
return new Bluebird((resolve, reject) => {
|
||||
try {
|
||||
resolve(configConnection || this.client.acquireConnection());
|
||||
} catch (e) {
|
||||
reject(e);
|
||||
}
|
||||
})
|
||||
.then((connection) => {
|
||||
connection.__knexTxId = this.txid;
|
||||
|
||||
return connection;
|
||||
})
|
||||
.then((connection) => {
|
||||
if (!this.outerTx) {
|
||||
connection.setAutoCommit(false);
|
||||
}
|
||||
return connection;
|
||||
})
|
||||
.then(async (connection) => {
|
||||
try {
|
||||
return await cb(connection);
|
||||
} finally {
|
||||
debugTx('%s: releasing connection', this.txid);
|
||||
connection.setAutoCommit(true);
|
||||
if (!configConnection) {
|
||||
this.client.releaseConnection(connection);
|
||||
} else {
|
||||
debugTx('%s: not releasing external connection', this.txid);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
86
node_modules/knex/lib/dialects/oracle/utils.js
generated
vendored
Normal file
86
node_modules/knex/lib/dialects/oracle/utils.js
generated
vendored
Normal file
@@ -0,0 +1,86 @@
|
||||
function generateCombinedName(logger, postfix, name, subNames) {
|
||||
const crypto = require('crypto');
|
||||
const limit = 30;
|
||||
if (!Array.isArray(subNames)) subNames = subNames ? [subNames] : [];
|
||||
const table = name.replace(/\.|-/g, '_');
|
||||
const subNamesPart = subNames.join('_');
|
||||
let result = `${table}_${
|
||||
subNamesPart.length ? subNamesPart + '_' : ''
|
||||
}${postfix}`.toLowerCase();
|
||||
if (result.length > limit) {
|
||||
logger.warn(
|
||||
`Automatically generated name "${result}" exceeds ${limit} character ` +
|
||||
`limit for Oracle. Using base64 encoded sha1 of that name instead.`
|
||||
);
|
||||
// generates the sha1 of the name and encode it with base64
|
||||
result = crypto
|
||||
.createHash('sha1')
|
||||
.update(result)
|
||||
.digest('base64')
|
||||
.replace('=', '');
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
function wrapSqlWithCatch(sql, errorNumberToCatch) {
|
||||
return (
|
||||
`begin execute immediate '${sql.replace(/'/g, "''")}'; ` +
|
||||
`exception when others then if sqlcode != ${errorNumberToCatch} then raise; ` +
|
||||
`end if; ` +
|
||||
`end;`
|
||||
);
|
||||
}
|
||||
|
||||
function ReturningHelper(columnName) {
|
||||
this.columnName = columnName;
|
||||
}
|
||||
|
||||
ReturningHelper.prototype.toString = function() {
|
||||
return `[object ReturningHelper:${this.columnName}]`;
|
||||
};
|
||||
|
||||
// If the error is any of these, we'll assume we need to
|
||||
// mark the connection as failed
|
||||
function isConnectionError(err) {
|
||||
return [
|
||||
'ORA-03114', // not connected to ORACLE
|
||||
'ORA-03113', // end-of-file on communication channel
|
||||
'ORA-03135', // connection lost contact
|
||||
'ORA-12514', // listener does not currently know of service requested in connect descriptor
|
||||
'ORA-00022', // invalid session ID; access denied
|
||||
'ORA-00028', // your session has been killed
|
||||
'ORA-00031', // your session has been marked for kill
|
||||
'ORA-00045', // your session has been terminated with no replay
|
||||
'ORA-00378', // buffer pools cannot be created as specified
|
||||
'ORA-00602', // internal programming exception
|
||||
'ORA-00603', // ORACLE server session terminated by fatal error
|
||||
'ORA-00609', // could not attach to incoming connection
|
||||
'ORA-01012', // not logged on
|
||||
'ORA-01041', // internal error. hostdef extension doesn't exist
|
||||
'ORA-01043', // user side memory corruption
|
||||
'ORA-01089', // immediate shutdown or close in progress
|
||||
'ORA-01092', // ORACLE instance terminated. Disconnection forced
|
||||
'ORA-02396', // exceeded maximum idle time, please connect again
|
||||
'ORA-03122', // attempt to close ORACLE-side window on user side
|
||||
'ORA-12153', // TNS'not connected
|
||||
'ORA-12537', // TNS'connection closed
|
||||
'ORA-12547', // TNS'lost contact
|
||||
'ORA-12570', // TNS'packet reader failure
|
||||
'ORA-12583', // TNS'no reader
|
||||
'ORA-27146', // post/wait initialization failed
|
||||
'ORA-28511', // lost RPC connection
|
||||
'ORA-56600', // an illegal OCI function call was issued
|
||||
'NJS-040',
|
||||
'NJS-024',
|
||||
'NJS-003',
|
||||
].some(function(prefix) {
|
||||
return err.message.indexOf(prefix) === 0;
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
generateCombinedName,
|
||||
isConnectionError,
|
||||
wrapSqlWithCatch,
|
||||
ReturningHelper,
|
||||
};
|
||||
Reference in New Issue
Block a user