n_settx(), n_runtx() - SQL interface


TX  *n_settx(SERVER *se,TX *tx,char *queryformat,...);
int  n_runtx(SERVER *se,TX *tx);

These functions perform SQL statement setup and execution for databases opened with n_opentx(). n_settx() takes a TX pointer from n_opentx(), a printf style format string, and the arguments to fill in that format string with.

The query will be constructed using the format string and arguments, parsed, and prepared for execution. n_settx() will return the same TX passed to it on success. It will return TXPN on error.

n_runtx() will execute the statement prepared with n_settx(). At this point what you said will begin to happen and your callback will be called as appropriate. When this function returns execution is complete and another n_settx() should be performed before running again. It will return zero on error and non-zero on success.


TX *tx;

   if((tx=n_opentx())!=TXPN)      /* initialize database connection */
                                                     /* setup query */
                 "select NAME from SYSTABLES where CREATOR!='texis';"
         n_runtx(se,tx);                           /* execute query */
                                             /* setup another query */
                "select NAME,TYPE from SYSCOLUMNS where TBNAME='image';"
         n_runtx(se,tx);                         /* execute a query */
      n_closetx(tx);                   /* close database connection */


n_opentx(), n_gettx()

Copyright © Thunderstone Software     Last updated: May 19 2023
Copyright © 2023 Thunderstone Software LLC. All rights reserved.