![]() | ![]() | Programming Guide |
Contains a count of the number of rows either fetched to Prolifics or affected by the previous statement
The use of this variable is dependent on the database engine. On all engines,
@dmrowcountis set to the number of rows fetched to Prolifics variables in aSELECTstatement orCONTINUEcommand. On some engines, it can also reflect the number of rows affected by anINSERT,UPDATE, orDELETEstatements.
@dmrowcountis set to 0 before each newDBMScommand is executed. You must copy its value to another location if you want to use the value in subsequent commands.If the command fetches rows, Prolifics updates
@dmrowcountwriting the number of rows fetched to Prolifics variables. Most SQL syntaxes provide an aggregate functionCOUNTto count the number of values in a column or the number of rows in a select set. The value of@dmrowcountis not the number of rows in a select set; rather, it is the number of rows returned to Prolifics variables. Therefore if a select set has 14 rows in total, and its target Prolifics variables are arrays, each with ten occurrences,@dmrowcountequals 10 after the
SELECTis executed, and 4 after theDBMSCONTINUEis executed. IfDBMSCONTINUEis executed a second time,@dmrowcountwould equal 0.The integer written to
@dmrowcountis either less than or equal to the maximum number of rows that can be written to the target Prolifics destinations; the maximum number of rows is the number of occurrences in a destination variable. If the value in@dmrowcountis less than the maximum number of occurrences, then the entire select set is written to the target variables and no further processing is needed. If@dmrowcountequals the maximum number of occurrences, then theSELECTmight fetch more rows than can fit in the variables. To display the rest of the select set, the application must executeDBMSCONTINUEuntil@dmrowcountis less than the maximum number of occurrences (or equals 0) or until@dmretcodereceives theDM_NO_MORE_ROWScode.For information on whether the variable can be used to obtain the number of rows affected by an
INSERT,UPDATE, orDELETEstatement, refer to the Database Drivers for the specified engine.If you are using the transaction manager, call
sm_tm_pinquire(TM_OCC_COUNT) to find the number of rows fetched in the current server view. Since a transaction command can consist of more than oneDBMScommand,@dmrowcountmight have already been overwritten.
proc get_selection
DBMS SQL SELECT * FROM titles WHERE genre_code=:+type
call check_count
returnproc check_count
# If rows are returned but not the NO_MORE_ROWS code,
# let the user know there are rows pending.
if (@dmrowcount > 0) && \
(@dmretcode != DM_NO_MORE_ROWS)
msg setbkstat "Press %KPF1 to see more."
else
msg setbkstat "All rows returned."
returnproc get_more
# This function is called by pressing PF1.
# It retrieves the next set of rows.
DBMS CONTINUE
call check_count
return
![]()
![]()
![]()
![]()