home *** CD-ROM | disk | FTP | other *** search
- DBPROCESS *dbproc;
- char biggest_name[MAXNAME+1];
- int namelen;
- int rowinfo;
-
- /* put the command into the command buffer */
- dbcmd(dbproc, "select name from sysobjects");
- dbcmd(dbproc, " order by name");
- dbcmd(dbproc, " compute max(name)");
-
- /* send the command to \*S and start execution */
- dbsqlexec(dbproc);
-
- /* process the command */
- dbresults(dbproc);
-
- /* examine each row returned by the command */
- 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.
- */
-
- namelen = dbadlen(dbproc, rowinfo, 1);
- strncpy
- (biggest_name,
- (char *)dbadata(dbproc, rowinfo, 1),
- namelen);
-
- /* Data pointed to by dbadata() is not
- * null-terminated.
- */
- biggest_name[namelen] = '\\0';
-
- printf("biggest name = %s\\n", biggest_name);
- }
- }
-