ldmud-3.3.719/
ldmud-3.3.719/doc/
ldmud-3.3.719/doc/efun.de/
ldmud-3.3.719/doc/efun/
ldmud-3.3.719/doc/man/
ldmud-3.3.719/doc/other/
ldmud-3.3.719/mud/
ldmud-3.3.719/mud/heaven7/
ldmud-3.3.719/mud/lp-245/
ldmud-3.3.719/mud/lp-245/banish/
ldmud-3.3.719/mud/lp-245/doc/
ldmud-3.3.719/mud/lp-245/doc/examples/
ldmud-3.3.719/mud/lp-245/doc/sefun/
ldmud-3.3.719/mud/lp-245/log/
ldmud-3.3.719/mud/lp-245/obj/Go/
ldmud-3.3.719/mud/lp-245/players/lars/
ldmud-3.3.719/mud/lp-245/room/death/
ldmud-3.3.719/mud/lp-245/room/maze1/
ldmud-3.3.719/mud/lp-245/room/sub/
ldmud-3.3.719/mud/lp-245/secure/
ldmud-3.3.719/mud/sticklib/
ldmud-3.3.719/mud/sticklib/src/
ldmud-3.3.719/mudlib/deprecated/
ldmud-3.3.719/mudlib/uni-crasher/
ldmud-3.3.719/pkg/
ldmud-3.3.719/pkg/debugger/
ldmud-3.3.719/pkg/diff/
ldmud-3.3.719/pkg/misc/
ldmud-3.3.719/src/
ldmud-3.3.719/src/autoconf/
ldmud-3.3.719/src/ptmalloc/
ldmud-3.3.719/src/util/
ldmud-3.3.719/src/util/erq/
ldmud-3.3.719/src/util/indent/hosts/next/
ldmud-3.3.719/src/util/xerq/
ldmud-3.3.719/src/util/xerq/lpc/
ldmud-3.3.719/src/util/xerq/lpc/www/
ldmud-3.3.719/test/generic/
ldmud-3.3.719/test/inc/
ldmud-3.3.719/test/t-0000398/
ldmud-3.3.719/test/t-0000548/
ldmud-3.3.719/test/t-030925/
ldmud-3.3.719/test/t-040413/
ldmud-3.3.719/test/t-041124/
ldmud-3.3.719/test/t-language/
#ifndef PKG_ODBC_H__
#define PKG_ODBC_H__ 1


#include "driver.h"
#include "typedefs.h"

/* Data Structure */
/* Column meta data */
typedef struct col_meta_data_s
{
  SQLSMALLINT nr;             //the columns number
  SQLCHAR     * name;         //column name

  SQLSMALLINT type;           //LDMud data type (T_FLAOT|T_NUMBER|T_STRING)

  union {                     //pointer to the fetched data
     SQLINTEGER * number_v;
     SQLDOUBLE  * double_v;
     SQLCHAR    * string_v;
  } data;

} COL_META_DATA;

/* Databse Connection */
typedef struct dbc_s hDBC;
struct dbc_s
{
   int           ID;            //ID to identify the handle
   
   char          * name;        //name of the connection
   
   hDBC          * prev,        
                 * next;

   SQLHDBC       hDBCon;        //ODBC DB connection
   SQLHSTMT      hStmt;         //current executed statement

   SQLSMALLINT   colcnt;        //number of columns in the resultset
   SQLINTEGER    rowcnt;        //number of rows in the resultset

   COL_META_DATA ** columns;    
};

/* ODBC Environment */
typedef struct odbc_env_s 
{
   SQLHENV hODBCEnv;            //ODBC environment

   int     next_hDBCon_ID;      //ID used for the next created connection
   hDBC    * hDBCons;           //list of connections
   
   
} hODBCENV;



svalue_t * f_sql_odbc_enabled( svalue_t * argv, int argc );
svalue_t * f_sql_odbc_datasources( svalue_t * argv, int argc );

svalue_t * f_sql_handles( svalue_t * argv, int argc );
svalue_t * f_sql_connect ( svalue_t * argv, int argc );
svalue_t * f_sql_close( svalue_t * argv, int argc );

svalue_t * f_sql_exec( svalue_t * argv, int argc );
svalue_t * f_sql_column_names( svalue_t * argv, int argc );
svalue_t * f_sql_affected_rows( svalue_t * argv, int argc );
svalue_t * f_sql_fetch( svalue_t * argv, int argc );

svalue_t * f_sql_error( svalue_t * argv, int argc );
   

/* required type tests */
/* Typetests for xefuns/tefuns */

#define TYPE_TEST1(arg1,type1) \
  if ((arg1)->type != type1) \
            bad_xefun_arg(1, argv);

#define TYPE_TEST2(arg1,type1) \
  if ((arg1)->type != type1) \
            bad_xefun_arg(2, argv);

#define TYPE_TEST3(arg1,type1) \
  if ((arg1)->type != type1) \
            bad_xefun_arg(3, argv);

/* Typetests for vararg xefuns/vefuns */

#define TYPE_TESTV1(arg1,type1) \
  if ((arg1)->type != type1) \
            bad_xefun_vararg(1, argv);

#define TYPE_TESTV2(arg1,type1) \
  if ((arg1)->type != type1) \
            bad_xefun_vararg(2, argv);

#define TYPE_TESTV3(arg1,type1) \
  if ((arg1)->type != type1) \
            bad_xefun_vararg(3, argv);

#endif /* PKG_ODBC_H__ */