4

What's the difference between sqlite and better-sqlite3 implementations? I have to use better-sqlite3 to create a database for a form (+ only node.js and express), but the only clear example I found uses sqlite. Is there any difference? If not, thanks. Otherwise, do you know any usefull links for databases and forms with better-sqlite3? Thanks

Nathan
  • 479
  • 6
  • 13
hellomynameisA
  • 546
  • 1
  • 7
  • 28

2 Answers2

8

In better-sqlite3, you can register custom functions and aggregate functions written in JavaScript, which you can run from within SQL queries.

In better-sqlite3, you can iterate through the cursor of a result set, and then stop whenever you want (you don't have to load the entire result set into memory).

In better-sqlite3, you can conveniently receive query results in many different formats (here, here, and here).

In better-sqlite3, you can safely work with SQLite's 64-bit integers, without losing precision due to JavaScript's number format.

See https://github.com/JoshuaWise/better-sqlite3/issues/262

Prinzhorn
  • 22,120
  • 7
  • 61
  • 65
2

One important difference is: better-sqlite allows for synchronous SQLite queries. With sqlite, you can't do that.