Changeset: bd450bf4fae1 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/bd450bf4fae1
Modified Files:
        sql/server/sql_datetime.c
        sql/test/odbc-escape-sequences/Tests/time-date-interval-functions.test
Branch: default
Log Message:

small fixes for odbc_interval handling


diffs (46 lines):

diff --git a/sql/server/sql_datetime.c b/sql/server/sql_datetime.c
--- a/sql/server/sql_datetime.c
+++ b/sql/server/sql_datetime.c
@@ -484,15 +484,15 @@ int
 process_odbc_interval(mvc *sql, itype interval, int val, sql_subtype *t, lng 
*i)
 {
        assert(sql);
-       int mul = 1;
+       lng mul = 1;
        int d = inttype2digits(interval, interval);
        switch (interval) {
                case iyear:
                        mul *= 12;
-                       /* fall through */
+                       break;
                case iquarter:
                        mul *= 3;
-                       /* fall through */
+                       break;
                case imonth:
                        break;
                case iweek:
@@ -505,9 +505,10 @@ process_odbc_interval(mvc *sql, itype in
                        mul *= 60;
                        /* fall through */
                case imin:
-                       mul *= 60000;
+                       mul *= 60;
                        /* fall through */
                case isec:
+                       mul *= 1000;
                        break;
                default:
                        snprintf(sql->errstr, ERRSIZE, _("Internal error: bad 
interval qualifier (%d)\n"), interval);
diff --git 
a/sql/test/odbc-escape-sequences/Tests/time-date-interval-functions.test 
b/sql/test/odbc-escape-sequences/Tests/time-date-interval-functions.test
--- a/sql/test/odbc-escape-sequences/Tests/time-date-interval-functions.test
+++ b/sql/test/odbc-escape-sequences/Tests/time-date-interval-functions.test
@@ -260,7 +260,7 @@ 2222
 query T rowsort
 select {fn timestampadd(SQL_TSI_HOUR, 10, {ts '2022-11-14 14:13:12.654321'}) }
 ----
-2022-11-15 00:13:12
+2022-11-15 00:13:12.654321
 
 # corner cases
 query T rowsort
_______________________________________________
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org

Reply via email to