diff --git a/app/lib/dal/drivers/SQLiteDriver.ts b/app/lib/dal/drivers/SQLiteDriver.ts index b7e52b00eb19aa3fc20a6f95f14ea02b1271cda6..c0ce0cba05c0f77167a91633af840d5ce737146d 100644 --- a/app/lib/dal/drivers/SQLiteDriver.ts +++ b/app/lib/dal/drivers/SQLiteDriver.ts @@ -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' diff --git a/app/lib/other_constants.ts b/app/lib/other_constants.ts index 203afe23d6bcac3053657be600b52b927e58431c..63162b599a680e000c9798f7b6f6397c4d6c25ae 100644 --- a/app/lib/other_constants.ts +++ b/app/lib/other_constants.ts @@ -14,6 +14,7 @@ export const OtherConstants = { MUTE_LOGS_DURING_UNIT_TESTS: true, + SQL_TRACES: false, BC_EVENT: { SWITCHED: 'switched', diff --git a/index.ts b/index.ts index 646e2bf6d44eda8f96e31c50e96818629fa7f3da..d28736977909a07a2705f2bb3a96c6418f2183a6 100644 --- a/index.ts +++ b/index.ts @@ -21,8 +21,9 @@ import {CrawlerDependency} from "./app/modules/crawler/index" import {BmaDependency} from "./app/modules/bma/index" import {WS2PDependency} from "./app/modules/ws2p/index" import {ProverConstants} from "./app/modules/prover/lib/constants" -import { ProxiesConf } from './app/lib/proxy'; +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);