Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ () — Sybase DB Library C 4.0

Media Vault

Software Library

Restoration Projects

Artifacts Sought

  1                       Version 4.0 -- 5/1/89               dbtabcount
  ______________________________________________________________________

  NAME:  dbtabcount

  FUNCTION:
       Return the number of tables involved in the current SELECT query.

  SYNTAX:
       int dbtabcount(dbproc)

       DBPROCESS *dbproc;

  COMMENTS:

       o dbtabcount() is one of the DB-Library browse mode routines.  It






  dbtabcount              Version 4.0 -- 5/1/89                        2
  ______________________________________________________________________
         is usable only with results from a browse-mode SELECT (i.e.,  a
         SELECT containing the key words FOR BROWSE).  See the Introduc-
         tion for a detailed discussion of browse mode.

       o A SELECT query can generate a set of result rows whose  columns
         are  derived  from several database tables.  To perform browse-
         mode updates of columns in a query's select-list, the  applica-
         tion  must  know  how  many  tables were involved in the query,
         because  each  table  requires  a  separate  UPDATE  statement.
         dbtabcount()  can  provide this information for ad hoc queries.
         If the query has been hardcoded into the program, this  routine
         is obviously unnecessary.
       o The count returned by  this  routine  includes  any  SQL Server
         "work  tables"  used  in  processing  the query. The SQL Server
         sometimes creates temporary, internal work tables to process  a
         query.   It  deletes  these work tables by the time it finishes
         processing the statement.  Work tables are  not  updatable  and



  3                       Version 4.0 -- 5/1/89               dbtabcount
  ______________________________________________________________________
         are not available to the application.  Therefore, before  using
         a table number, the application must make sure that it does not
         belong to a work table.  dbtabname() can be used  to  determine
         whether a particular table number refers to a work table.

       o The  application  can  call   dbtabcount()   any   time   after
         dbresults().
       o Example 7 in the DB-Library  Reference  Supplement  contains  a
         call to dbtabcount().

  PARAMETERS:
       dbproc -  A pointer to the DBPROCESS structure that provides  the
           connection for a particular front-end/SQL Server process.  It
           contains all the information that DB-Library uses  to  manage
           communications and data between the front end and SQL Server.

  RETURNS:



  dbtabcount              Version 4.0 -- 5/1/89                        4
  ______________________________________________________________________
       The number of tables, including SQL Server work tables,  involved
       in the current set of row results.

       dbtabcount() will return -1 in case of error.

  SEE ALSO:
       dbcolbrowse, dbcolsource, dbqual, dbtabbrowse, dbtabname,  dbtab-
       source, dbtsnewlen, dbtsnewval, dbtsput











Typewritten Software • bear@typewritten.org • Edmonds, WA 98026