You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The goal of db.exec() is to be an easy-to-use function for executing large SQL scripts, typically stored in files (for example, database migrations). In such cases, the query results are generally not needed.
There are many problems with adding query results to db.exec(). For one, since there can be multiple statements, it's not easy to know which results are actually desired. Second, there are different types of results a user might be interested in (for example, prepared statements have four different methods, each for getting different types of results: run, get, all, and iterate), plus various methods for deciding the output format (pluck, expand, raw).
Because of these complications, the API for db.exec() would need to be quite complicated to support all use-cases. For this reason, it's purposefully dumb, and users are encouraged to use prepared statements for most tasks.
Perhaps there could be a function like db.parse(), which could take a multi-statement SQL string and return an array of prepared statement objects. That way, the user would still have complete control over how each statement gets executed, and which results they are interested in.
some time,we need run multiline sql and get the execute result,but now the api "exec" return no execute result
The text was updated successfully, but these errors were encountered: