📄 pb.txt
字号:
1、对PB,VB,DELPHI,VC等CLIENT端,TUXEDO提供一个DLL编程接口,首先要在这些语言中声明
所要用到的函数。因为PB,VB,DELPHI等中没有指针,可把它们声明为LONG型。
在两层的C/S结构中,客户端直接访问数据库,当采用TUXEDO中间件后,形成三层结构。这时,客户端不直接访问数据库,而
是改为调用中间件TUXEDO服务端上的服务,由TUXEDO服务端访问数据库,并把结果返回给客户端。所以这时候客户端上不用
安装数据库的客户端,PB中的数据窗口的数据源也只能采用外部数据源。
系统说明:
在PB中常用的函数声明如下:
function integer tpinit( long tpinfo ) library "wtuxws32.dll"
function integer tpterm( ) LIBRARY "wtuxws32.dll"
function long tpalloc( string buftype, string subtype, long bufsize ) LIBRARY "wtuxws32.dll"
function long lstrcpyPtr( long buffer, string str ) library "kernel32.dll" alias for lstrcpy
function long lstrcpyStr( ref string str, long buffer ) library "kernel32.dll" alias for lstrcpy
function integer tpcall(string svcname, long ibuffer , long ilen, ref long obuffer, ref long olen, long flags ) library "wtuxws32.dll"
subroutine tpfree( long buffer ) library "wtuxws32.dll"
function integer gettperrno( ) library "wtuxws32.dll"
function string tpstrerror( integer errno ) library "wtuxws32.dll"
function integer tperrordetail( long flag ) library "wtuxws32.dll"
function string tpstrerrordetail( integer errno, long flag ) library "wtuxws32.dll"
function integer fchgd32( long fbfr, long fldif, long occ,ref double buf, long flen ) library "wtuxws32.dll" alias for Fchg32
function integer fchgl32( long fbfr, long fldif, long occ,ref long buf, long flen ) library "wtuxws32.dll" alias for Fchg32
function integer fchgs32( long fbfr, long fldif, long occ, string buf, long flen ) library "wtuxws32.dll" alias for Fchg32
function integer getFerror32() library "wtuxws32.dll" alias for getFerror32
function string Fstrerror32(integer errno) library "wtuxws32.dll" alias for Fstrerror32
function integer fgets32( long fbfr, long fldid, long occ, ref string buf, ref long flen ) library "wtuxws32.dll" alias for Fget32
function integer fgetd32( long fbfr, long fldid, long occ, ref double buf, ref long flen ) library "wtuxws32.dll" alias for Fget32
function integer fgetl32( long fbfr, long fldid, long occ, ref long buf, ref long flen ) library "wtuxws32.dll" alias for Fget32
function long focc32( long fbfr, long fldid ) library "wtuxws32.dll" alias for Foccur32
function long fneeded32( long occ, long len) library "wtuxws32.dll"
function long flen32( long fbfr, long id, long occ) library "wtuxws32.dll" alias for Flen32
function long fprint32( long fbfr) library "wtuxws32.dll" alias for Fprint32
Function Long foccur32(Long RCVBUF,long FLDID ) LIBRARY "wtuxws32.dll" alias for "Foccur32"
Function Long finit32(Long RCVBUF,long BUFSIZE) LIBRARY "wtuxws32.dll" alias for "Finit32"
Function Long tprealloc (Long buffer , Long BUFSIZE ) LIBRARY "wtuxws32.dll"
function long fsizeof32(long fbfr) library "wtuxws32.dll"
function integer tpenqueue( string qspace,string qname, REF TPQCTL ctl, long data, long len, long flags) library "wtuxws32.dll"
function integer tpdequeue( string qspace,string qname, REF TPQCTL ctl, REF long data, REF long len, long flags) library "wtuxws32.dll"
PB与TUXEDO SERVER之间的数据传送可采用两种方式:
1、所有的数据都采用字符串方式,在TUXEDO SERVER和PB CLIENT接收后自己进行转换成所需要的变量类型
2、不转换
在PB中调用SIMPDB,往EMP表中插入一条记录,并把该表中的记录全部出,在CLIENT端的数据窗口中显示出来
PBSERVER.CPP
数据窗口D_EMP的数据源只能采用外部数据源,定义如下:
采用3层结构时在PB中实现CROSSTAB报表,因为现在客户端不能直接调用数据库,数据窗口只能采用外部数据源,一种方法是在
SERVER端直接把各个字段拼成一个字符串,把拼成一个字符串传给CLIENT端,在CLIENT端进行SETITEM()操作,把结果显示出来
数据窗口D_CROSSTAB的数据源定义如下:
对存储过程的处理,推荐的做法是把存储过程转换为TUXEDO 的SERVICE,这样做工作量比较大,但是完全的3层结构,另一种
方式是存储过程不变,用一个TUXEDO 的SERVICE去调用该存储过程,把结果返回给CLIENT端.
在PB中使用QUEUE,因为TPENQUEUE,TPDEQUEUE的参数是个结构体指针,在PB中的声明如下:
int tpcall(char *svc, char *idata, long ilen, char **odata, long *olen, long flags)
描述:同步调用SERVER端的名为svc的SERVICE
参数:
*svc:SERVICE的名称
char *idata:输入缓冲区的地址,CLIENT端传给SERVER端的参数放在该缓冲区内
long ilen:输入缓冲区的长度
char **odata输出缓冲区的地址,SERVER端传给CLIENT端的结果放在该缓冲区内
long *olen:输出缓冲区的长度
, long flags:调用标志,
TPNOTRAN
If the caller is in transaction mode and this flag is set, then when svc is invoked, it is not performed on behalf of the caller's transaction. Note that svc may still be invoked in transaction mode but it will not be the same transaction: a svc may have as a configuration attribute that it is automatically invoked in transaction mode. A caller in transaction mode that sets this flag is still subject to the transaction timeout (and no other). If a service fails that was invoked with this flag, the caller's transaction is not affected.
TPNOCHANGE
By default, if a buffer is received that differs in type from the buffer pointed to by *odata, then *odata's buffer type changes to the received buffer's type so long as the receiver recognizes the incoming buffer type. When this flag is set, the type of the buffer pointed to by *odata is not allowed to change. That is, the type and sub-type of the received buffer must match the type and sub-type of the buffer pointed to by *odata.
TPNOBLOCK
The request is not sent if a blocking condition exists (for example, the internal buffers into which the message is transferred are full). Note that this flag applies only to the send portion of tpcall(): the function may block waiting for the reply. When TPNOBLOCK is not specified and a blocking condition exists, the caller blocks until the condition subsides or a timeout occurs (either transaction or blocking timeout).
TPNOTIME
This flag signifies that the caller is willing to block indefinitely and wants to be immune to blocking timeouts. However, if the caller is in transaction mode, this flag has no effect; it is subject to the transaction timeout limit. Transaction timeouts may still occur.
TPSIGRSTRT
If a signal interrupts any underlying system calls, then the interrupted system call is reissued.
In a multithreaded application, a thread in the TPINVALIDCONTEXT state is not allowed to issue a call to tpcall().
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -