Skip to content
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

D1: Error when using data with unordered parameters #92

Open
ghostrider-05 opened this issue Dec 6, 2024 · 1 comment
Open

D1: Error when using data with unordered parameters #92

ghostrider-05 opened this issue Dec 6, 2024 · 1 comment

Comments

@ghostrider-05
Copy link

Took me a while to figure it out, but I think D1 errors when using ordered parameters in combination with unordered parameters.
I was getting errors about using the wrong amount of parameters with the following query:

await this.db.update({
    where: { conditions: 'id = ?', params: id },
    data: updatedUserAttributes,
})

Updating to use ?1 fixed this for me. It would be nice to have a warning somewhere. As unordered parameters are supported by D1, I didn't think too much about it when switching to this library.

@G4brym
Copy link
Owner

G4brym commented Dec 6, 2024

Hey @ghostrider-05 you should be able to use unordered parameters is the other methods like selects, deletes and etc.
This is only a problem in the update method, as all the updatedUserAttributes are also passed as parameters to the inner database
i will provide a fix for this in the next version, thanks for reporting

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants