Changeset: bdd217b49f23 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=bdd217b49f23
Removed Files:
        common/utils/conversion.c
        common/utils/conversion.h
Modified Files:
        bootstrap
        clients/mapiclient/Tests/mclient--help.stable.err
        clients/mapilib/Makefile.ag
        clients/odbc/driver/ODBCConvert.c
        common/stream/stream.h
        common/utils/Makefile.ag
        configure.ag
        gdk/Makefile.ag
        gdk/gdk_atoms.c
        sql/backends/monet5/Makefile.ag
        sql/backends/monet5/Tests/All
        sql/backends/monet5/sql_result.c
        
sql/test/BugTracker-2015/Tests/crash_timestamp_convert.Bug-3816.stable.out
        sql/test/BugTracker-2016/Tests/convert-function-test.Bug-3460.stable.out
        
sql/test/BugTracker-2016/Tests/convert-function-test.Bug-3460.stable.out.int128
        
sql/test/BugTracker/Tests/rand_not_executed_for_every_row.SF-1723791.stable.out
        sql/test/bugs/Tests/object_name-bug-sf-985242.stable.out
        sql/test/mapi/Tests/utf8test.stable.out
        
sql/test/sys-schema/Tests/check_ForeignKey_referential_integrity.stable.out
        sql/test/sys-schema/Tests/check_PrimaryKey_uniqueness.stable.out
Branch: protocol
Log Message:

Remove unnecessary old code.


diffs (truncated from 1264 to 300 lines):

diff --git a/bootstrap b/bootstrap
--- a/bootstrap
+++ b/bootstrap
@@ -59,6 +59,3 @@ autoconf
 if [ -f buildtools/conf/install-sh -a ! -x buildtools/conf/install-sh ]; then
     chmod +x buildtools/conf/install-sh
 fi
-
-
-# protoc-c common/stream/mhapi.proto --c_out .
diff --git a/clients/mapiclient/Tests/mclient--help.stable.err 
b/clients/mapiclient/Tests/mclient--help.stable.err
--- a/clients/mapiclient/Tests/mclient--help.stable.err
+++ b/clients/mapiclient/Tests/mclient--help.stable.err
@@ -20,7 +20,7 @@ Options are:
  -e          | --echo            echo the query
  -E charset  | --encoding=charset specify encoding (character set) of the 
terminal
  -f kind     | --format=kind      specify output format {csv,tab,raw,sql,xml}
