简体   繁体   English

Progress 4GL:所有字段的缓冲区句柄属性

[英]Progress 4GL: Buffer handle attribute for all fields

I am fairly new to Progress and even newer to handles so apologies if I have missed anything obvious, I've looked online but am yet to find what I'm looking for.我是 Progress 的新手,甚至是新手,所以如果我遗漏了任何明显的东西,我深表歉意,我在网上看过但还没有找到我要找的东西。

I am running a dynamic query similar to the below, in this example after then query is run, the "age" field of the corrresponding record is displayed on screen, I understand how this is done from the buffer-field attribute-method, but my question is how do I display the entire record, is there an equivalent attribute method, or have I misunderstood something crucial?.我正在运行类似于下面的动态查询,在此示例中,在运行查询之后,相应记录的“年龄”字段显示在屏幕上,我了解这是如何从缓冲区字段属性方法完成的,但是我的问题是如何显示整个记录,是否有等效的属性方法,或者我是否误解了一些重要的东西?。 Thank you for your time.感谢您的时间。 : :

def var tbl as character no-undo.
def var fld as character no-undo.
def var qh as handle no-undo.
def var bh as handle no-undo.
def var fh as handle no-undo.

assign tbl = "customer".
assign fld = "age".
create buffer bh for table tbl.
create query qh.
qh:set-buffers( bh ).
qh:query-prepare( "for each " + tbl + " where name = 'tom'" ).
qh:query-open.

do transaction:
    qh:get-first( no-lock ).
    fh = bh:buffer-field( fld ).
    display fh:buffer-value.
end.

delete object bh.
delete object qh

There's no "easy" way to display the entire record in one statement the way you can with a static "DISPLAY table-name" statement. 没有一种简单的方法可以像使用静态“ DISPLAY table-name”语句那样在一条语句中显示整个记录。 You can get the count of fields (buffer-handle:NUM-FIELDS) and then step through the individual fields and display their values using 您可以获取字段的计数(buffer-handle:NUM-FIELDS),然后逐步浏览各个字段并使用显示它们的值

DO i = 1 to bh:NUM-FIELDS: 
     DISPLAY bh:BUFFER-FIELD(i):BUFFER-VALUE WITH DOWN.
     DOWN.
END.
create query qh.
qh:set-buffers( bh ).
qh:query-prepare( "for each " + tbl + " where name = 'tom'" ).
qh:query-open.
qh:GET-FIRST().
DO while qh:QUERY-OFF-END = False:  
   DO i = 1 TO bh:NUM-FIELDS:
      display bh:BUFFER-FIELD (i):NAME STRING(bh:BUFFER-FIELD(i):BUFFER-VALUE) with down.
      down.
   END. 
   qh:GET-NEXT ().
END. 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM