请教一个PB的问题,代码如下:
gl_main.inv_statusbar.of_modify('msg','开始下载订单行..')
datapipe_1.dataobject = 'i_tb_gz_order_detail_by_order_date'
li_rc = datapipe_1.start(gdy_m,dl_order,dw_1,em_1.text)
if li_rc = 1 then
gl_main.inv_statusbar.of_modify('msg','正在保存订单行...')
------------------------------问题点代码部分----------------------------------
execute immediate 'download_order' using dl_order;
if dl_order.sqlcode = 0 then
gl_main.inv_statusbar.of_modify('msg','保存订单行成功!')
execute immediate 'commit tran' using dl_order;
else
ls_err_text = dl_order.sqlerrtext
gl_main.inv_statusbar.of_modify('msg','保存订单行失败!' )
execute immediate 'ROLLBACK tran' using dl_order;
messagebox('信息','保存订单行失败!'+ ls_err_text )
this.enabled = true
cb_4.enabled = true
return
end if
--------------------------------------问题点----------------------------------------
问题1.1:execute immediate 'download_order' using dl_order;
问题1.2:execute immediate 'commit tran' using dl_order;
怎么查看问题点中的两个execute immediate 代码,我想看看里边执行了什么动作。
谢谢,祝大家万事如意,恭喜发财。
PB?
------解决方案--------------------
EXECUTE IMMEDIATE SQLStatement
{USING TransactionObject} ;
Parameter Description
SQLStatement A string containing a valid SQL statement. The string can be a string constant or a PowerBuilder variable preceded by a colon (such as :mysql). The string must be contained on one line and cannot contain expressions
TransactionObject (optional) The name of the transaction object that identifies the database
PB的动态Sql语法中最简单的一种,看pb帮助,检索Dynamic SQL Format ,Dynamic SQL Format 1 SQL statement 就是了
------解决方案--------------------
问题1.1:execute immediate 'download_order' using dl_order;
调用了数据库里的download_order ,可能是函数或过程
问题1.2:execute immediate 'commit tran' using dl_order;
这个是回滚事务