The execute() method returns an error if the query returns rows, which makes it unsuitable for running any type of SQL queries. Similarly, the query() method only works on SQL statements that return rows. Therefore, the run() method is provided to execute any type of SQL statement.
This is needed, for example, for the libSQL JavaScript library that needs to preserve better-sqlite3 semantics.
The
execute()
method returns an error if the query returns rows, which makes it unsuitable for running any type of SQL queries. Similarly, thequery()
method only works on SQL statements that return rows. Therefore, therun()
method is provided to execute any type of SQL statement.This is needed, for example, for the libSQL JavaScript library that needs to preserve
better-sqlite3
semantics.