unidac调用存储过程返回多个结果集
1)创建一个sqlserver存储过程
CREATE PROCEDURE gettables AS BEGIN -- 第一个结果集 SELECT * FROM tunit; -- 第二个结果集 SELECT * FROM tgoods; END
2)中间件调用存储过程
procedure Tstoredproc.open(ctxt: Tcontext); var db: tdb; pool: tdbpool; jo: tjsonobject; i: integer; begin jo := tjsonobject.Create; try try pool := GetDBPool('1'); db := pool.Lock; db.sp.Close; db.sp.UnPrepare; db.sp.Params.Clear; db.sp.StoredProcName := 'gettables'; db.sp.Prepare; db.sp.execute; i := 1; repeat jo.Add('dataset' + i.ToString, db.sp.tojsonarray); inc(i); until not db.sp.OpenNext; ctxt.OutContent := jo.AsJSON; except on E: Exception do begin ctxt.OutContent := error(E.Message); WriteLog('api.storedproc.open()' + E.Message); end; end; finally pool.Unlock(db); jo.Free; end; end;
3)客户端调用
标签:存储,调用,end,sp,db,jo,unidac,pool From: https://www.cnblogs.com/hnxxcxg/p/18213006