n_gettx() - SQL interface

SYNOPSIS

FLDLST *n_gettx(SERVER *se,TX *tx);
FLDLST *freefldlst(FLDLST *fl);


DESCRIPTION
This function provides a non-callback version of SQL execution. n_gettx() returns a FLDLST pointer which is the same as would normally be passed to a callback function. You process it just as you would in a callback.

Continue calling n_gettx() to get subsequent result rows. n_gettx() will return FLDLSTPN when there are no more result rows.

Each returned FLDLST must be freed using the freefldlst() when it is no longer needed.


EXAMPLE

SERVER *se;
TX     *tx;
FLDLST *fl;

   ...
   if((tx=n_opentx())!=TXPN)      /* initialize database connection */
   {
      ...
                                                     /* setup query */
      if(n_settx(se,tx,
                 "select NAME from SYSTABLES where CREATOR!='texis';"
                )!=TXPN)
         while((fl=n_gettx(se,tx))!=FLDLSTPN)/* get next result row */
         {
            dispfields(fl);            /* display all of the fields */
            freefldlst(fl);                      /* free the memory */
         }
      ...
      n_closetx(tx);                   /* close database connection */
   }
   ...


SEE ALSO

n_settx(), n_runtx(), n_regtexiscb()


Copyright © Thunderstone Software     Last updated: Apr 15 2024
Copyright © 2024 Thunderstone Software LLC. All rights reserved.