ndk.set_var.set_quote_sql_str sometimes treats the variable supplied as a param as if it were an empty string. the following config:
location /luaset {
content_by_lua "
local version = '2011.10.13+0000'
--ngx.say(version)
--ngx.log(ngx.ERR, version)
local e_version = ndk.set_var.set_encode_base32(version)
local s_version= ndk.set_var.set_quote_sql_str(version)
ngx.say(e_version)
ngx.say(s_version)
";
}
when hit with a basic get request:
[david@dev-3]$ curl http://<ip>:8080/luaset
68o32c9e64o2sc9j5co30c1g
''
returns a quoted empty string.
if i uncomment *either* the ngx.log or ngx.say, the quoted string is not empty:
[david@dev-3]$ curl http://honey:8080/luaset
68o32c9e64o2sc9j5co30c1g
'2011.10.13+0000'
is there something about lua variables i don't understand? how could referencing the variable once before the sql conversion have an effect? i can repro this over and over.