/*
**      $VER: Msql.h 1.1 (26.02.98)
**
**      definition of Msql
**
**      (C) Copyright 1998 Christophe Sollet
**      All Rights Reserved.
*/

#ifndef MSQL_MSQL_H
#define MSQL_MSQL_H

#ifndef  EXEC_LIBRARIES
#include <exec/libraries.h>
#endif /* EXEC_LIBRARIES_H */

struct MsqlConnection
{
	int des;				/* private */
	struct MsgPort *port;	/* private */
	struct MsqlMsg *msg;	/* private */
};

/* The end of this files comes from the original "msql.h" which is ©1995 David J. Hughes. */

typedef	char	** m_row;

typedef struct field_s {
	char	*name,
		*table;
	int	type,
		length,
		flags;
} m_field;



typedef	struct	m_data_s {
	int	width;
	m_row	data;
	struct	m_data_s *next;
} m_data;

typedef struct m_fdata_s {
	m_field	field;
	struct m_fdata_s *next;
} m_fdata;



typedef struct result_s {
        m_data 	*queryData,
                *cursor;
	m_fdata	*fieldData,
		*fieldCursor;
	int	numRows,
		numFields;
} m_result;


#define	msqlNumRows(res) res->numRows
#define	msqlNumFields(res) res->numFields


#define INT_TYPE	1
#define CHAR_TYPE	2
#define REAL_TYPE	4
#define IDENT_TYPE	8
#define NULL_TYPE	16
#define TEXT_TYPE	32
#define LAST_REAL_TYPE	32
#define UINT_TYPE	64
#define IDX_TYPE	253
#define SYSVAR_TYPE	254
#define	ANY_TYPE	255

#define NOT_NULL_FLAG   1
#define UNIQUE_FLAG	2

#define IS_UNIQUE(n)	(n & UNIQUE_FLAG)
#define IS_NOT_NULL(n)	(n & NOT_NULL_FLAG)

#endif /* MSQL_MSQL_H */
