00001 #ifndef DB_FREETDS_COMMON_SUPPORT
00002 #define DB_FREETDS_COMMON_SUPPORT
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include "db_freetds_dll.h"
00020
00021 #if HAVE_CONFIG_H
00022 #include <config.h>
00023 #endif
00024
00025 #include <stdarg.h>
00026 #include <stdio.h>
00027
00028 #if HAVE_STDLIB_H
00029 #include <stdlib.h>
00030 #endif
00031
00032 #if HAVE_STRING_H
00033 #include <string.h>
00034 #endif
00035
00036 #ifdef DBNTWIN32
00037 #include <windows.h>
00038 #endif
00039
00040 #include <sqlfront.h>
00041 #include <sqldb.h>
00042
00043
00044 class istring;
00045
00046 #ifdef DBNTWIN32
00047
00048
00049
00050
00051
00052 #define MSDBLIB 1
00053 #define MICROSOFT_DBLIB 1
00054 #define dbloginfree(l) dbfreelogin(l)
00055
00056 #define SYBESMSG SQLESMSG
00057 #define SYBECOFL SQLECOFL
00058
00059 #define SYBAOPSUM SQLAOPSUM
00060 #define SYBAOPMAX SQLAOPMAX
00061
00062 #define SYBINT4 SQLINT4
00063 #define SYBDATETIME SQLDATETIME
00064 #define SYBCHAR SQLCHAR
00065 #define SYBVARCHAR SQLVARCHAR
00066 #define SYBTEXT SQLTEXT
00067 #define SYBBINARY SQLBINARY
00068 #define SYBIMAGE SQLIMAGE
00069
00070 #define dberrhandle(h) dberrhandle((DBERRHANDLE_PROC) h)
00071 #define dbmsghandle(h) dbmsghandle((DBMSGHANDLE_PROC) h)
00072 #endif
00073
00075
00076 const char DB_FREETDS_SQL_ESCAPE_CHARACTER = '\\';
00077
00078
00079 class DB_FREETDS_CLASS_STYLE common_database_support
00080 {
00081 public:
00082 static bool _error_was_seen;
00084
00087
00088 static int syb_msg_handler(DBPROCESS *dbproc, DBINT msgno,
00089 int msgstate, int severity, char *msgtext, char *srvname, char *procname,
00090 int line);
00091
00092 static int syb_err_handler(DBPROCESS *dbproc, int severity, int dberr,
00093 int oserr, char *dberrstr, char *oserrstr);
00094
00096
00099 static void nerf_special_characters(istring &to_nerf, char escape_char);
00100
00101 };
00102
00103 #endif // outer guard.
00104