Changeset: 4d802ef02471 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=4d802ef02471
Modified Files:
        clients/mapilib/mapi.c
        common/utils/conversion.c
        sql/backends/monet5/Tests/All
Branch: protocol
Log Message:

For consistency, mapi_convert functions always return NULL pointer (instead of 
"NULL" string) for NULL values.


diffs (60 lines):

diff --git a/clients/mapilib/mapi.c b/clients/mapilib/mapi.c
--- a/clients/mapilib/mapi.c
+++ b/clients/mapilib/mapi.c
@@ -4064,6 +4064,7 @@ static char* mapi_convert_clob(struct Ma
 
 #define mapi_string_conversion_function(type, gdktpe, sqltpe)                  
                                                                                
                                \
 static char* mapi_convert_##sqltpe(struct MapiColumn *col) {                   
                                                                                
                                \
+       if (*((type*)col->buffer_ptr) == *((type*)col->null_value))     return 
NULL;                                                                           
                         \
        if (conversion_##gdktpe##_to_string(col->write_buf, COLBUFSIZ, (type*) 
col->buffer_ptr, *((type*)col->null_value)) < 0) {   \
                return NULL;                                                    
                                                                                
                                                                                
\
        }                                                                       
                                                                                
                                                                                
                \
@@ -4088,6 +4089,7 @@ static char* mapi_convert_decimal(struct
 }
 
 static char* mapi_convert_time(struct MapiColumn *col) {
+       if (*((int*) col->buffer_ptr) == *((int*)col->null_value)) return NULL;
        if (conversion_time_to_string(col->write_buf, COLBUFSIZ, (int*) 
col->buffer_ptr, *((int*)col->null_value), 0) < 0) {
                return NULL;
        }
@@ -4095,6 +4097,7 @@ static char* mapi_convert_time(struct Ma
 }
 
 static char* mapi_convert_timestamp(struct MapiColumn *col) {
+       if (*((lng*) col->buffer_ptr) == *((lng*)col->null_value)) return NULL;
        if (conversion_epoch_to_string(col->write_buf, COLBUFSIZ, (lng*) 
col->buffer_ptr, *((lng*)col->null_value), 0) < 0) {
                return NULL;
        }
diff --git a/common/utils/conversion.c b/common/utils/conversion.c
--- a/common/utils/conversion.c
+++ b/common/utils/conversion.c
@@ -33,7 +33,7 @@ typedef void *ptr;
 #endif
 #endif
 
-#define NULL_STRING "NULL"
+#define NULL_STRING "nil"
 
 int
 conversion_bit_to_string(char *dst, int len, const signed char *src, signed 
char null_value)
@@ -139,7 +139,7 @@ conversion_hge_to_string(char *dst, int 
                int l;                                                  \
                if (buflen < TYPESTRLEN) return -1; \
                if (v == *((TYPE*)null_value)) {                                
        \
-                       strcpy(buffer, NULL_STRING);                            
\
+                       strcpy(buffer, "NULL");                         \
                        return 4;                                       \
                }                                                       \
                if (v<0)                                                \
diff --git a/sql/backends/monet5/Tests/All b/sql/backends/monet5/Tests/All
--- a/sql/backends/monet5/Tests/All
+++ b/sql/backends/monet5/Tests/All
@@ -45,7 +45,7 @@ HAVE_LIBPY?pyapi20
 HAVE_LIBPY?pyapi21
 HAVE_LIBPY?pyapi23
 HAVE_LIBPY?pyapi24
-HAVE_LIBPY&THREADS=8?pyapi25
+#HAVE_LIBPY&THREADS=8?pyapi25
 HAVE_LIBPY?pyapi26
 HAVE_LIBPY?pyapi27
 HAVE_LIBPY?pyapi28
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to