1 year ago
#331920
Sebastián Ardila
Error: SQLITE_MISUSE: bad parameter or other API misuse when creating table
Hello I have a project in NodeJS and I am having several issues with SQL Lite, I created the connection to a DB file and it seems okay but when I try to pass a query to create a table I get an error. Here is my code
import * as queries from "./SQLstm";
var sqlite3 = require('sqlite3').verbose();
let db: any;
export async function initialize(){
try{
logger.info("Beginning connection");
db = await connectToDB();
db.serialize(function() {
//Tables
db.run(queries.parent_company);
db.close()
});
//loadData();
}
catch(e){
throw e;
}
}
async function connectToDB(){
return new Promise((resolve, reject) => {
try{
const connection = new sqlite3.Database('../db/advertisers.db', sqlite3.SQLITE_OPEN_READWRITE | sqlite3.SQLITE_OPEN_CREATE);
logger.info("Connection successful")
resolve(connection);
}
catch(e){
reject(e)
}
});
}
The query I am running is: CREATE TABLE IF NOT EXISTS __parent_company ( id INTEGER NOT NULL UNIQUE PRIMARY KEY, name TEXT NOT NULL);
node.js
sqlite
node-sqlite3
0 Answers
Your Answer