~fallenpegasus/drizzle/returning

« back to all changes in this revision

Viewing changes to drizzled/function/time/year.cc

  • Committer: Brian Aker
  • Date: 2009-01-29 20:05:14 UTC
  • mfrom: (813.1.14 new-temporal)
  • mto: This revision was merged to the branch mainline in revision 821.
  • Revision ID: brian@tangent.org-20090129200514-84zoh7uc7bln6x0b
Merge Jay

Show diffs side-by-side

added added

removed removed

Lines of Context:
42
42
  {
43
43
    case STRING_RESULT:
44
44
      {
45
 
        char buff[40];
 
45
        char buff[DRIZZLE_MAX_LENGTH_DATETIME_AS_STRING];
46
46
        String tmp(buff,sizeof(buff), &my_charset_utf8_bin);
47
47
        String *res= args[0]->val_str(&tmp);
48
48
        if (! temporal.from_string(res->c_ptr(), res->length()))
57
57
      }
58
58
      break;
59
59
    case INT_RESULT:
60
 
      if (! temporal.from_int64_t(args[0]->val_int()))
61
 
      {
62
 
        /* 
63
 
        * Could not interpret the function argument as a temporal value, 
64
 
        * so throw an error and return 0
65
 
        */
66
 
        null_value= true;
67
 
        char buff[40];
68
 
        String tmp(buff,sizeof(buff), &my_charset_utf8_bin);
69
 
        String *res;
70
 
 
71
 
        res= args[0]->val_str(&tmp);
72
 
 
73
 
        my_error(ER_INVALID_DATETIME_VALUE, MYF(0), res->c_ptr());
74
 
        return 0;
75
 
      }
76
 
      break;
 
60
      if (temporal.from_int64_t(args[0]->val_int()))
 
61
        break;
 
62
      /* Intentionally fall-through on invalid conversion from integer */
77
63
    default:
78
64
      {
79
65
        /* 
81
67
        * so throw an error and return 0
82
68
        */
83
69
        null_value= true;
84
 
        char buff[40];
 
70
        char buff[DRIZZLE_MAX_LENGTH_DATETIME_AS_STRING];
85
71
        String tmp(buff,sizeof(buff), &my_charset_utf8_bin);
86
72
        String *res;
87
73