00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef IXE_SQL_H
00025 #define IXE_SQL_H
00026
00027
00028 #include "platform.h"
00029
00030
00031 #include <sys/types.h>
00032
00033 namespace IXE {
00034
00035
00036
00037
00038 typedef signed char int1;
00039 typedef unsigned char nat1;
00040
00041 typedef signed short int2;
00042 typedef unsigned short nat2;
00043
00044 typedef signed int int4;
00045 typedef unsigned int nat4;
00046
00047 typedef float real;
00048 typedef float real4;
00049 typedef double real8;
00050
00051 #ifdef _WIN32
00052 typedef unsigned __int64 nat8;
00053 typedef __int64 int8;
00054 #else
00055 # if SIZEOF_LONG == 8
00056 typedef unsigned long nat8;
00057 typedef signed long int8;
00058 # else
00059 typedef unsigned long long nat8;
00060 typedef signed long long int8;
00061 # endif
00062 #endif
00063
00064 typedef unsigned char uchar;
00065 typedef unsigned char uint8;
00066 typedef unsigned short uint16;
00067 typedef unsigned long ulong;
00068 #ifdef _MSC_VER
00069 typedef __int64 longlong;
00070 typedef unsigned __int64 ulonglong;
00071 typedef unsigned int uint;
00072 typedef unsigned short ushort;
00073 #else
00074 typedef long long longlong;
00075 typedef unsigned long long ulonglong;
00076 #endif
00077
00078
00079
00080
00081
00082 #ifdef WORDS_BIGENDIAN
00083
00084 #define int2get(A) (short)(((short)((uchar)(A)[0])) |\
00085 ((short)((short)(A)[1]) << 8))
00086 #define uint2get(A) (ushort)(((ushort)((uchar)(A)[0])) +\
00087 ((ushort)((uchar)(A)[1]) << 8))
00088 #define int2store(T,A) { uint _temp=(uint)(A) ;\
00089 *(uchar*)(T)=(uchar)(_temp); \
00090 *(uchar*)(T+1)=(uchar)((_temp >> 8)); }
00091 #define int3store(T,A) { *(T)=(char)(A);\
00092 *((T)+1)=(char)((A) >> 8);\
00093 *((T)+2)=(char)((A) >> 16); }
00094 #define int4get(A) (int)(((uint)(A)[0]) |\
00095 ((uint)(A)[1]) << 8 |\
00096 ((uint)(A)[2]) << 16 |\
00097 ((uint)(A)[3]) << 24)
00098 #define int4store(T,A) { *(T)=(char)(A);\
00099 *((T)+1)=(char)((A) >> 8);\
00100 *((T)+2)=(char)((A) >> 16);\
00101 *((T)+3)=(char)((A) >> 24); }
00102
00103 #define int8get(A) (longlong)((ulonglong)int4get(A) |\
00104 (ulonglong)int4get((A)+4) << 32)
00105 #define int8store(T,A) { uint __temp=(uint)(A), __temp2=(uint)((A) >> 32); \
00106 int4store(T, __temp); \
00107 int4store((T)+4, __temp2); }
00108 #else
00109
00110 #define int2get(A) (*(short*)(A))
00111 #define uint2get(A) (*(unsigned short*)(A))
00112 #define int2store(T,A) *((unsigned short*)(T))=(unsigned short)(A)
00113
00114 #define uint3get(A) (long)(*(unsigned long*)(A) & 0xFFFFFF)
00115 #define int3store(T,A) { *(T)=(uchar)(A);\
00116 *(T+1)=(uchar)((A) >> 8);\
00117 *(T+2)=(uchar)((A) >> 16); }
00118
00119 #define int4get(A) (*(long*)(A))
00120 #define uint4get(A) (*(unsigned long*)(A))
00121 #define int4store(T,A) *((long*)(T))=(long)(A)
00122
00123 #define int8get(A) (*(longlong*)(A))
00124 #define uint8get(A) (*(ulonglong*)(A))
00125 #define int8store(T,A) *((ulonglong*)(T))=(ulonglong)(A)
00126
00127 #define float4get(A) *((float*)(A))
00128 #define float4store(T,A) *((float*)(T))=(float)(A)
00129
00130 #define double4get(A) *((double*)(A))
00131 #define double4store(T,A) *((double*)(T))=(double)(A)
00132
00133 #endif // WORDS_BIGENDIAN
00134
00135 }
00136
00137 #endif // IXE_SQL_H