local lsql = CSQLBatchStringHelp();--保存批量执行的语句
local sError = CTNString();

local sqlTmp = [[
    insert into table (col1,col2,col3) values(%s,'value2','value3')
]]
for i=0,3 do
    -- 增加一个SQL
    lsql:inSQL(string.format(sqlTmp,i), '');
end
-- 转化成一个字符串,传递给execSQLBatch
print(lsql:toString());

-- 批量执行sql
local bOk = db:execSQLBatch(lsql:toString(),sError);
if bOk == false then
    print('error == ' .. sError:get() );
else
    print('process success\n');
end
Copyright © TouchNet 2015 all right reserved,powered by Gitbook最后修订时间: 2022-06-21 09:21:04

results matching ""

    No results matching ""