原帖由 grand508 于 2011-9-8 15:14 发表
以下代码是PRO*C的部分代码:
代码1:
EXEC SQL EXECUTE
BEGIN
STAT.proc_stat(:start_time, :end_time, :list_curs);
:ret_db:=0;
EXCEPTION
WHEN OTHERS THEN
:ret_db:=1;
END;
END-EXEC;
调用存储过程, 经测试统计一天的结果的话,可能这部分代码耗时 2 3秒钟
代码2:
rs_count = 0; //最终返回游标取值的总记录条数
count = 0;
ARRAY_SIZE = 1000;
size = ARRAY_SIZE ;
*p_gos = (struct g_stat *)malloc(sizeof(struct g_stat)*size);
EXEC SQL WHENEVER NOT FOUND DO BREAK;
while(1){
EXEC SQL FETCH :list_curs INTO :db_gos:ind_db_gos;
bcopy(db_gos, *p_gos + (ARRAY_SIZE*count), sizeof(struct g_stat)*AR