aboutsummaryrefslogtreecommitdiff
path: root/updater/sql/win/lib
diff options
context:
space:
mode:
authorRaindropsSys <raindrops@equestria.dev>2024-06-16 12:02:05 +0200
committerRaindropsSys <raindrops@equestria.dev>2024-06-16 12:02:05 +0200
commit55c7ee618e5d59ac5eb691febb6dd911f3f75d2a (patch)
tree310ff9cc2178a5f3a35aaa5ea8f1352114018f53 /updater/sql/win/lib
parente44e2fe070484e06d384a31ef2699c3a2d5d474e (diff)
downloadfaunerie-55c7ee618e5d59ac5eb691febb6dd911f3f75d2a.tar.gz
faunerie-55c7ee618e5d59ac5eb691febb6dd911f3f75d2a.tar.bz2
faunerie-55c7ee618e5d59ac5eb691febb6dd911f3f75d2a.zip
Fix SQL stuff + remove C++ code
Diffstat (limited to 'updater/sql/win/lib')
-rwxr-xr-xupdater/sql/win/lib/sqlite3-binding.js1
-rwxr-xr-xupdater/sql/win/lib/sqlite3.d.ts205
-rwxr-xr-xupdater/sql/win/lib/sqlite3.js207
-rwxr-xr-xupdater/sql/win/lib/trace.js38
4 files changed, 0 insertions, 451 deletions
diff --git a/updater/sql/win/lib/sqlite3-binding.js b/updater/sql/win/lib/sqlite3-binding.js
deleted file mode 100755
index 98d1b91..0000000
--- a/updater/sql/win/lib/sqlite3-binding.js
+++ /dev/null
@@ -1 +0,0 @@
-module.exports = require('bindings')('node_sqlite3.node');
diff --git a/updater/sql/win/lib/sqlite3.d.ts b/updater/sql/win/lib/sqlite3.d.ts
deleted file mode 100755
index 15e6623..0000000
--- a/updater/sql/win/lib/sqlite3.d.ts
+++ /dev/null
@@ -1,205 +0,0 @@
-// Type definitions for sqlite3
-// Project: http://github.com/tryghost/node-sqlite3
-
-/// <reference types="node" />
-
-import events = require("events");
-
-export const OPEN_READONLY: number;
-export const OPEN_READWRITE: number;
-export const OPEN_CREATE: number;
-export const OPEN_FULLMUTEX: number;
-export const OPEN_SHAREDCACHE: number;
-export const OPEN_PRIVATECACHE: number;
-export const OPEN_URI: number;
-
-export const VERSION: string;
-export const SOURCE_ID: string;
-export const VERSION_NUMBER: number;
-
-export const OK: number;
-export const ERROR: number;
-export const INTERNAL: number;
-export const PERM: number;
-export const ABORT: number;
-export const BUSY: number;
-export const LOCKED: number;
-export const NOMEM: number;
-export const READONLY: number;
-export const INTERRUPT: number
-export const IOERR: number;
-export const CORRUPT: number
-export const NOTFOUND: number;
-export const FULL: number;
-export const CANTOPEN: number;
-export const PROTOCOL: number;
-export const EMPTY: number;
-export const SCHEMA: number;
-export const TOOBIG: number
-export const CONSTRAINT: number
-export const MISMATCH: number;
-export const MISUSE: number;
-export const NOLFS: number;
-export const AUTH: number
-export const FORMAT: number;
-export const RANGE: number
-export const NOTADB: number;
-
-export const LIMIT_LENGTH: number;
-export const LIMIT_SQL_LENGTH: number;
-export const LIMIT_COLUMN: number;
-export const LIMIT_EXPR_DEPTH: number;
-export const LIMIT_COMPOUND_SELECT: number;
-export const LIMIT_VDBE_OP: number;
-export const LIMIT_FUNCTION_ARG: number;
-export const LIMIT_ATTACHED: number;
-export const LIMIT_LIKE_PATTERN_LENGTH: number;
-export const LIMIT_VARIABLE_NUMBER: number;
-export const LIMIT_TRIGGER_DEPTH: number;
-export const LIMIT_WORKER_THREADS: number;
-
-export const cached: {
- Database(filename: string, callback?: (this: Database, err: Error | null) => void): Database;
- Database(filename: string, mode?: number, callback?: (this: Database, err: Error | null) => void): Database;
-};
-
-export interface RunResult extends Statement {
- lastID: number;
- changes: number;
-}
-
-export class Statement extends events.EventEmitter {
- bind(callback?: (err: Error | null) => void): this;
- bind(...params: any[]): this;
-
- reset(callback?: (err: null) => void): this;
-
- finalize(callback?: (err: Error) => void): Database;
-
- run(callback?: (err: Error | null) => void): this;
- run(params: any, callback?: (this: RunResult, err: Error | null) => void): this;
- run(...params: any[]): this;
-
- get<T>(callback?: (err: Error | null, row?: T) => void): this;
- get<T>(params: any, callback?: (this: RunResult, err: Error | null, row?: T) => void): this;
- get(...params: any[]): this;
-
- all<T>(callback?: (err: Error | null, rows: T[]) => void): this;
- all<T>(params: any, callback?: (this: RunResult, err: Error | null, rows: T[]) => void): this;
- all(...params: any[]): this;
-
- each<T>(callback?: (err: Error | null, row: T) => void, complete?: (err: Error | null, count: number) => void): this;
- each<T>(params: any, callback?: (this: RunResult, err: Error | null, row: T) => void, complete?: (err: Error | null, count: number) => void): this;
- each(...params: any[]): this;
-}
-
-export class Database extends events.EventEmitter {
- constructor(filename: string, callback?: (err: Error | null) => void);
- constructor(filename: string, mode?: number, callback?: (err: Error | null) => void);
-
- close(callback?: (err: Error | null) => void): void;
-
- run(sql: string, callback?: (this: RunResult, err: Error | null) => void): this;
- run(sql: string, params: any, callback?: (this: RunResult, err: Error | null) => void): this;
- run(sql: string, ...params: any[]): this;
-
- get<T>(sql: string, callback?: (this: Statement, err: Error | null, row: T) => void): this;
- get<T>(sql: string, params: any, callback?: (this: Statement, err: Error | null, row: T) => void): this;
- get(sql: string, ...params: any[]): this;
-
- all<T>(sql: string, callback?: (this: Statement, err: Error | null, rows: T[]) => void): this;
- all<T>(sql: string, params: any, callback?: (this: Statement, err: Error | null, rows: T[]) => void): this;
- all(sql: string, ...params: any[]): this;
-
- each<T>(sql: string, callback?: (this: Statement, err: Error | null, row: T) => void, complete?: (err: Error | null, count: number) => void): this;
- each<T>(sql: string, params: any, callback?: (this: Statement, err: Error | null, row: T) => void, complete?: (err: Error | null, count: number) => void): this;
- each(sql: string, ...params: any[]): this;
-
- exec(sql: string, callback?: (this: Statement, err: Error | null) => void): this;
-
- prepare(sql: string, callback?: (this: Statement, err: Error | null) => void): Statement;
- prepare(sql: string, params: any, callback?: (this: Statement, err: Error | null) => void): Statement;
- prepare(sql: string, ...params: any[]): Statement;
-
- serialize(callback?: () => void): void;
- parallelize(callback?: () => void): void;
-
- on(event: "trace", listener: (sql: string) => void): this;
- on(event: "profile", listener: (sql: string, time: number) => void): this;
- on(event: "change", listener: (type: string, database: string, table: string, rowid: number) => void): this;
- on(event: "error", listener: (err: Error) => void): this;
- on(event: "open" | "close", listener: () => void): this;
- on(event: string, listener: (...args: any[]) => void): this;
-
- configure(option: "busyTimeout", value: number): void;
- configure(option: "limit", id: number, value: number): void;
-
- loadExtension(filename: string, callback?: (err: Error | null) => void): this;
-
- wait(callback?: (param: null) => void): this;
-
- interrupt(): void;
-}
-
-export function verbose(): sqlite3;
-
-export interface sqlite3 {
- OPEN_READONLY: number;
- OPEN_READWRITE: number;
- OPEN_CREATE: number;
- OPEN_FULLMUTEX: number;
- OPEN_SHAREDCACHE: number;
- OPEN_PRIVATECACHE: number;
- OPEN_URI: number;
-
- VERSION: string;
- SOURCE_ID: string;
- VERSION_NUMBER: number;
-
- OK: number;
- ERROR: number;
- INTERNAL: number;
- PERM: number;
- ABORT: number;
- BUSY: number;
- LOCKED: number;
- NOMEM: number;
- READONLY: number;
- INTERRUPT: number
- IOERR: number;
- CORRUPT: number
- NOTFOUND: number;
- FULL: number;
- CANTOPEN: number;
- PROTOCOL: number;
- EMPTY: number;
- SCHEMA: number;
- TOOBIG: number
- CONSTRAINT: number
- MISMATCH: number;
- MISUSE: number;
- NOLFS: number;
- AUTH: number
- FORMAT: number;
- RANGE: number
- NOTADB: number;
-
- LIMIT_LENGTH: number;
- LIMIT_SQL_LENGTH: number;
- LIMIT_COLUMN: number;
- LIMIT_EXPR_DEPTH: number;
- LIMIT_COMPOUND_SELECT: number;
- LIMIT_VDBE_OP: number;
- LIMIT_FUNCTION_ARG: number;
- LIMIT_ATTACHED: number;
- LIMIT_LIKE_PATTERN_LENGTH: number;
- LIMIT_VARIABLE_NUMBER: number;
- LIMIT_TRIGGER_DEPTH: number;
- LIMIT_WORKER_THREADS: number;
-
- cached: typeof cached;
- RunResult: RunResult;
- Statement: typeof Statement;
- Database: typeof Database;
- verbose(): this;
-} \ No newline at end of file
diff --git a/updater/sql/win/lib/sqlite3.js b/updater/sql/win/lib/sqlite3.js
deleted file mode 100755
index 430a2b8..0000000
--- a/updater/sql/win/lib/sqlite3.js
+++ /dev/null
@@ -1,207 +0,0 @@
-const path = require('path');
-const sqlite3 = require('./sqlite3-binding.js');
-const EventEmitter = require('events').EventEmitter;
-module.exports = exports = sqlite3;
-
-function normalizeMethod (fn) {
- return function (sql) {
- let errBack;
- const args = Array.prototype.slice.call(arguments, 1);
-
- if (typeof args[args.length - 1] === 'function') {
- const callback = args[args.length - 1];
- errBack = function(err) {
- if (err) {
- callback(err);
- }
- };
- }
- const statement = new Statement(this, sql, errBack);
- return fn.call(this, statement, args);
- };
-}
-
-function inherits(target, source) {
- for (const k in source.prototype)
- target.prototype[k] = source.prototype[k];
-}
-
-sqlite3.cached = {
- Database: function(file, a, b) {
- if (file === '' || file === ':memory:') {
- // Don't cache special databases.
- return new Database(file, a, b);
- }
-
- let db;
- file = path.resolve(file);
-
- if (!sqlite3.cached.objects[file]) {
- db = sqlite3.cached.objects[file] = new Database(file, a, b);
- }
- else {
- // Make sure the callback is called.
- db = sqlite3.cached.objects[file];
- const callback = (typeof a === 'number') ? b : a;
- if (typeof callback === 'function') {
- function cb() { callback.call(db, null); }
- if (db.open) process.nextTick(cb);
- else db.once('open', cb);
- }
- }
-
- return db;
- },
- objects: {}
-};
-
-
-const Database = sqlite3.Database;
-const Statement = sqlite3.Statement;
-const Backup = sqlite3.Backup;
-
-inherits(Database, EventEmitter);
-inherits(Statement, EventEmitter);
-inherits(Backup, EventEmitter);
-
-// Database#prepare(sql, [bind1, bind2, ...], [callback])
-Database.prototype.prepare = normalizeMethod(function(statement, params) {
- return params.length
- ? statement.bind.apply(statement, params)
- : statement;
-});
-
-// Database#run(sql, [bind1, bind2, ...], [callback])
-Database.prototype.run = normalizeMethod(function(statement, params) {
- statement.run.apply(statement, params).finalize();
- return this;
-});
-
-// Database#get(sql, [bind1, bind2, ...], [callback])
-Database.prototype.get = normalizeMethod(function(statement, params) {
- statement.get.apply(statement, params).finalize();
- return this;
-});
-
-// Database#all(sql, [bind1, bind2, ...], [callback])
-Database.prototype.all = normalizeMethod(function(statement, params) {
- statement.all.apply(statement, params).finalize();
- return this;
-});
-
-// Database#each(sql, [bind1, bind2, ...], [callback], [complete])
-Database.prototype.each = normalizeMethod(function(statement, params) {
- statement.each.apply(statement, params).finalize();
- return this;
-});
-
-Database.prototype.map = normalizeMethod(function(statement, params) {
- statement.map.apply(statement, params).finalize();
- return this;
-});
-
-// Database#backup(filename, [callback])
-// Database#backup(filename, destName, sourceName, filenameIsDest, [callback])
-Database.prototype.backup = function() {
- let backup;
- if (arguments.length <= 2) {
- // By default, we write the main database out to the main database of the named file.
- // This is the most likely use of the backup api.
- backup = new Backup(this, arguments[0], 'main', 'main', true, arguments[1]);
- } else {
- // Otherwise, give the user full control over the sqlite3_backup_init arguments.
- backup = new Backup(this, arguments[0], arguments[1], arguments[2], arguments[3], arguments[4]);
- }
- // Per the sqlite docs, exclude the following errors as non-fatal by default.
- backup.retryErrors = [sqlite3.BUSY, sqlite3.LOCKED];
- return backup;
-};
-
-Statement.prototype.map = function() {
- const params = Array.prototype.slice.call(arguments);
- const callback = params.pop();
- params.push(function(err, rows) {
- if (err) return callback(err);
- const result = {};
- if (rows.length) {
- const keys = Object.keys(rows[0]);
- const key = keys[0];
- if (keys.length > 2) {
- // Value is an object
- for (let i = 0; i < rows.length; i++) {
- result[rows[i][key]] = rows[i];
- }
- } else {
- const value = keys[1];
- // Value is a plain value
- for (let i = 0; i < rows.length; i++) {
- result[rows[i][key]] = rows[i][value];
- }
- }
- }
- callback(err, result);
- });
- return this.all.apply(this, params);
-};
-
-let isVerbose = false;
-
-const supportedEvents = [ 'trace', 'profile', 'change' ];
-
-Database.prototype.addListener = Database.prototype.on = function(type) {
- const val = EventEmitter.prototype.addListener.apply(this, arguments);
- if (supportedEvents.indexOf(type) >= 0) {
- this.configure(type, true);
- }
- return val;
-};
-
-Database.prototype.removeListener = function(type) {
- const val = EventEmitter.prototype.removeListener.apply(this, arguments);
- if (supportedEvents.indexOf(type) >= 0 && !this._events[type]) {
- this.configure(type, false);
- }
- return val;
-};
-
-Database.prototype.removeAllListeners = function(type) {
- const val = EventEmitter.prototype.removeAllListeners.apply(this, arguments);
- if (supportedEvents.indexOf(type) >= 0) {
- this.configure(type, false);
- }
- return val;
-};
-
-// Save the stack trace over EIO callbacks.
-sqlite3.verbose = function() {
- if (!isVerbose) {
- const trace = require('./trace');
- [
- 'prepare',
- 'get',
- 'run',
- 'all',
- 'each',
- 'map',
- 'close',
- 'exec'
- ].forEach(function (name) {
- trace.extendTrace(Database.prototype, name);
- });
- [
- 'bind',
- 'get',
- 'run',
- 'all',
- 'each',
- 'map',
- 'reset',
- 'finalize',
- ].forEach(function (name) {
- trace.extendTrace(Statement.prototype, name);
- });
- isVerbose = true;
- }
-
- return sqlite3;
-};
diff --git a/updater/sql/win/lib/trace.js b/updater/sql/win/lib/trace.js
deleted file mode 100755
index 1d84cb0..0000000
--- a/updater/sql/win/lib/trace.js
+++ /dev/null
@@ -1,38 +0,0 @@
-// Inspired by https://github.com/tlrobinson/long-stack-traces
-const util = require('util');
-
-function extendTrace(object, property, pos) {
- const old = object[property];
- object[property] = function() {
- const error = new Error();
- const name = object.constructor.name + '#' + property + '(' +
- Array.prototype.slice.call(arguments).map(function(el) {
- return util.inspect(el, false, 0);
- }).join(', ') + ')';
-
- if (typeof pos === 'undefined') pos = -1;
- if (pos < 0) pos += arguments.length;
- const cb = arguments[pos];
- if (typeof arguments[pos] === 'function') {
- arguments[pos] = function replacement() {
- const err = arguments[0];
- if (err && err.stack && !err.__augmented) {
- err.stack = filter(err).join('\n');
- err.stack += '\n--> in ' + name;
- err.stack += '\n' + filter(error).slice(1).join('\n');
- err.__augmented = true;
- }
- return cb.apply(this, arguments);
- };
- }
- return old.apply(this, arguments);
- };
-}
-exports.extendTrace = extendTrace;
-
-
-function filter(error) {
- return error.stack.split('\n').filter(function(line) {
- return line.indexOf(__filename) < 0;
- });
-}