Changeset: 0190b26285e6 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=0190b26285e6
Modified Files:
        sql/server/sql_atom.c
Branch: default
Log Message:

handle atom_cast string 2 temporal types


diffs (29 lines):

diff --git a/sql/server/sql_atom.c b/sql/server/sql_atom.c
--- a/sql/server/sql_atom.c
+++ b/sql/server/sql_atom.c
@@ -1099,6 +1099,25 @@ atom_cast(atom *a, sql_subtype *tp)
                        a->data.vtype = tp->type->localtype;
                        return 1;
                }
+               if (at->type->eclass == EC_CHAR && EC_TEMP(tp->type->eclass)) {
+                       int type = tp->type->localtype, res = 0;
+                       ptr p = NULL;
+                               
+                       a->data.len = 0;
+                       res = ATOMfromstr(type, &p, &a->data.len, 
a->data.val.sval);
+                       /* no result or nil means error (SQL has NULL not nil) 
*/
+                       if (res < 0 || !p || ATOMcmp(type, p, ATOMnilptr(type)) 
== 0) {
+                               if (p)
+                                       GDKfree(p);
+                               a->data.len = strlen(a->data.val.sval);
+                               return 0;
+                       }
+                       a->tpe = *tp;
+                       a->data.vtype = type;
+                       VALset(&a->data, a->data.vtype, p);
+                       if (p && ATOMextern(a->data.vtype) == 0)
+                               GDKfree(p);
+               }       
        } else {
                ptr p = NULL;
 
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to