Main Page Modules Compound List File List Compound Members File Members Related Pages

# 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 #ifdef __cplusplus
    00024 extern "C"
    00025 {
    00026 #if 0
    00027 }
    00028 #endif
    00029 #endif
    00030
    00031 static const char rcsid_tdsconvert_h[] = "$Id: tdsconvert.h,v 1.20 2004/10/28 12:42:12 freddy77 Exp $";
    00032 static const void *const no_unused_tdsconvert_h_warn[] = { rcsid_tdsconvert_h, no_unused_tdsconvert_h_warn };
    00033
    00034 typedef union conv_result
    00035 {
    00036         TDS_TINYINT ti;
    00037         TDS_SMALLINT si;
    00038         TDS_INT i;
    00039         TDS_INT8 bi;
    00040         TDS_FLOAT f;
    00041         TDS_REAL r;
    00042         TDS_CHAR *c;
    00043         TDS_MONEY m;
    00044         TDS_MONEY4 m4;
    00045         TDS_DATETIME dt;
    00046         TDS_DATETIME4 dt4;
    00047         TDS_NUMERIC n;
    00048         TDS_CHAR *ib;
    00049         TDS_UNIQUE u;
    00050 }
    00051 CONV_RESULT;
    00052
    00053 /*
    00054  * Failure return codes for tds_convert()
    00055  */
    00056 #define TDS_CONVERT_FAIL        -1      /* unspecified failure */
    00057 #define TDS_CONVERT_NOAVAIL     -2      /* conversion does not exist */
    00058 #define TDS_CONVERT_SYNTAX      -3      /* syntax error in source field */
    00059 #define TDS_CONVERT_NOMEM       -4      /* insufficient memory */
    00060 #define TDS_CONVERT_OVERFLOW    -5      /* result too large */
    00061
    00062 struct tds_time
    00063 {
    00064         int tm_year;
    00065         int tm_mon;
    00066         int tm_mday;
    00067         int tm_hour;
    00068         int tm_min;
    00069         int tm_sec;
    00070         int tm_ms;
    00071 };
    00072
    00073 unsigned char tds_willconvert(int srctype, int desttype);
    00074
    00075 TDS_INT tds_get_null_type(int srctype);
    00076 TDS_INT tds_convert(TDSCONTEXT * context, int srctype, const TDS_CHAR * src, TDS_UINT srclen, int desttype, CONV_RESULT * cr);
    00077
    00078 size_t tds_strftime(char *buf, size_t maxsize, const char *format, const TDSDATEREC * timeptr);
    00079
    00080 #ifdef __cplusplus
    00081 #if 0
    00082 {
    00083 #endif
    00084 }
    00085 #endif
    00086
    00087 #endif /* _tdsconvert_h_ */