Hi! I'm not very aware on how timestamps were working in dialect 1.
But for sure CORE-6494 shows some problems. First in engine: select cast(cast('2-DEC-0083' as timestamp) as varchar(64)) from rdb$database; Results in string '2-DEC-83' Second in ISQL: select cast('2-DEC-0083' as timestamp) from rdb$database; Results in ' 2-DEC- 83' or ' 2-DEC- 83 00:00:00.0000' (with SET TIME). Attached patch formats day/year always with 2/4 digits. Is it ok? Adriano
diff --git a/src/common/cvt.cpp b/src/common/cvt.cpp index 5650aa2420..5c94b98f7f 100644 --- a/src/common/cvt.cpp +++ b/src/common/cvt.cpp @@ -2232,7 +2232,7 @@ static void datetime_to_text(const dsc* from, dsc* to, Callbacks* cb) else { // Prior to BLR version 5 timestamps were converted to text in the dd-MMM-yyyy format - sprintf(p, "%d-%.3s-%d", + sprintf(p, "%2.2d-%.3s-%4.4d", times.tm_mday, FB_LONG_MONTHS_UPPER[times.tm_mon], times.tm_year + 1900); } diff --git a/src/isql/isql.epp b/src/isql/isql.epp index 8402cb0298..1ed6541abe 100644 --- a/src/isql/isql.epp +++ b/src/isql/isql.epp @@ -7759,13 +7759,13 @@ static unsigned print_item(TEXT** s, const IsqlVar* var, const unsigned length) else { if (setValues.Time_display) - sprintf(d, "%2d-%s-%4d %2.2d:%2.2d:%2.2d.%4.4" ULONGFORMAT, + sprintf(d, "%2.2d-%s-%4.4d %2.2d:%2.2d:%2.2d.%4.4" ULONGFORMAT, times.tm_mday, alpha_months[times.tm_mon], times.tm_year + 1900, times.tm_hour, times.tm_min, times.tm_sec, fractions); else - sprintf(d, "%2d-%s-%4d", times.tm_mday, + sprintf(d, "%2.2d-%s-%4.4d", times.tm_mday, alpha_months[times.tm_mon], times.tm_year + 1900); }
Firebird-Devel mailing list, web interface at https://lists.sourceforge.net/lists/listinfo/firebird-devel