前端之家收集整理的这篇文章主要介绍了
sysbench测试oracle自定义lua以使用绑定变量,
前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
pathtest = string.match(test,"(.*/)") or ""
dofile(pathtest .. "common.lua")
function thread_init(thread_id)
local table_name
set_vars()
table_name = "equ_run_data"
stmt = db_prepare("UPDATE ".. table_name .." SET col10=(substr((dbms_random.value),1,11)),col24=(substr((dbms_random.value),11)) WHERE eid= to_number(:x) and 'a' = :y")
params = {}
params[1] = '123'
params[2] = 'a'
db_bind_param(stmt,params)
end
function event(thread_id)
local table_name
params[1] = string.format("%d",sb_rand(1,oltp_table_size))
params[2] = 'a'
db_execute(stmt)
db_query('COMMIT')
end