/* * Copyright (C) 2007 Tildeslash Ltd. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation. * * There are special exceptions to the terms and conditions of the GPL * as it is applied to this software. View the full text of the exception * in the file EXCEPTIONS accompanying this software distribution. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef ZCONFIG_H #define ZCONFIG_H /** * Global defines, macros and types * * @version \$Id: Config.h,v 1.20 2007/02/12 20:50:54 hauk Exp $ * @file */ #include #include #include "xconfig.h" /** * The libzdb URL */ #define LIBZDB_URL "http://www.tildeslash.com/libzdb/" /** * Version, copyright and contact information */ #define ABOUT "This is the Zild Database Library, version " VERSION \ ". Copyright (C) 2007 Tildeslash Ltd. " LIBZDB_URL /* ----------------------------------- Error, Exceptions and report macros */ /** * The standard abort routine */ #define ABORT Util_abort /** * The standard debug routine */ #define DEBUG if(ZBDEBUG) Util_debug /** * The standard maximum length for a checked error message */ #define ERROR_SIZE 1024 /** * Mask out THROW if exceptions handling was disabled, otherwise include * exception interfaces */ #ifndef WITH_EXCEPTIONS #define THROW(e) ((void)0) #else #include "SQLException.h" #include "AssertException.h" #endif /* --------------------------------------------- SQL standard value macros */ /** * Standard millisecond timeout value for a database call. */ #define SQL_DEFAULT_TIMEOUT 3000 /** * The default maximum number of database connections */ #define SQL_DEFAULT_MAX_CONNECTIONS 20 /** * The initial number of database connections */ #define SQL_DEFAULT_INIT_CONNECTIONS 5 /** * The standard sweep interval in seconds for a ConnectionPool reaper thread */ #define SQL_DEFAULT_SWEEP_INTERVAL 60 /** * Default Connection timeout in seconds, used by reaper to remove * inactive connections */ #define SQL_DEFAULT_CONNECTION_TIMEOUT 30 /** * Default TCP/IP Connection timeout in seconds, used when connecting to * a database server over a TCP/IP connection */ #define SQL_DEFAULT_TCP_TIMEOUT 3 /** * MySQL default server port number */ #define MYSQL_DEFAULT_PORT 3306 /** * PostgreSQL default server port number */ #define POSTGRESQL_DEFAULT_PORT 5432 /* ------------------------------------------ General Purpose value macros */ /** * Standard String length */ #define STRLEN 256 /** * Boolean truth value */ #define TRUE 1 /** * Boolean false value */ #define FALSE 0 /** * Microseconds per second */ #define USEC_PER_SEC 1000000 /* ------------------------------------- General Purpose functional macros */ #define IS(a,b) ((a&&b)?Util_isEqual(a, b):0) #define STRERROR strerror(errno) #define ALLOC(n) Util_alloc((n), __FILE__, __LINE__) #define CALLOC(c, n) Util_calloc((c), (n), __FILE__, __LINE__) #define NEW(p) ((p) = CALLOC(1, (long)sizeof *(p))) #define FREE(p) ((void)(Util_free((p), __FILE__, __LINE__), (p) = 0)) #define RESIZE(p, n) ((p)= Util_resize((p), (n), __FILE__, __LINE__)) /* ------------------------------------------------------ Type definitions */ /** * The internal 8-bit char type */ typedef unsigned char uchar_T; /** * The internal 32 bits integer type */ typedef unsigned int uint32_T; /* -------------------------------------------------------------- Globals */ /** * Abort handler callback */ extern void(*AbortHandler)(const char *error); /** * Library Debug flag. If set to TRUE, emit debug output */ extern int ZBDEBUG; #endif