-- 构建批量执行时方便而使用,将多个SQL组成到一个中,进行批量执行
local helpSqlBatch = CSQLBatchStringHelp();
local sql_demo = [[
insert into table (col1,col2,col3) values(%s,'value2','value3')
]]
for i=0,3 do
-- 增加一个SQL
helpSqlBatch:inSQL(string.format(sql_demo,i), '');
end
-- 转化成一个字符串,传递给execSQLBatch
print(helpSqlBatch:toString());
-- 返回所有SQL,但不包括param
print(helpSqlBatch:toAllSQL());
-- 批量执行sql
local bOk = db:execSQLBatch(helpSqlBatch:toString(),sError);
if bOk == false then
print('error == ' .. sError:get() );
else
print('process success\n');
end