2.数据窗口和数据存储
数据窗口(DataWindow)是PowerBuilder提供给开发人员快速建立基于数据库应用程序的最强有力的工具,也是PowerBuilder与其他面向对象的数据库应用前端开发工具的最主要的区别。它的本质是以自动化的用户/数据库接口为开发人员最大限度地节省时间和精力,并且这种自动化特性并不限制开发人员的主观能动性,开发者能以他所钟爱的方式来应用数据窗口,开发出高质量的应用程序。精通PB者就必定精通数据窗口技术。
数据存储(DataStore)可以看作数据窗口的不可视版,除了不可见,其他功能和数据窗口完全一样,为提高效率使用。
因DM程序员手册已有相关简单介绍,且数据窗口内容相当琐碎,这里不再作更深入研究。
3.PB中的SQL提交方式
在pb中,可以使用sqlca.autocommit = true将自动提交开启,或sqlca.autocommit = False关闭自动提交,需要注重的是,DDL语句为隐性自动提交,不可rollback。
4.PB中对存储过程的使用
以要害字RPCFUNC声明存储过程
(1)在前台要申明一个事务(transact)的用户对象,比方说:u_trans
(2)然后用u_trans取代默认的transact
(3)然后将你要使用的存储过程作为外部的函数引进来
以下为使用PB调用DM中的存储过程的示例(针对DM的几种存储过程分类,分为输入参数过程、输出参数过程、输入输出参数过程):
DM中执行建表和存储过程语句:
--建表 create table pbdm (a bigint,b binary,c bit, d blob,e char,f clob,g date,h decimal,i double, j float,k integer,l smallint,m time, n timestamp,o tinyint,p varbinary,q varchar); --输入参数过程 create or replace procedure proc_in (b binary,c bit,d blob,e char,f clob,g date,h decimal, i double,j float,k integer,l smallint, m time,n timestamp,o tinyint,p varbinary,q varchar) as temp integer; begin select isnull(max(a),0) into temp from pbdm; temp:=temp 1 insert into pbdm values (temp,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q); end; --输出参数过程 create or replace procedure proc_out(a1 in int , b1 out binary , c1 out bit , d1 out blob , e1 out char , f1 out clob , g1 out date , h1 out decimal , i1 out double , j1 out float , k1 out integer , l1 out smallint , m1 out time , n1 out timestamp , o1 out tinyint , p1 out varbinary , q1 out varchar ) as temp integer ; begin select b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q into b1,c1, d1,e1,f1,g1,h1,i1,j1,k1,l1,m1,n1,o1,p1, q1 from pbdm where pbdm.a = a1 ; print 'hi' ; end --输入输出参数过程 create or replace procedure proc_inout (a1 in out int , b1 in out binary , c1 in out bit , d1 in out blob , e1 in out char , f1 in out clob , g1 in out date , h1 in out decimal , i1 in out double , j1 in out float , k1 in out integer , l1 in out smallint , m1 in out time , n1 in out timestamp , o1 in out tinyint , p1 in out varbinary , q1 in out varchar ) as temp integer ; begin select b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q into b1,c1, d1,e1,f1,g1,h1,i1,j1,k1,l1,m1,n1,o1,p1, q1 from pbdm where pbdm.a = a1 ; print 'hi' ;end |
(1)在PB在用户对象画笔中创建一个Class-Standard类型的,从Transaction继续的用户对象。另存为uo_sql
最新相关文章
发表评论