Add getIndex function

This commit is contained in:
Nikiroy78 2022-04-21 14:52:46 +03:00 committed by GitHub
parent ae105e29b2
commit 3263706d57
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,4 +1,4 @@
// const sqlite3 = require('sqlite3').verbose(); // Пошли в пизду со своим ассинхроном, ублюдки! // const sqlite3 = require('sqlite3').verbose(); // Пошли в пизду со своим асинхроном, ублюдки!
const sqlite3 = require('better-sqlite3'); const sqlite3 = require('better-sqlite3');
@ -42,6 +42,9 @@ class database {
ToString(value) { ToString(value) {
return typeof(value) === 'string' ? '\'' + value + '\'' : value; return typeof(value) === 'string' ? '\'' + value + '\'' : value;
} }
getIndex (table, indexColumn) {
return this.get(table).length;
}
execute(SQLRequest) { execute(SQLRequest) {
try { try {
return this.db.prepare(SQLRequest).all(); return this.db.prepare(SQLRequest).all();