- -H          | --history          load/save cmdline history (default off)
+ -H          | --history         load/save cmdline history (default off)
  -i          | --interactive[=tm] interpret `\' commands on stdin, use time 
formatting {ms,s,m}
  -l language | --language=lang    {sql,mal}
  -L logfile  | --log=logfile     save client/server interaction
diff --git a/clients/mapilib/Makefile.ag b/clients/mapilib/Makefile.ag
--- a/clients/mapilib/Makefile.ag
+++ b/clients/mapilib/Makefile.ag
@@ -14,7 +14,6 @@ lib_mapi = {
        SOURCES = mapi.c mapi.rc
        LIBS = $(SOCKET_LIBS) ../../common/stream/libstream \
                ../../common/options/libmoptions \
-               ../../common/utils/libconversion \
                ../../common/utils/libmcrypt $(openssl_LIBS)
 }
 
diff --git a/clients/odbc/driver/ODBCConvert.c 
b/clients/odbc/driver/ODBCConvert.c
--- a/clients/odbc/driver/ODBCConvert.c
+++ b/clients/odbc/driver/ODBCConvert.c
@@ -1088,6 +1088,7 @@ ODBCFetch(ODBCStmt *stmt,
 
        /* see SQLExecute.c for possible types */
        switch (sql_type) {
+       case SQL_DECIMAL:
        case SQL_TINYINT:
        case SQL_SMALLINT:
        case SQL_INTEGER:
@@ -1138,7 +1139,6 @@ ODBCFetch(ODBCStmt *stmt,
                        break;
                }
                break;
-       case SQL_DECIMAL:
        case SQL_DOUBLE:
        case SQL_REAL:
                if (!parsedouble(data, &fval)) {
@@ -1338,6 +1338,7 @@ ODBCFetch(ODBCStmt *stmt,
                                *lenp = j;
                        break;
                }
+               case SQL_DECIMAL:
                case SQL_TINYINT:
                case SQL_SMALLINT:
                case SQL_INTEGER:
@@ -1376,7 +1377,6 @@ ODBCFetch(ODBCStmt *stmt,
                        }
                        break;
                }
-               case SQL_DECIMAL:
                case SQL_DOUBLE:
                case SQL_REAL: {
                        data = (char *) ptr;
diff --git a/common/stream/stream.h b/common/stream/stream.h
--- a/common/stream/stream.h
+++ b/common/stream/stream.h
@@ -282,16 +282,6 @@ stream_export void bstream_destroy(bstre
 stream_export ssize_t bstream_read(bstream *s, size_t size);
 stream_export ssize_t bstream_next(bstream *s);
 
-/* Byte stream is a simple stream that sends a chunk of bytes prefixed
-   with a 64-bit integer describing the length of the chunk.
-
-   The maximum length of the byte stream must be specified upon
-   creation.
- */
-
-
-
-
 typedef enum mnstr_errors {
        MNSTR_NO__ERROR = 0,
        MNSTR_OPEN_ERROR,
diff --git a/common/utils/Makefile.ag b/common/utils/Makefile.ag
--- a/common/utils/Makefile.ag
+++ b/common/utils/Makefile.ag
@@ -30,9 +30,4 @@ lib_msabaoth = {
        SOURCES = msabaoth.h msabaoth.c
 }
 
-lib_conversion = {
-       NOINST
-       SOURCES = conversion.h conversion.c
-}
-
 EXTRA_DIST = s_nextafterf.c math_private.h strptime.c
diff --git a/common/utils/conversion.c b/common/utils/conversion.c
deleted file mode 100644
--- a/common/utils/conversion.c
+++ /dev/null
@@ -1,444 +0,0 @@
-
-#include "conversion.h"
-#include <string.h>
-
-typedef signed char bit;
-typedef signed char bte;
-typedef short sht;
-typedef size_t oid;
-typedef float flt;
-typedef double dbl;
-typedef char *str;
-typedef void *ptr;
-
-#if SIZEOF_INT==8
-#      define LL_CONSTANT(val) (val)
-#elif SIZEOF_LONG==8
-#      define LL_CONSTANT(val) (val##L)
-#elif defined(HAVE_LONG_LONG)
-#      define LL_CONSTANT(val) (val##LL)
-#elif defined(HAVE___INT64)
-#      define LL_CONSTANT(val) (val##i64)
-#endif
-
-#include <limits.h>            /* for *_MIN and *_MAX */
-#include <float.h>             /* for FLT_MAX and DBL_MAX */
-#ifndef LLONG_MAX
-#ifdef LONGLONG_MAX
-#define LLONG_MAX LONGLONG_MAX
-#define LLONG_MIN LONGLONG_MIN
-#else
-#define LLONG_MAX LL_CONSTANT(9223372036854775807)
-#define LLONG_MIN (-LL_CONSTANT(9223372036854775807) - LL_CONSTANT(1))
-#endif
-#endif
-
-#define NULL_STRING "nil"
-
-int
-conversion_bit_to_string(char *dst, int len, const signed char *src, signed 
char null_value)
-{
-       if (len < 6) return -1;
-
-       if (*src == null_value)
-               return snprintf(dst, len, NULL_STRING);
-       if (*src)
-               return snprintf(dst, len, "true");
-       return snprintf(dst, len, "false");
-}
-
-
-#define atomtostr(TYPE, FMT, FMTCAST)                  \
-int                             \
-conversion_##TYPE##_to_string(char *dst, int len, const TYPE *src, TYPE 
nullvalue)     \
-{                                                      \
-       if (len < TYPE##Strlen) return -1;                      \
-       if (*src == nullvalue) {                        \
-               return snprintf(dst, len, NULL_STRING); \
-       }                                               \
-       return snprintf(dst, len, FMT, FMTCAST *src);   \
-}
-
-atomtostr(bte, "%hhd", )
-atomtostr(sht, "%hd", )
-atomtostr(int, "%d", )
-atomtostr(lng, LLFMT, )
-atomtostr(ptr, PTRFMT, PTRFMTCAST)
-
-int conversion_dbl_to_string(char *dst, int len, const double *src, double 
null_value) {
-       int i;
-
-       if (len < dblStrlen) return -1;
-       if (*src == null_value) {
-               return snprintf(dst, len, NULL_STRING);
-       }
-       for (i = 4; i < 18; i++) {
-               snprintf(dst, len, "%.*g", i, *src);
-               if (strtod(dst, NULL) == *src)
-                       break;
-       }
-       return (int) strlen(dst);
-}
-
-int
-conversion_flt_to_string(char *dst, int len, const float *src, float 
null_value) {
-       int i;
-
-       if (len < fltStrlen) return -1;
-       if (*src == null_value) {
-               return snprintf(dst, len, NULL_STRING);
-       }
-       for (i = 4; i < 10; i++) {
-               snprintf(dst, len, "%.*g", i, *src);
-#ifdef HAVE_STRTOF
-               if (strtof(dst, NULL) == *src)
-                       break;
-#else
-               if ((float) strtod(dst, NULL) == *src)
-                       break;
-#endif
-       }
-       return (int) strlen(dst);
-}
-
-#ifdef HAVE_HGE
-#ifdef WIN32
-#define HGE_LL018FMT "%018I64d"
-#else
-#define HGE_LL018FMT "%018lld"
-#endif
-#define HGE_LL18DIGITS LL_CONSTANT(1000000000000000000)
-#define HGE_ABS(a) (((a) < 0) ? -(a) : (a))
-int
-conversion_hge_to_string(char *dst, int len, const hge *src, hge null_value)
-{
-       if (len < hgeStrlen) return -1;
-       if (*src == null_value) {
-               strncpy(dst, NULL_STRING, len);
-               return 3;
-       }
-       if ((hge) LLONG_MIN < *src && *src <= (hge) LLONG_MAX) {
-               lng s = (lng) *src;
-               return conversion_lng_to_string(dst, len, &s, LLONG_MIN);
-       } else {
-               hge s = *src / HGE_LL18DIGITS;
-               int l = conversion_hge_to_string(dst, len, &s, null_value);
-               snprintf(dst + l, len - l, HGE_LL018FMT, (lng) HGE_ABS(*src % 
HGE_LL18DIGITS));
-               return (int) strlen(dst);
-       }
-}
-#endif
-
-
-#define DEC_TOSTR(TYPE,TYPESTRLEN)                                             
        \
-       do {                                                            \
-               char buf[64];                                           \
-               TYPE v = *(const TYPE *) value;                         \
-               int cur = 63, i, done = 0;                              \
-               int neg = v < 0;                                        \
-               int l;                                                  \
-               if (buflen < TYPESTRLEN) return -1; \
-               if (v == *((TYPE*)null_value)) {                                
        \
-                       strcpy(buffer, "NULL");                         \
-                       return 4;                                       \
-               }                                                       \
-               if (v<0)                                                \
-                       v = -v;                                         \
-               buf[cur--] = 0;                                         \
-               if (scale){                                             \
-                       for (i=0; i<scale; i++) {                       \
-                               buf[cur--] = (char) (v%10 + '0');       \
-                               v /= 10;                                \
-                       }                                               \
-                       buf[cur--] = '.';                               \
-               }                                                       \
-               while (v) {                                             \
-                       buf[cur--] = (char ) (v%10 + '0');              \
-                       v /= 10;                                        \
-                       done = 1;                                       \
-               }                                                       \
-               if (!done)                                              \
-                       buf[cur--] = '0';                               \
-               if (neg)                                                \
-                       buf[cur--] = '-';                               \
-               l = (64-cur-1);                                         \
-               strcpy(buffer, buf+cur+1);                              \
-               return l - 1;                                           \
-       } while (0)
-
-int 
-conversion_decimal_to_string(const void *value, char *buffer, int buflen, int 
scale, int typelen, const void *null_value) {
-       /* support dec map to bte, sht, int and lng */
-       if (typelen == 1) {
-               DEC_TOSTR(bte, bteStrlen + 1);
-       } else if (typelen == 2) {
-               DEC_TOSTR(sht, shtStrlen + 1);
-       } else if (typelen == 4) {
-               DEC_TOSTR(int, intStrlen + 1);
-       } else if (typelen == 8) {
-               DEC_TOSTR(lng, lngStrlen + 1);
-#ifdef HAVE_HGE
-       } else if (typelen == 16) {
-               DEC_TOSTR(hge, hgeStrlen + 1);
-#endif
-       } else {
-               return -1;
-               //GDKerror("Decimal cannot be mapped to %s\n", ATOMname(type));
-       }
-       return 0;
-}
-
-// date and daytime
-// part of the code here is copied from `mtime.c`
-
-#define leapyear(y)            ((y) % 4 == 0 && ((y) % 100 != 0 || (y) % 400 
== 0))
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to