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

SYNOPSIS

#include "tstone.h"

TSQL *n_opentsql(se)
SERVER *se;

TSQL *n_closetsql(ts)
TSQL   *ts;


DESCRIPTION
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.


EXAMPLE

SERVER *se;
TSQL   *ts;
char   *database;

   ...
                     /* connect to the local host on the default port */
   if((se=openserver("",""))!=SERVERPN)
   {
      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 */
   }


SEE ALSO

openserver(), n_settsql(), n_gettsql()


Copyright © Thunderstone Software     Last updated: Dec 10 2018
Copyright © 2019 Thunderstone Software LLC. All rights reserved.