Skip to content
Snippets Groups Projects
Commit 34d58f9e authored by Cédric Moreau's avatar Cédric Moreau
Browse files

[enh] Add `--sql-traces` option

parent 45278c7d
No related branches found
No related tags found
No related merge requests found
......@@ -11,6 +11,8 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
import {OtherConstants} from "../../other_constants"
const qfs = require('q-io/fs')
const sqlite3 = require("sqlite3").verbose()
......@@ -34,6 +36,11 @@ export class SQLiteDriver {
let sqlite = new sqlite3.Database(this.path)
await new Promise<any>((resolve) => sqlite.once('open', resolve))
// Database is opened
if (OtherConstants.SQL_TRACES) {
sqlite.on('trace', (trace:any) => {
this.logger.trace(trace)
})
}
// Force case sensitiveness on LIKE operator
const sql = 'PRAGMA case_sensitive_like=ON'
......
......@@ -14,6 +14,7 @@
export const OtherConstants = {
MUTE_LOGS_DURING_UNIT_TESTS: true,
SQL_TRACES: false,
BC_EVENT: {
SWITCHED: 'switched',
......
......@@ -23,6 +23,7 @@ import {WS2PDependency} from "./app/modules/ws2p/index"
import {ProverConstants} from "./app/modules/prover/lib/constants"
import {ProxiesConf} from './app/lib/proxy';
import {RouterDependency} from "./app/modules/router"
import {OtherConstants} from "./app/lib/other_constants"
const path = require('path');
const _ = require('underscore');
......@@ -288,6 +289,7 @@ class Stack {
const params = args.slice(2);
params.pop(); // Don't need the command argument
OtherConstants.SQL_TRACES = program.sqlTraces === true
const dbName = program.mdb;
const dbHome = program.home;
const home = directory.getHome(dbName, dbHome);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment