home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.3 (Developer) / NeXT_Developer-3.3.iso / NextLibrary / Documentation / Sybase / DBLIB / Section2 / dbtabcount.nr < prev    next >
Encoding:
Text File  |  1993-04-22  |  2.2 KB  |  70 lines

  1. .Na "dbtabcount"
  2. .mc |
  3. .Aa
  4. .Fu
  5. Return the number of tables involved in the current SELECT query.
  6. .Ih "table, determining number involved in SELECT query"
  7. .Sy
  8. .Sf "int dbtabcount(dbproc)"
  9. .Sp "DBPROCESS" "*dbproc"
  10. .Co
  11. .Bl
  12. \f2dbtabcount()\f1 is one of the \*L browse mode routines.
  13. It is usable only with results from a browse-mode SELECT (\f2i.e.,\f1
  14. a SELECT containing the key words FOR BROWSE).
  15. See the Introduction for a detailed discussion of browse mode.
  16. .Bl
  17. A SELECT query can generate a set of result rows whose columns are 
  18. derived from several database tables.
  19. To perform browse-mode updates of columns in a query's \f2select-list\f1,
  20. the application must know how many tables were involved
  21. in the query, because 
  22. each table requires a separate UPDATE statement.
  23. \f2dbtabcount()\f1 can provide this information for ad hoc queries.
  24. If the query has been hardcoded into the program, this routine is obviously unnecessary.
  25. .Bl
  26. The count returned by this routine includes any \*S ``work tables''
  27. used in processing the query. 
  28. .Ih "work tables"
  29. .Ih "tables, work"
  30. The \*S sometimes creates temporary, internal work tables to process
  31. a query.
  32. It deletes these work tables by the time it finishes processing
  33. the statement.
  34. Work tables are not updatable and are not available to the application.
  35. Therefore, before using a table number,
  36. the application must make sure that it does not
  37. belong to a work table.
  38. \f2dbtabname()\f1 can be used to determine whether a particular
  39. table number refers to a work table.
  40. .Bl
  41. The application can call
  42. \f2dbtabcount()\f1 any time after \f2dbresults()\f1.
  43. .Bl
  44. Example 7 in the \f2\*L Reference Supplement\f1 contains a call to \f2dbtabcount()\f1.
  45. .Bz
  46. .Pa
  47. .Pi dbproc
  48. A pointer to the DBPROCESS structure that provides the connection
  49. for a particular front-end/\*S process.  It contains all the
  50. information that \*L uses to manage communications and data between the
  51. front end and \*S.
  52. .in -.375i
  53. .Re
  54. .br
  55. The number of tables, including \*S work tables, involved
  56. in the current set of row results.
  57. .sp 0.5v
  58. \f2dbtabcount()\f1 will return -1 in case of error.
  59. .Sa
  60. dbcolbrowse,
  61. dbcolsource,
  62. dbqual,
  63. dbtabbrowse,
  64. dbtabname,
  65. dbtabsource,
  66. dbtsnewlen,
  67. dbtsnewval,
  68. dbtsput
  69. .mc
  70.