NCBI C++ ToolKit
convert.h
Go to the documentation of this file.

Go to the SVN repository for this file.

1 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases
2  * Copyright (C) 1998-1999 Brian Bruns
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19 
20 #ifndef _tdsconvert_h_
21 #define _tdsconvert_h_
22 
23 #include <freetds/pushvis.h>
24 
25 #ifdef __cplusplus
26 extern "C"
27 {
28 #if 0
29 }
30 #endif
31 #endif
32 
33 typedef union conv_result
34 {
35  /* fixed */
56 
57  /* variable */
60 
61  /* sized buffer types */
62  struct cc_t {
65  } cc;
66  struct cb_t {
69  } cb;
70 }
72 
73 /*
74  * Failure return codes for tds_convert()
75  */
76 #define TDS_CONVERT_FAIL -1 /* unspecified failure */
77 #define TDS_CONVERT_NOAVAIL -2 /* conversion does not exist */
78 #define TDS_CONVERT_SYNTAX -3 /* syntax error in source field */
79 #define TDS_CONVERT_NOMEM -4 /* insufficient memory */
80 #define TDS_CONVERT_OVERFLOW -5 /* result too large */
81 
82 /* sized types */
83 #define TDS_CONVERT_CHAR 256
84 #define TDS_CONVERT_BINARY 257
85 
86 unsigned char tds_willconvert(int srctype, int desttype);
87 
89 ssize_t tds_char2hex(TDS_CHAR *dest, size_t destlen,
90  const TDS_CHAR * src, size_t srclen);
91 TDS_INT tds_convert(const TDSCONTEXT * context, int srctype, const TDS_CHAR * src, TDS_UINT srclen, int desttype, CONV_RESULT * cr);
92 
93 size_t tds_strftime(char *buf, size_t maxsize, const char *format, const TDSDATEREC * timeptr, int prec);
94 
95 #ifdef __cplusplus
96 #if 0
97 {
98 #endif
99 }
100 #endif
101 
102 #include <freetds/popvis.h>
103 
104 #endif /* _tdsconvert_h_ */
union conv_result CONV_RESULT
TDS_UINT8 TDS_BIGTIME
Definition: proto.h:72
TDS_SERVER_TYPE
Definition: proto.h:161
TDS_UINT8 TDS_BIGDATETIME
Definition: proto.h:73
TDS_INT TDS_DATE
Definition: proto.h:69
TDS_INT TDS_TIME
Definition: proto.h:70
tds_sysdep_int32_type TDS_INT
Definition: tds.h:149
tds_sysdep_real64_type TDS_FLOAT
Definition: tds.h:152
tds_sysdep_int64_type TDS_INT8
Definition: tds.h:153
tds_sysdep_real32_type TDS_REAL
Definition: tds.h:151
unsigned char TDS_TINYINT
Definition: tds.h:146
tds_sysdep_int16_type TDS_SMALLINT
Definition: tds.h:147
char TDS_CHAR
Definition: tds.h:144
tds_sysdep_uint64_type TDS_UINT8
Definition: tds.h:154
tds_sysdep_uint16_type TDS_USMALLINT
Definition: tds.h:148
tds_sysdep_uint32_type TDS_UINT
Definition: tds.h:150
TDS_SERVER_TYPE tds_get_null_type(TDS_SERVER_TYPE srctype)
Get same type but nullable.
Definition: convert.c:2942
unsigned char tds_willconvert(int srctype, int desttype)
Test if a conversion is possible.
Definition: convert.c:3124
size_t tds_strftime(char *buf, size_t maxsize, const char *format, const TDSDATEREC *timeptr, int prec)
format a date string according to an "extended" strftime(3) formatting definition.
Definition: convert.c:3008
ssize_t tds_char2hex(TDS_CHAR *dest, size_t destlen, const TDS_CHAR *src, size_t srclen)
Definition: convert.c:310
TDS_INT tds_convert(const TDSCONTEXT *context, int srctype, const TDS_CHAR *src, TDS_UINT srclen, int desttype, CONV_RESULT *cr)
tds_convert convert a type to another.
Definition: convert.c:1882
char * buf
int ssize_t
Definition: ncbiconf_msvc.h:93
static Format format
Definition: njn_ioutil.cpp:53
this structure is not directed connected to a TDS protocol but keeps any DATE/TIME information.
Definition: tds.h:167
TDS_UINT len
Definition: convert.h:68
TDS_CHAR * ib
Definition: convert.h:67
TDS_CHAR * c
Definition: convert.h:63
TDS_UINT len
Definition: convert.h:64
Used by tds_datecrack.
Definition: tds.h:180
TDS_TINYINT ti
Definition: convert.h:36
TDS_BIGTIME bigtime
Definition: convert.h:52
TDS_CHAR * ib
Definition: convert.h:59
TDS_UINT ui
Definition: convert.h:40
TDS_DATETIMEALL dta
Definition: convert.h:49
TDS_DATETIME dt
Definition: convert.h:47
TDS_DATE date
Definition: convert.h:51
TDS_SMALLINT si
Definition: convert.h:37
TDS_INT i
Definition: convert.h:39
struct conv_result::cb_t cb
TDS_USMALLINT usi
Definition: convert.h:38
TDS_NUMERIC n
Definition: convert.h:54
TDS_UINT8 ubi
Definition: convert.h:42
TDS_UNIQUE u
Definition: convert.h:55
struct conv_result::cc_t cc
TDS_MONEY m
Definition: convert.h:45
TDS_INT8 bi
Definition: convert.h:41
TDS_REAL r
Definition: convert.h:44
TDS_MONEY4 m4
Definition: convert.h:46
TDS_BIGDATETIME bigdatetime
Definition: convert.h:53
TDS_TIME time
Definition: convert.h:50
TDS_FLOAT f
Definition: convert.h:43
TDS_CHAR * c
Definition: convert.h:58
TDS_DATETIME4 dt4
Definition: convert.h:48
Definition: proto.h:39
static CS_CONTEXT * context
Definition: will_convert.c:21
Modified on Tue May 28 05:53:26 2024 by modify_doxy.py rev. 669887