Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expanded Sql Function Missing/Mislabeled In Api Doc? #201

Closed
gismofx opened this issue Aug 11, 2024 · 1 comment
Closed

Expanded Sql Function Missing/Mislabeled In Api Doc? #201

gismofx opened this issue Aug 11, 2024 · 1 comment

Comments

@gismofx
Copy link

gismofx commented Aug 11, 2024

API Documentation says the sql(stmt) function will return expanded sql, but it returns the parameterized sql after applying bind_collection. Api documentation links to Expanded Sql sqlite doc.

Here's a snip of what I'm doing:

for await (const stmt of sqlite.sqlite3.statements(dbConn, sql)) {

    if (parameters != null) {
        let bindresult = await sqlite.sqlite3.bind_collection(stmt, parameters);
        if (bindresult != SQLite.SQLITE_OK) {
            console.error("unable to prepare");
            result.error = "Unable to Prepare statement. Check your syntax or parameters";
            return result;
        }
    }
    console.log("Sql: " + sqlite.sqlite3.sql(stmt)); //<- returns same sql as passed in
    //console.log("Sql: " + sqlite.sqlite3.expanded_sql(stmt)); //<- does not exist

It seems like API documentation needs to be updated and the expanded_sql function should be implemented.
(or I'm doing something wrong)
https://www.sqlite.org/c3ref/expanded_sql.html

@rhashimoto
Copy link
Owner

The convention for all the wrapped sqlite3 functions is to use the name without sqlite3_, so sql() is a wrapper for sqlite3_sql(). I think you're confused by the URL to the SQLite page, which documents other functions besides sqlite3_sql().

You're correct that a wrapper for sqlite3_expanded_sql() does not exist.

I'm moving this to a discussion because I'm not committing to providing a wrapper for sqlite3_expanded_sql() as yet.

Repository owner locked and limited conversation to collaborators Aug 11, 2024
@rhashimoto rhashimoto converted this issue into discussion #202 Aug 11, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants