-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
SQLite React Native Error: Too many bind arguments (0 needed) #4552
Comments
From the logs it is clearly something wrong in the SQLite RxStorage. I will check. |
@jwallet This is strange. I added some tests to ensure there is no unequal params count |
@pubkey what I tried
i paid for premium but only for the react-native sqlite package, did you share code between your premium features, so by disabling one of it, it throws that error to me... I guess the access key point to a premium repo with other module resulting to noop fn. i know that on classic rxdb you did your database.prepare. but i found that issue that explain what's happening, pretty sure you already know and check those places in the sqlite storage instance WiseLibs/better-sqlite3#576, like if you use I use :
|
Please try out the latest version. I have added some dev-mode check which will help in debugging this. The sqlite storage always uses the plain |
Updated to 14.3.4 and the error is
|
So I logged which queries I send to LOG RxDB Hooks: Query mangoQuery sent @L348 ''performQuery(query)'' {
"limit": 5,
"selector": {
"operators": {
"$elemMatch": {
"employeeId": ""
}
}
},
"sort": [
{
"departureDate": "desc"
}
]
}
L since cvara does not allow undefined query I send a These are the others mangoQuery operators that I use:
|
Hi @jwallet |
Found the root cause. This only occured when other operators in the query come before the $elemMatch. {
selector: {
list: {
$elemMatch: {
stringValue: 'five'
}
},
numberValue: {
$gt: 0
}
}
} while this is broken: {
selector: {
numberValue: {
$gt: 0
},
list: {
$elemMatch: {
stringValue: 'five'
}
}
}
} |
Please try version 14.3.6. |
I'm currently moving my queries to fit this format, "$elemMatch" always in first condition. const customSelector = { departureDateTimestamp: { $gte: new Date().getTime() } };
return collection.find({
selector: {
$and: [
{ operators: { $elemMatch: { employeeId: '1234' } } },
customSelector
],
}
}); I will leave one to try your new release |
all good it works @pubkey |
An error occurs when querying in both
expo-sqlite-storage
andreact-native-sqlite-2
usingexpo
onrxdb-premium@1.14.9
andrxdb@1.14.9
. Also, I'm usingrxdb-hooks@5.0.2
Too many bind arguments. 2 arguments were provided but the statement needs 0 arguments
the database was set like so for both lib:
The text was updated successfully, but these errors were encountered: