n_opentsql(), n_closetsql() - Texis SQL API initialization and cleanup


#include "tstone.h"

TSQL *n_opentsql(se)

TSQL *n_closetsql(ts)
TSQL   *ts;

n_opentsql() performs the initialization required to perform a Texis SQL query. It returns a pointer to a structure that will be required by the n_settsql(), n_exectsql(), n_gettsql() and n_closetsql() functions. It takes one argument that is an opened SERVER pointer (from openserver()). The SERVER pointer must remain open as long as the TSQL is open. n_opentsql() returns TSQLPN on failure.

All subsequent ...tsql() family calls will take the TSQL pointer as their first argument.

n_closetsql() cleans up all data used used by n_opentsql(). It takes the TSQL pointer to close as its only argument. This must be called before shutting the SERVER connection given to n_opentsql(). n_closetsql() always returns TSQLPN.


TSQL   *ts;
char   *database;

                     /* connect to the local host on the default port */
      n_setdatabase(se,database);          /* set the database to use */
      if((ts=n_opentsql(se))!=TSQLPN) /* initialize the Texis SQL API */

         /* ... perform SQL processing ... */

         n_closetsql(ts);               /* shutdown the Texis SQL API */
      closeserver(se);                  /* disconnect from the server */


openserver(), n_settsql(), n_gettsql()

Copyright © Thunderstone Software     Last updated: Jan 10 2023
Copyright © 2023 Thunderstone Software LLC. All rights reserved.