Questions tagged [better-sqlite3]

Better-SQLite3 is a Node.js API for SQLite3, claiming ease-of-use, improved efficiency and faster processing.

Better-SQLite3 is an API for use with Node.js, It differs from other popular SQLite3 API's in that it is synchronous rather than asynchronous.

  • It claims speed improvements of between 3 and 28 times over other similar API's.
  • Support for 64bit Integers.
  • Simplicty and efficiency.
  • Custom SQL
  • Full transaction Support.

The SQLite compilation options include:-

  • Foreign Key enabled by default.
  • Larger cache size.
  • R-Tree extension added for improved Range queries.
  • Latest Full Text Search Engine (FTS5)

For more Information see better-sqlite3

109 questions
0
votes
1 answer

discord.js bot returns as undefined when trying to get SQLite value

Whenever I run the command, I get you have undefined instead of the number inputted in the SQLite database. if (command === "bal") { if (message.author.bot) return; const data = sql.prepare(`SELECT ${args} FROM ${'acc' +…
0
votes
2 answers

Get record position in SQL

I have a rank system on my Discord bot, and I am trying to display a message like ('You are rank #5') So I need to query my database, but I am not that great with SQL (I use better-sqlite3) What I have tried is evidently wrong. Can someone help me,…
Ragnar Lothbrok
  • 306
  • 1
  • 4
  • 22
0
votes
2 answers

Displaying leaderboard in embed

I am trying to create a leaderboard command for my Discord bot and having some trouble getting the data to display, my current code only displays the top user, you can see in the image there are 4 lines, this is because there are 4 entries in the…
Ragnar Lothbrok
  • 306
  • 1
  • 4
  • 22
0
votes
1 answer

discord.js better-sqlite3 addition is not actually adding the result from a previous const

if (command == "tgive") { //Get their current balance const grab = sql.prepare(`SELECT bal FROM ${args[1]}`).get(); //Grab the value from the first input after the second. Ex: eco tgive 5 Juliana const pointsToAdd =…
0
votes
2 answers

SQlite Error: Syntax error near 5 (better-sqlite3)

client.on("message", message => { const args = message.content.slice(config.prefix.length).trim().split(' '); const args2 = message.content.slice('test', ',', args).trim(args).split(' ', args); const command = args.shift().toLowerCase(); …
0
votes
0 answers

How to check if a row exists in Better Sqlite3, and if so, to return. - Discord.js : Better-Sqlite3

So the title is actually the main question, but I have two technically. First thing is, I am currently coding a discord bot for the heck of it, as well as I am using Better-Sqlite3 node module. I have the database made, and the command is kinda not…
0
votes
1 answer

discord.js better-sqlite3 command running without the command being executed

Okay, so below is my code to create a database with the balance $0, and underneath that is a test command to test out two argument so that I can get a return message of: BOT: "${args} ${args2}" However, whenever I got to test out the command with…
0
votes
2 answers

discord.js better-sqlite3 message returns as undefined

Soooo i'm trying to make an economy system, however, whenever I type the message "eco bal ${args}", which, the args is the name of the table, I get "undefined" as a result instead of "$0" which should be the balance I need to have. Here's the code.…
0
votes
0 answers

Getting Selected Integer from DB Rounding Last Two Digits

When I attempt to SELECT data from my sqlite3 database and get the value with the node.js module better-sqlite3, I run into issues where the last two digits of the integer I am getting are rounded. For example, when I get the value…
0
votes
0 answers

escaping the query in a SQLite query with bind params

I have a simple FTS5 query like source function getRes(q) { const sel = 'SELECT Count(id) AS c FROM t JOIN v ON t.id = v.id WHERE v MATCH ?'; return db.prepare(sel).get(q); } The above fails for getRes('Trematoda (awaiting allocation)')…
punkish
  • 13,598
  • 26
  • 66
  • 101
0
votes
1 answer

I've a problem for install better-sqlite3

I've create a bot of discord on discord.js. And I want use Quick.db for make a DataBase. I've install Quick.db and is succesfuly. But, when I want start my bot, I've this error message. Error: Cannot find module 'better-sqlite3' Require stack: -…
user11582821
0
votes
1 answer

Query regarding placeholder in SELECT statement in sqlit3 library

I created a table and added records to it but I want to print each record as I add more records.But the code below doesn't seem to be working for me.. Btw I input model from user.. Cursor.execute("SELECT * FROM Top_Cars WHERE…
schwifty
  • 145
  • 1
  • 12
0
votes
2 answers

Cant install better-sqlite3 discord.js

I cant install better-sqlite3 I just reinstalled windows 10 on my pc and i installed everything (git, node.js, node-gyp) and all that stuff When trying to install better-sqlite3, it shows this > better-sqlite3@5.4.0 install…
xItsDanger
  • 31
  • 1
  • 6
0
votes
0 answers

Why is querying sql_master returnining nothing on some machines?

I recently changed some code I have using SQLite via better-sqlite3 to check if a table exists before running certain import queries. The code and tests all run fine. But the tests don't pass on our build machines or on another developers machine. …
Frank Schwieterman
  • 24,142
  • 15
  • 92
  • 130
0
votes
0 answers

how to stop loading extra rows in sqlite

I have a chat system with nodejs and php, when the user clicks on a room, the chats are fetched from nodejs from a sqlite database const query = db.prepare("SELECT * FROM Chats Where chatRoom = '" + req.body.ll.toString() + "' ORDER BY `timee` DESC…
weegee
  • 3,256
  • 2
  • 18
  • 32