Esempio n. 1
0
            // totaloffsetminutes(StartTime) eq 60 // timestamp only
            protected override string StringifyTotaloffsetminutes(UnaryFuncSegment segment)
            {
                string format = @"
DECODE(
SIGN(TO_CHAR({0},'TZH')),
-1, TO_NUMBER(TO_CHAR({0},'TZH')) * 60 - TO_NUMBER(TO_CHAR({0},'TZM')), 
TO_NUMBER(TO_CHAR({0},'TZH')) * 60 + TO_NUMBER(TO_CHAR({0},'TZM')))";

                return(string.Format(format, ToSqlString(segment.Operand)));
            }
Esempio n. 2
0
 // ceiling(Freight) eq 33
 protected override string StringifyCeiling(UnaryFuncSegment segment)
 {
     return(string.Format("CEILING({0})", ToSqlString(segment.Operand)));
 }
Esempio n. 3
0
 // floor(Freight) eq 32
 protected override string StringifyFloor(UnaryFuncSegment segment)
 {
     return(string.Format("FLOOR({0})", ToSqlString(segment.Operand)));
 }
Esempio n. 4
0
 // round(Freight) eq 32
 protected override string StringifyRound(UnaryFuncSegment segment)
 {
     return(string.Format("ROUND({0}, 0)", ToSqlString(segment.Operand)));
 }
Esempio n. 5
0
 protected override string StringifyTotaloffsetminutes(UnaryFuncSegment segment)
 {
     throw new NotSupportedException(segment.Func);
 }
Esempio n. 6
0
 // time(StartTime) le StartOfDay
 protected override string StringifyTime(UnaryFuncSegment segment)
 {
     return(string.Format("CONVERT(time, {0})", ToSqlString(segment.Operand)));
 }
Esempio n. 7
0
 // totaloffsetminutes(StartTime) eq 60 // datetimeoffset(7) only
 protected override string StringifyTotaloffsetminutes(UnaryFuncSegment segment)
 {
     // "DATEPART(TZOFFSET, SYSDATETIMEOFFSET())"
     return(string.Format("DATEPART(TZOFFSET, {0})", ToSqlString(segment.Operand)));
 }
Esempio n. 8
0
 // second(StartTime) eq 0
 protected override string StringifySecond(UnaryFuncSegment segment)
 {
     return(string.Format("DATEPART(SECOND, {0})", ToSqlString(segment.Operand)));
 }
Esempio n. 9
0
 // time(StartTime) le StartOfDay
 protected override string StringifyTime(UnaryFuncSegment segment)
 {
     return(string.Format("TO_DATE('0001-01-01 '|| TO_CHAR({0},'HH24:MI:SS'), 'YYYY-MM-DD HH24:MI:SS')", ToSqlString(segment.Operand)));
 }
Esempio n. 10
0
 // date(StartTime) ne date(EndTime)
 protected override string StringifyDate(UnaryFuncSegment segment)
 {
     return(string.Format("TO_DATE(TO_CHAR({0}, 'YYYY-MM-DD'),'YYYY-MM-DD')", ToSqlString(segment.Operand)));
 }
Esempio n. 11
0
 // totaloffsetminutes(StartTime) eq 60
 // SELECT TO_NUMBER(TO_CHAR(SYSDATE,'FF9')) FROM DUAL; ORA-01821: "date format not recognized"
 // SELECT TO_NUMBER(TO_CHAR(CURRENT_TIMESTAMP,'FF9')) FROM DUAL; OK
 protected override string StringifyFractionalseconds(UnaryFuncSegment segment)
 {
     return(string.Format("TO_NUMBER(TO_CHAR({0},'FF9'))", ToSqlString(segment.Operand)));
 }
Esempio n. 12
0
 // second(StartTime) eq 0
 protected override string StringifySecond(UnaryFuncSegment segment)
 {
     return(string.Format("TO_NUMBER(TO_CHAR({0},'SS'))", ToSqlString(segment.Operand)));
 }
Esempio n. 13
0
 // time(StartTime) le StartOfDay
 protected override string StringifyTime(UnaryFuncSegment segment)
 {
     return(string.Format("maketime(hour({0}), minute({0}), second({0}))", ToSqlString(segment.Operand)));
 }
Esempio n. 14
0
 // date(StartTime) ne date(EndTime)
 protected override string StringifyDate(UnaryFuncSegment segment)
 {
     return(string.Format("str_to_date(date_format({0}, '%Y-%m-%d'), '%Y-%m-%d')", ToSqlString(segment.Operand)));
 }
Esempio n. 15
0
 // hour(StartTime) eq 1
 protected override string StringifyHour(UnaryFuncSegment segment)
 {
     return(string.Format("DATEPART(HOUR, {0})", ToSqlString(segment.Operand)));
 }
Esempio n. 16
0
 // minute(StartTime) eq 0
 protected override string StringifyMinute(UnaryFuncSegment segment)
 {
     return(string.Format("DATEPART(MINUTE, {0})", ToSqlString(segment.Operand)));
 }
Esempio n. 17
0
 // length(CompanyName) eq 19
 protected override string StringifyLength(UnaryFuncSegment segment)
 {
     return(string.Format("LEN({0})", ToSqlString(segment.Operand)));
 }
Esempio n. 18
0
 // fractionalseconds(StartTime) eq 0
 protected override string StringifyFractionalseconds(UnaryFuncSegment segment)
 {
     return(string.Format("DATEPART(MILLISECOND, {0})", ToSqlString(segment.Operand)));
 }
Esempio n. 19
0
 // toupper(CompanyName) eq 'ALFREDS FUTTERKISTE'
 protected override string StringifyToupper(UnaryFuncSegment segment)
 {
     return(string.Format("UPPER({0})", ToSqlString(segment.Operand)));
 }
Esempio n. 20
0
 // date(StartTime) ne date(EndTime)
 protected override string StringifyDate(UnaryFuncSegment segment)
 {
     // "CONVERT(datetime, CONVERT(char(10), {0}, 120))"
     return(string.Format("CONVERT(date, {0})", ToSqlString(segment.Operand)));
 }
Esempio n. 21
0
 // trim(CompanyName) eq 'Alfreds Futterkiste'
 protected override string StringifyTrim(UnaryFuncSegment segment)
 {
     return(string.Format("LTRIM(RTRIM({0}))", ToSqlString(segment.Operand)));
 }
Esempio n. 22
0
 protected override string StringifyGeoLength(UnaryFuncSegment segment)
 {
     throw new NotSupportedException(segment.Func);
 }
Esempio n. 23
0
 // fractionalseconds(StartTime) eq 0
 protected override string StringifyFractionalseconds(UnaryFuncSegment segment)
 {
     return("date_format({0}, '%f') + 0");
 }