Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
hanoi2005
redis
提交
151b606c
R
redis
项目概览
hanoi2005
/
redis
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
redis
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
151b606c
编写于
10月 01, 2012
作者:
A
antirez
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Revert "Scripting: redis.NIL to return nil bulk replies."
This reverts commit
e061d797
. Conflicts: src/scripting.c
上级
f1466e11
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
4 addition
and
39 deletion
+4
-39
src/scripting.c
src/scripting.c
+4
-35
tests/unit/scripting.tcl
tests/unit/scripting.tcl
+0
-4
未找到文件。
src/scripting.c
浏览文件 @
151b606c
...
...
@@ -544,14 +544,6 @@ void scriptingInit(void) {
lua_pushcfunction
(
lua
,
luaRedisSha1hexCommand
);
lua_settable
(
lua
,
-
3
);
/* redis.NIL */
lua_pushstring
(
lua
,
"NIL"
);
lua_newtable
(
lua
);
lua_pushstring
(
lua
,
"nilbulk"
);
lua_pushboolean
(
lua
,
1
);
lua_settable
(
lua
,
-
3
);
lua_settable
(
lua
,
-
3
);
/* redis.error_reply and redis.status_reply */
lua_pushstring
(
lua
,
"error_reply"
);
lua_pushcfunction
(
lua
,
luaRedisErrorReplyCommand
);
...
...
@@ -654,30 +646,9 @@ void luaReplyToRedisReply(redisClient *c, lua_State *lua) {
addReplyLongLong
(
c
,(
long
long
)
lua_tonumber
(
lua
,
-
1
));
break
;
case
LUA_TTABLE
:
/* The table can be an array or it may be in a special format that
* Lua uses to return special Redis protocol data types.
*
* 1) Errors are retuned as a single element table with 'err' field.
* 2) Status reply are returned as a single element table with 'ok'
* field.
* 3) A Redis nil bulk reply is returned as a single element table
* with 'nilbulk' field set to true.
*
* All the rest is considered just an array and is translated into
* a Redis multi bulk reply. */
/* Nil bulk reply */
lua_pushstring
(
lua
,
"nilbulk"
);
lua_gettable
(
lua
,
-
2
);
t
=
lua_type
(
lua
,
-
1
);
if
(
t
==
LUA_TBOOLEAN
)
{
addReply
(
c
,
shared
.
nullbulk
);
lua_pop
(
lua
,
2
);
return
;
}
lua_pop
(
lua
,
1
);
/* Error reply */
/* We need to check if it is an array, an error, or a status reply.
* Error are returned as a single element table with 'err' field.
* Status replies are returned as single elment table with 'ok' field */
lua_pushstring
(
lua
,
"err"
);
lua_gettable
(
lua
,
-
2
);
t
=
lua_type
(
lua
,
-
1
);
...
...
@@ -689,9 +660,8 @@ void luaReplyToRedisReply(redisClient *c, lua_State *lua) {
lua_pop
(
lua
,
2
);
return
;
}
lua_pop
(
lua
,
1
);
/* Status reply */
lua_pop
(
lua
,
1
);
lua_pushstring
(
lua
,
"ok"
);
lua_gettable
(
lua
,
-
2
);
t
=
lua_type
(
lua
,
-
1
);
...
...
@@ -702,7 +672,6 @@ void luaReplyToRedisReply(redisClient *c, lua_State *lua) {
sdsfree
(
ok
);
lua_pop
(
lua
,
1
);
}
else
{
/* Multi bulk reply. */
void
*
replylen
=
addDeferredMultiBulkLength
(
c
);
int
j
=
1
,
mbulklen
=
0
;
...
...
tests/unit/scripting.tcl
浏览文件 @
151b606c
...
...
@@ -30,10 +30,6 @@ start_server {tags {"scripting"}} {
set _ $e
}
{
this is an error
}
test
{
EVAL - Lua nil reply -> Redis protocol type conversion
}
{
r eval
{
return
{
1,redis.NIL,
{
nilbulk=true
}
,4
}}
0
}
{
1
{}
{}
4
}
test
{
EVAL - Lua table -> Redis protocol type conversion
}
{
r eval
{
return
{
1,2,3,'ciao',
{
1,2
}}}
0
}
{
1 2 3 ciao
{
1 2
}}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录