home *** CD-ROM | disk | FTP | other *** search
- DBPROCESS *dbproc;
- int rowinfo;
- DBINT sum;
-
- /* first, put the commands into the command buffer */
- dbcmd(dbproc, "select db_name(dbid), dbid, size from sysusages");
- dbcmd(dbproc, " order by dbid");
- dbcmd(dbproc, " compute sum(size) by dbid");
-
- /* send the commands to \*S and start execution */
- dbsqlexec(dbproc);
-
- /* process the command */
- dbresults(dbproc);
-
- /* examine the results of the COMPUTE clause */
- while((rowinfo = dbnextrow(dbproc)) != NO_MORE_ROWS)
- {
- if (rowinfo == REG_ROW)
- printf("regular row returned.\\n");
- else
- {
- /* This row is the result of a COMPUTE clause, and
- * "rowinfo" is the computeid of this COMPUTE clause.
- */
-
- sum = *(DBINT *)(dbadata(dbproc, rowinfo, 1));
- printf("sum = %ld\\n", sum);
- }
- }
-