FreeTDS API: include/tdsconvert.h Source File

- Main Page
- Related Pages
- Modules
- Classes
- Files

- File List
- File Members

# include/tdsconvert.h

    00001 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases
    00002  * Copyright (C) 1998-1999  Brian Bruns
    00003  *
    00004  * This library is free software; you can redistribute it and/or
    00005  * modify it under the terms of the GNU Library General Public
    00006  * License as published by the Free Software Foundation; either
    00007  * version 2 of the License, or (at your option) any later version.
    00008  *
    00009  * This library is distributed in the hope that it will be useful,
    00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00012  * Library General Public License for more details.
    00013  *
    00014  * You should have received a copy of the GNU Library General Public
    00015  * License along with this library; if not, write to the
    00016  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    00017  * Boston, MA 02111-1307, USA.
    00018  */
    00019
    00020 #ifndef _tdsconvert_h_
    00021 #define _tdsconvert_h_
    00022
    00023 #if defined(__GNUC__) && __GNUC__ >= 4 && !defined(__MINGW32__)
    00024 #pragma GCC visibility push(hidden)
    00025 #endif
    00026
    00027 #ifdef __cplusplus
    00028 extern "C"
    00029 {
    00030 #if 0
    00031 }
    00032 #endif
    00033 #endif
    00034
    00035 /* $Id: tdsconvert.h,v 1.26 2010-01-25 23:05:58 freddy77 Exp $ */
    00036
    00037 typedef union conv_result
    00038 {
    00039         TDS_TINYINT ti;
    00040         TDS_SMALLINT si;
    00041         TDS_INT i;
    00042         TDS_INT8 bi;
    00043         TDS_FLOAT f;
    00044         TDS_REAL r;
    00045         TDS_CHAR *c;
    00046         TDS_MONEY m;
    00047         TDS_MONEY4 m4;
    00048         TDS_DATETIME dt;
    00049         TDS_DATETIME4 dt4;
    00050         TDS_NUMERIC n;
    00051         TDS_CHAR *ib;
    00052         TDS_UNIQUE u;
    00053         /* sizef types */
    00054         struct cc_t {
    00055                 TDS_CHAR *c;
    00056                 TDS_UINT len;
    00057         } cc;
    00058         struct cb_t {
    00059                 TDS_CHAR *ib;
    00060                 TDS_UINT len;
    00061         } cb;
    00062 }
    00063 CONV_RESULT;
    00064
    00065 /*
    00066  * Failure return codes for tds_convert()
    00067  */
    00068 #define TDS_CONVERT_FAIL        -1      /* unspecified failure */
    00069 #define TDS_CONVERT_NOAVAIL     -2      /* conversion does not exist */
    00070 #define TDS_CONVERT_SYNTAX      -3      /* syntax error in source field */
    00071 #define TDS_CONVERT_NOMEM       -4      /* insufficient memory */
    00072 #define TDS_CONVERT_OVERFLOW    -5      /* result too large */
    00073
    00074 /* sized types */
    00075 #define TDS_CONVERT_CHAR        256
    00076 #define TDS_CONVERT_BINARY      257
    00077
    00078 struct tds_time
    00079 {
    00080         int tm_year;
    00081         int tm_mon;
    00082         int tm_mday;
    00083         int tm_hour;
    00084         int tm_min;
    00085         int tm_sec;
    00086         int tm_ms;
    00087 };
    00088
    00089 unsigned char tds_willconvert(int srctype, int desttype);
    00090
    00091 TDS_INT tds_get_null_type(int srctype);
    00092 TDS_INT tds_char2hex(TDS_CHAR *dest, TDS_UINT destlen, const TDS_CHAR * src, TDS_UINT srclen);
    00093 TDS_INT tds_convert(const TDSCONTEXT * context, int srctype, const TDS_CHAR * src, TDS_UINT srclen, int desttype, CONV_RESULT * cr);
    00094
    00095 size_t tds_strftime(char *buf, size_t maxsize, const char *format, const TDSDATEREC * timeptr);
    00096
    00097 #ifdef __cplusplus
    00098 #if 0
    00099 {
    00100 #endif
    00101 }
    00102 #endif
    00103
    00104 #if defined(__GNUC__) && __GNUC__ >= 4 && !defined(__MINGW32__)
    00105 #pragma GCC visibility pop
    00106 #endif
    00107
    00108 #endif /* _tdsconvert_h_ */

All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines