天天看点

PB powerbuilder中使用datastore替代游标

 先看一个实验,相同的效果,游标和datastore的处理效率对比,datastore有明显优势。

PB powerbuilder中使用datastore替代游标
PB powerbuilder中使用datastore替代游标

A:游标方式:

PB powerbuilder中使用datastore替代游标

B:datastore方式 

PB powerbuilder中使用datastore替代游标

 两段代码都是从表格 base_area中抓取area_name字段内容,相比之下,datastore方式的脚本更易于阅读。

另外,datastore还可以完成一些更复杂的逻辑,以及更自由的数据读取,所以PB开发中是可以使用datastore替代游标的。

继续阅读