home *** CD-ROM | disk | FTP | other *** search
- .Na "dbbylist"
- .Aa
- .Fu
- Return the bylist for a compute row.
- .Ih "bylist, returning"
- .Sy
- .Sf "BYTE *dbbylist(dbproc, computeid, size)"
- .Sp "DBPROCESS" "*dbproc"
- .Sp "int" "computeid"
- .Sp "int" "*size"
- .Co
- .Bl
- .I "dbbylist()"
- returns the bylist for a compute row.
- (A SELECT statement's COMPUTE clause may contain
- the keyword BY, followed by a list of columns.
- This list, known as the ``bylist,'' divides the results
- into subgroups, based on changing values in the specified columns.
- The COMPUTE clause's row aggregate is applied to each subgroup,
- generating a compute row for each subgroup.)
- .Bl
- .I "dbresults()"
- must return SUCCEED before the application calls this routine.
- .Bl
- Assume the following command has been executed:
- .SD
- .in +5n
- .ne 3
- select dept, name, year, sales from employee
- order by dept, name, year
- compute count(name) by dept,name
- .in -5n
- .ED
- The call
- .I "dbbylist(dbproc, 1, &size)"
- sets \f2size\f1 to 2, because there are two items in the bylist.
- It returns a pointer to an array of two BYTES, which contain
- the values 1 and 2, indicating that the bylist is composed of
- columns 1 and 2 from the \f2select-list\f1.
- .Bz
- .Pa
- .Pi dbproc
- A pointer to the DBPROCESS structure that provides the connection
- for a particular front-end/\*S process. It contains all the
- information that \*L uses to manage communications and data between the
- front end and \*S.
- .Pi computeid
- The id that identifies the particular compute row of interest.
- A SQL SELECT statement may have multiple COMPUTE clauses,
- each of which returns a separate compute row.
- The \f2computeid\f1 corresponding to the
- first COMPUTE clause in a SELECT is 1.
- The \f2computeid\f1 is returned by \f2dbnextrow()\f1
- or \f2dbgetrow().\f1
- .Pi size
- A pointer to an integer, which
- .I "dbbylist()"
- sets to the number of elements in the bylist.
- .in -.375i
- .Re
- .br
- A pointer to an array of BYTEs containing the numbers of the columns that compose
- the bylist for the specified compute.
- The array of BYTEs is part of the DBPROCESS, so you must not free it.
- If the \f2computeid\f1 is out of range, NULL is returned.
- .sp 0.5v
- Call \f2dbcolname()\f1 to derive the name of a column from its number.
- .sp 0.5v
- The size of the array is returned in the \f2size\f1 parameter.
- A \f2size\f1 of 0 indicates that either there is no bylist for this particular
- compute or the \f2computeid\f1 is out of range.
- .Sa
- dbadata,
- dbadlen,
- dbaltlen,
- dbalttype,
- dbcolname,
- dbgetrow,
- dbnextrow
-