-
Notifications
You must be signed in to change notification settings - Fork 27
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
Failed to excute redis_command when json filed's value include white space #3
Comments
With the debugging information,
you can see that during the call of redisCommand of hiRedis, it reported such error information.
+------------------------------------------+ in gdb, you can see that
and the redisCommand complaint that with "ERR wrong number of arguments for 'hset' command". It's illegal to pass white space between mysql SQL and hiredis. I have two suggestion for you.
|
To verify the problem, I did tests using hiredis directly. reply = redisCommand(c,"SET %s %s", "foo", "{\"topic\" : \"hello world\"}"); printf("The value has white space: %s\n", reply->str); freeReplyObject(reply); It's gonna work out fine. Unfortunately, it's failed when transfer keys and values directly, as below: reply = redisCommand(c,"SET foo {\"topic\" : \"hello world\"}"); printf("The value has white space: %s\n", reply->str); freeReplyObject(reply); |
@gettyying thank you for your work. I patched this in the latest version, let the redis_command can get 3 or 5 parameters. You can test the new one. But as the talking in issue/2, the solution from mysql to redis, it is not a very meaningful work. Why we have to take some much time on this? By the way, the code is open-sourced, you can do it as you want. |
Like as below:
But it's succeed when wrap off white space.
The text was updated successfully, but these errors were encountered: