aboutsummaryrefslogtreecommitdiff
path: root/odb/mssql/mssql-fwd.hxx
blob: 3579403f55d82631f457e8147e31da11a4b321c2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
// file      : odb/mssql/mssql-fwd.hxx
// author    : Boris Kolpackov <boris@codesynthesis.com>
// copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC
// license   : GNU GPL v2; see accompanying LICENSE file

#ifndef ODB_MSSQL_MSSQL_FWD_HXX
#define ODB_MSSQL_MSSQL_FWD_HXX

#include <odb/pre.hxx>

#include <cstddef> // std::size_t

// Forward declaration for some of the types defined in sqltypes.h or
// sqlncli.h. This allows us to avoid having to include these files
// in public headers.
//
#ifdef _WIN32

// Keep consistent with Windows ODBC headers.
//

typedef long             SQLINTEGER;
typedef unsigned long    SQLUINTEGER;

#ifdef _WIN64
typedef __int64          SQLLEN;
typedef unsigned __int64 SQLULEN;
#else
#ifndef SQLLEN
typedef SQLINTEGER       SQLLEN;
typedef SQLUINTEGER      SQLULEN;
#endif
#endif

#else // _WIN32

// Keep consistent with unixODBC headers.
//

template <std::size_t sizeof_long>
struct odbc_types;

template <>
struct odbc_types<4>
{
  typedef long           integer;
  typedef unsigned long  uinteger;

  typedef integer        len;
  typedef uinteger       ulen;
};

template <>
struct odbc_types<8>
{
  typedef int            integer;
  typedef unsigned int   uinteger;

  typedef long           len;
  typedef unsigned long  ulen;
};

typedef odbc_types<sizeof (long)>::integer  SQLINTEGER;
typedef odbc_types<sizeof (long)>::uinteger SQLUINTEGER;

#ifndef SQLLEN
typedef odbc_types<sizeof (long)>::len  SQLLEN;
typedef odbc_types<sizeof (long)>::ulen SQLULEN;
#endif

#endif // _WIN32

typedef short            SQLSMALLINT;
typedef unsigned short   SQLUSMALLINT;

typedef SQLSMALLINT      SQLRETURN;

typedef void*            SQLHANDLE;
typedef SQLHANDLE        SQLHENV;
typedef SQLHANDLE        SQLHDBC;
typedef SQLHANDLE        SQLHSTMT;
typedef SQLHANDLE        SQLHDESC;

// If you get a redefinition error or warning for one of these macros,
// then that means you included this header (or one that includes it),
// before <sql.h> or <sqlext.h>. As a general rule, include <sql.h> or
// <sqlext.h> before any of the ODB headers.
//
#ifndef SQL_HANDLE_ENV
#  define SQL_HANDLE_ENV  1
#  define SQL_HANDLE_DBC  2
#  define SQL_HANDLE_STMT 3
#  define SQL_HANDLE_DESC 4
#endif

#include <odb/post.hxx>

#endif // ODB_MSSQL_MSSQL_FWD_HXX