DBD-DB2

 view release on metacpan or  search on metacpan

dbdimp.h  view on Meta::CPAN

/*
   engn/perldb2/dbdimp.h, engn_perldb2, db2_v82fp9, 1.11 04/09/13 17:27:00

   Copyright (c) 1995-2004 International Business Machines Corp.
*/

/* these are (almost) random values ! */
#define MAX_COL_NAME_LEN 128                                      

#include <dbivport.h>
/**
 * Macro for Error Handling. This error handling is followed from
 * CLI Development Guide for v951 - Chapter8 (Diagnostics in CLI Applications)
 * We try to capture 5 types of return codes and print the diagnostic 
 * information for the same. The return codes captured are
 *
 * 1. SQL_SUCCESS - Nothing to be done. Sucessful execution of CLI API
 * 2. SQL_SUCCESS_WITH_INFO - This is warning thrown back.
 * 3. SQL_NO_DATA_FOUND	- Function success but no data was returned
 * 4. SQL_ERROR	- Function failed
 * 5. SQL_INVALID HANDLE - Function failed due to invalid handle
 */

#define CHECK_ERROR(perlHandle, handleType, handle, ret, what)				\
if(ret != SQL_SUCCESS) {                                 				\
        ret = diagnoseError(perlHandle, handleType, handle, ret, what);	 	 	\
}

typedef struct imp_fbh_st imp_fbh_t;

struct imp_drh_st {
	dbih_drc_t com;                     /* MUST be first element in structure   */
	SQLHENV henv;
	int     connects;
	SV     *svNUM_OF_FIELDS;                                       
};

/* Define dbh implementor data structure */
struct imp_dbh_st {
	dbih_dbc_t com;                     /* MUST be first element in structure   */
	SQLHENV henv;
	SQLHDBC hdbc;
	char sqlerrp[9];                                               
};


/* Define sth implementor data structure */
struct imp_sth_st {	
	dbih_stc_t  com;                    /* MUST be first element in structure   */
	SQLHENV     henv;
	SQLHDBC     hdbc;
	SQLHSTMT    phstmt;

	/* Input Details    */
	SQLCHAR     *statement;             /* sql (see sth_scan)                   */
	HV          *bind_names;

	/* Output Details   */
	SQLINTEGER  done_desc;              /* have we described this sth yet ?     */
	imp_fbh_t   *fbh;                   /* array of imp_fbh_t structs           */
	SQLCHAR     *fbh_cbuf;              /* memory for all field names           */
	int         numFieldsAllocated;     /* number of fields allocated, could be */
					    /* more than current number of fields   */
					    /* in the case of multiple result sets  */
	SQLINTEGER  RowCount;               /* Rows affected by insert, update,     */
	                                    /* delete (unreliable for SELECT)       */
	int         bHasInput;              /* Has at least one input parameter     */
					    /* (by reference)                       */
	int         bHasOutput;             /* Has at least one output parameter    */
	int         bMoreResults;           /* Definitely has more results          */
					    /*   1=more results, 0=unknown          */
};



( run in 0.487 second using v1.01-cache-2.11-cpan-75ffa21a3d4 )