-
Notifications
You must be signed in to change notification settings - Fork 29
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
Redis parameters #116
Comments
@FallingSnow Hi, I am looking on https://oss.redislabs.com/redisgraph/commands/#graphquery and It doesn't seem aligned with what you shared. I will try to check what should be the correct syntax and update the code accordingly. |
@FallingSnow Can you share your exact usage? |
I'm trying to escape user input in queries I submit to the database. Some libraries provide this escape function. Considering redis returns Query:
Response:
|
@FallingSnow Can you share your usage with the redis-modules-sdk? |
That is. export default class Database extends RedisGraph {
constructor(...args) {
super({ port: options.databasePort, host: options.databaseHost, ...args });
}
async query(query: string) {
try {
// Throws "Error: RedisGraph class (GRAPH.QUERY): ReplyError: Missing parameters"
return await super.query(options.databaseName, query);
} catch (error) {
log.error("Failed to run database query: \"%s\"\n%s", query, error);
throw new Error("Database error. See server logs.");
}
}
static escape(str) {
return str.replace(/'/g, "\\'");
}
}
// Doesn't work
const matches = await database.query(`MATCH (p:user) WHERE p.email=$email RETURN count(p) as count`);
// Works
const matches = await database.query(`MATCH (p:user) WHERE p.email='email@email.com' RETURN count(p) as count`); |
Are you unable to replicate the error with a query that has a $ (dollar sign) variable? |
@FallingSnow hi, yes i am able. Sorry for the delay i will be working on this and many issues this weekend and next week. |
@FallingSnow Hi, should have a fix soon, just running some last tests. |
Great! Thank you! |
Is there a way to pass parameters?
For example when I submit a query with a
$variable
is I get an error message aboutmissing parameters
.Kind of like https://redisgraph.github.io/redisgraph.js/Graph.html#query
The text was updated successfully, but these errors were encountered: