freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
[ freetds-Patches-591064 ] convert.c - bit and money
- From: noreply AT sourceforge.net
- To: noreply AT sourceforge.net
- Subject: [ freetds-Patches-591064 ] convert.c - bit and money
- Date: Mon, 05 Aug 2002 05:44:54 -0700
Patches item #591064, was opened at 2002-08-05 14:44
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=407808&aid=591064&group_id=33106
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Frediano Ziglio (freddy77)
Assigned to: Nobody/Anonymous (nobody)
Summary: convert.c - bit and money
Initial Comment:
This patch add conversion from int1/2/4 to bit and to
money and do some trivial cleanup
Index: convert.c
=========================================
==========================
RCS file: /cvsroot/freetds/freetds/src/tds/convert.c,v
retrieving revision 1.30
diff -u -r1.30 convert.c
--- convert.c 4 Aug 2002 19:55:48 -0000
1.30
+++ convert.c 5 Aug 2002 12:38:31 -0000
@@ -71,7 +71,6 @@
#define test_alloc(x) {if ((x)==NULL) return TDS_FAIL;}
extern int g__numeric_bytes_per_prec[];
-extern int (*g_tds_err_handler)(void*);
int tds_get_conversion_type(int srctype, int colsize)
{
if (srctype == SYBINTN) {
@@ -483,6 +482,10 @@
cr->i = buf;
return 4;
break;
+ case SYBBIT:
+ case SYBBITN:
+ cr->ti = buf ? 1 : 0;
+ return 1;
case SYBFLT8:
cr->f = buf;
return 8;
@@ -491,6 +494,12 @@
cr->r = buf;
return 4;
break;
+ case SYBMONEY4:
+ cr->m4.mny4 = buf *
10000;
+ return 4;
+ case SYBMONEY:
+ cr->m.mny = buf *
10000;
+ return 8;
default:
fprintf(stderr,"error_handler: conversion from %d
to %d not supported\n", srctype, desttype);
return TDS_FAIL;
@@ -515,6 +524,8 @@
return strlen(tmp_str);
break;
case SYBINT1:
+ if (buf > 255 || buf < 0)
+ return
TDS_FAIL;
cr->ti = buf;
return 1;
break;
@@ -526,6 +537,10 @@
cr->i = buf;
return 4;
break;
+ case SYBBIT:
+ case SYBBITN:
+ cr->ti = buf ? 1 : 0;
+ return 1;
case SYBFLT8:
cr->f = buf;
return 8;
@@ -534,6 +549,12 @@
cr->r = buf;
return 4;
break;
+ case SYBMONEY4:
+ cr->m4.mny4 = buf *
10000;
+ return 4;
+ case SYBMONEY:
+ cr->m.mny = buf *
10000;
+ return 8;
default:
fprintf(stderr,"error_handler: conversion from %d
to %d not supported\n", srctype, desttype);
return TDS_FAIL;
@@ -558,10 +579,14 @@
return strlen(tmp_str);
break;
case SYBINT1:
+ if (buf > 255 || buf < 0)
+ return
TDS_FAIL;
cr->ti = buf;
return 1;
break;
case SYBINT2:
+ if (buf > 32767 || buf < -
32768)
+ return
TDS_FAIL;
cr->si = buf;
return 2;
break;
@@ -569,6 +594,10 @@
cr->i = buf;
return 4;
break;
+ case SYBBIT:
+ case SYBBITN:
+ cr->ti = buf ? 1 : 0;
+ return 1;
case SYBFLT8:
cr->f = buf;
return 8;
@@ -577,6 +606,14 @@
cr->r = buf;
return 4;
break;
+ case SYBMONEY4:
+ if (buf > 214748 || buf
< -214748)
+ return
TDS_FAIL;
+ cr->m4.mny4 = buf *
10000;
+ return 4;
+ case SYBMONEY:
+ cr->m.mny =
(TDS_INT8)buf * 10000;
+ return 8;
default:
fprintf(stderr,"error_handler: conversion from %d
to %d not supported\n", srctype, desttype);
return TDS_FAIL;
@@ -743,8 +780,6 @@
char whole_date_string[30];
struct tds_tm when;
-TDS_INT ret;
-
switch(desttype) {
case SYBCHAR:
case SYBVARCHAR:
@@ -1034,6 +1069,7 @@
}
}
+static TDS_INT
tds_convert_unique(int srctype,TDS_CHAR *src,
TDS_INT srclen,
int desttype,TDS_INT destlen,
CONV_RESULT *cr)
{
freddy77
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=407808&aid=591064&group_id=33106
- [ freetds-Patches-591064 ] convert.c - bit and money, noreply, 08/05/2002
Archive powered by MHonArc 2.6.24.