/*
 ******************************************************************************
 *  Copyright 1984-1993 United States Data Corporation. All Rights Reserved.
 ******************************************************************************
 *                                - NOTICE -
 *
 *  The information contained herein is confidential information of United
 *  States Data Corporation, a Delaware corporation, and is protected by
 *  United States copyright and trade secret law and international treaties.
 *  This information is not to be disclosed, used or copied by or transferred
 *  to any individual, corporation, company or other person without the
 *  express written permission of United States Data Corporation.
 ******************************************************************************
 *
 * Module:	HDT_DBUT.H
 *
 *	Header file for misc. database utility functions.
 *
 * History:
 *		bjc 05/03/93	Created. 
 */


#ifndef _DBUT_INCLUDED
#define _DBUT_INCLUDED

/*
 ************************************************************************
 *                              Constants                               *       
 ************************************************************************
 */

#define DBUT_LEN_SBUF		1023	/* maximum error message length */

/*
 *  Constants for function dbut_bld_addq() 
 */

#define DBUT_LOGQ	0	/* LOG INTO query */
#define DBUT_INSQ	1	/* INSERT INTO query */

/*
 ************************************************************************
 *                              Structures                              * 
 ************************************************************************
 */

/*
 ************************************************************************
 *                            Global Variables                          * 
 ************************************************************************
 */

extern char	*Dbut_sbuf;		/* sprintf() work buffer */

/*
 ************************************************************************
 *                              Macros                                  *       
 ************************************************************************
 */

/*
 ************************************************************************
 *                         Function Prototypes                          * 
 ************************************************************************
 */

/*
 *  SQL statement formation routines
 */

extern int	dbut_delin_vars(short num_vars, char *outstr, int maxlen);
extern int	dbut_bld_regq(char *tblname, char *delin_col,
		              char *outstr, int maxlen);
extern int	dbut_bld_addq(char *tblname, char *delin_col, short num_vars,
		              int add_type, char *outstr, int maxlen);

/*
 *  General string routines
 */
#ifdef __cplusplus
extern "C" {
#endif

extern char*	dbut_str_rtrim(char *s);
extern char*	dbut_str_ltrim(char *s);
extern char*	dbut_str_alltrim(char *s);
extern char*	dbut_strdncat(char *dst, char *src, int dmax);
/*
** SPR 5131 Use strnicmp from flib.h 
** extern int	dbut_strnicmp(char *str1, char *str2, int len);
*/
#define dbut_strnicmp strnicmp
extern char*	dbut_strdup(char *s);
extern char*	dbut_strupr(char *str);

/*
 *  Error recording/formatting routines
 */

#ifndef MWATCH
extern char*	dbut_zalloc(size_t size);
#endif

extern char* 	dbut_xlate(char *token);
extern void	dbut_set_hs_shut(int sync_on);
extern void	dbut_reset_hs_shut(void);

#ifdef __cplusplus
}
#endif

#endif

