Tsung Erlang 函数 (dynvars) - 转义引号
Tsung 和 Erlan 是新手,遇到了一个我无法找到答案的问题。我在 Tsung dynvars Erlang 函数中使用 erlang-mysql-driver ,我似乎遇到了转义引号的问题。
我想做这样的事情:
<setdynvars sourcetype="eval"
code='fun({Pid,DynVars})->
mysql:start_link(p1, "localhost", "user", "pass", "db"),
Result = mysql:fetch(p1, "SELECT * FROM consumers WHERE first_name=\'Doonley\'") end.'>
<var name="myres" />
</setdynvars>
但我收到空格错误:
Douglas-Sparlings-MacBook-Pro:.tsung dsparling$ tsung start
Starting Tsung
"Log directory is: /Users/dsparling/.tsung/log/20091110-16:35"
3284- fatal: {whitespace_required_between_attributes}
["Config Error, aborting ! ",{fatal,{{whitespace_required_between_attributes},{file,"/Users/dsparling/.tsung/tsung.xml"},{line,72},{col,221}}}]
我实际上需要使用变量进行选择,但我不确定语法。我正在寻找类似以下内容的内容:
<setdynvars sourcetype="eval"
code='fun({Pid,DynVars})->
Val='Doonley",
mysql:start_link(p1, "localhost", "user", "pass", "db"),
Result = mysql:fetch(p1, "SELECT * FROM consumers WHERE first_name=?", Val) end.'>
<var name="myres" />
</setdynvars>
New to Tsung and Erlan and have run into an issue I haven't been able to find answer to. I'm using erlang-mysql-driver in a Tsung dynvars Erlang function and I seem to be having a problem with escaped quotes.
I'd like to do something like this:
<setdynvars sourcetype="eval"
code='fun({Pid,DynVars})->
mysql:start_link(p1, "localhost", "user", "pass", "db"),
Result = mysql:fetch(p1, "SELECT * FROM consumers WHERE first_name=\'Doonley\'") end.'>
<var name="myres" />
</setdynvars>
but I get a whitespace error:
Douglas-Sparlings-MacBook-Pro:.tsung dsparling$ tsung start
Starting Tsung
"Log directory is: /Users/dsparling/.tsung/log/20091110-16:35"
3284- fatal: {whitespace_required_between_attributes}
["Config Error, aborting ! ",{fatal,{{whitespace_required_between_attributes},{file,"/Users/dsparling/.tsung/tsung.xml"},{line,72},{col,221}}}]
I actually need to use a variable for the select, but I'm not sure of the syntax. Something like the following is what I'm looking for:
<setdynvars sourcetype="eval"
code='fun({Pid,DynVars})->
Val='Doonley",
mysql:start_link(p1, "localhost", "user", "pass", "db"),
Result = mysql:fetch(p1, "SELECT * FROM consumers WHERE first_name=?", Val) end.'>
<var name="myres" />
</setdynvars>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试将单引号转义为
'
。例如:Try escaping the single quotes as
'
. E.g.: