用COM+
中间层函数为:
BatchCommit(var arySql: OleVariant);
var
i:integer;
begin
//判断参数arySql是否是一维字符串数组
if VarType(arySql)<>(varArray+varOleStr) then
begin
SaveLog('BatchCommite parameter err: not varArray+varString!');
raise Exception.Create('BatchCommite parameter err: not varArray+varString!');
exit;
end;
//开始进行SQL语句批处理
try
for i:=VarArrayLowBound(arySql,1) to VarArrayHighBound(arySql,1)do
with Exec_Querydo
begin
close;
sql.clear;
sql.Add(arySql);
ExecSQL;
close;
end;
SetComplete;
except
on Exceptiondo
begin
SaveLog('BatchCommite Error:');
raise;
SetAbort;
end;
end;
end;
客户端为:
ls_sql[0]:='INSERT INTO .....';
ls_sql[1]:='UPDATE .....';
...appserver.batchcommit(ls_sql);