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              dbtabsource
  ______________________________________________________________________

  NAME:  dbtabsource

  FUNCTION:
       Return the name and number of the table from which  a  particular
       result column was derived.

  SYNTAX:
       char *dbtabsource(dbproc, colnum, tabnum)

       DBPROCESS *dbproc;
       int       colnum;
       int       *tabnum;







  dbtabsource             Version 4.0 -- 5/1/89                        2
  ______________________________________________________________________

  COMMENTS:

       o dbtabsource() is one of the DB-Library  browse  mode  routines.
         It is usable only with results from a browse-mode SELECT (i.e.,
         a SELECT containing the key words FOR BROWSE).  See the  Intro-
         duction for a detailed discussion of browse mode.
       o dbtabsource() allows an application to determine  which  tables
         provided  the  columns  in the current set of result rows. This
         information is valuable when using dbqual() to construct  WHERE
         clauses  for  UPDATE  and  DELETE  statements  based  on ad hoc
         queries.  If the query has been  hardcoded  into  the  program,
         this routine is obviously unnecessary.

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



  3                       Version 4.0 -- 5/1/89              dbtabsource
  ______________________________________________________________________
         call to dbtabsource().

  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.
       colnum -  The number of the result  column  of  interest.  Column
           numbers start at 1.
       tabnum -  A pointer to an integer, which will be filled  in  with
           the  table's number.  Many DB-Library routines that deal with
           browse mode accept either a table name or a table number.  If
           dbtabsource()  returns  NULL (see below), *tabnum will be set
           to -1.

  RETURNS:
       A pointer to the name of the table from which this result  column



  dbtabsource             Version 4.0 -- 5/1/89                        4
  ______________________________________________________________________
       was derived. A NULL return value can mean a few different things:

       o The DBPROCESS is dead or not enabled. This  is  an  error  that
         will cause an application's error handler to be invoked.
       o The column number is out of range.

       o The  column  is  the  result  of   an   expression,   such   as
         "max(colname)".

  SEE ALSO:
       dbcolbrowse, dbcolsource, dbqual, dbtabbrowse, dbtabcount, dbtab-
       name, dbtsnewlen, dbtsnewval,







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