Skip to content

Commit

Permalink
0000921: postgres trigger template for timestamp with time zone did n…
Browse files Browse the repository at this point in the history
…ot zero pad negative time zone hours
  • Loading branch information
chenson42 committed Nov 21, 2012
1 parent 7303812 commit b82325f
Showing 1 changed file with 4 additions and 8 deletions.
Expand Up @@ -20,18 +20,14 @@ public PostgreSqlTriggerTemplate(ISymmetricDialect symmetricDialect) {
dateTimeWithTimeZoneColumnTemplate =
"case when $(tableAlias).\"$(columnName)\" is null then '' else " +
" case " +
" when extract(timezone_hour from $(tableAlias).\"$(columnName)\") < -9 then " +
" '\"' || to_char($(tableAlias).\"$(columnName)\", 'YYYY-MM-DD HH24:MI:SS.US ')|| " +
" lpad(cast(extract(timezone_hour from $(tableAlias).\"$(columnName)\") as varchar),3,'0')||':'|| " +
" when extract(timezone_hour from $(tableAlias).\"$(columnName)\") < 0 then " +
" '\"' || to_char($(tableAlias).\"$(columnName)\", 'YYYY-MM-DD HH24:MI:SS.US ')||'-'|| " +
" lpad(cast(abs(extract(timezone_hour from $(tableAlias).\"$(columnName)\")) as varchar),2,'0')||':'|| " +
" lpad(cast(extract(timezone_minute from $(tableAlias).\"$(columnName)\") as varchar), 2, '0') || '\"' " +
" when extract(timezone_hour from $(tableAlias).\"$(columnName)\") >= 0 then " +
" else " +
" '\"' || to_char($(tableAlias).\"$(columnName)\", 'YYYY-MM-DD HH24:MI:SS.US ')||'+'|| " +
" lpad(cast(extract(timezone_hour from $(tableAlias).\"$(columnName)\") as varchar),2,'0')||':'|| " +
" lpad(cast(extract(timezone_minute from $(tableAlias).\"$(columnName)\") as varchar), 2, '0') || '\"' " +
" else " +
" '\"' || to_char($(tableAlias).\"$(columnName)\", 'YYYY-MM-DD HH24:MI:SS.US ')|| " +
" lpad(cast(extract(timezone_hour from $(tableAlias).\"$(columnName)\") as varchar),2,'0')||':'|| " +
" lpad(cast(extract(timezone_minute from $(tableAlias).\"$(columnName)\") as varchar), 2, '0') || '\"' " +
" end " +
"end ";
clobColumnTemplate = "case when $(tableAlias).\"$(columnName)\" is null then '' else '\"' || replace(replace($(tableAlias).\"$(columnName)\",$$\\$$,$$\\\\$$),'\"',$$\\\"$$) || '\"' end" ;
Expand Down

0 comments on commit b82325f

Please sign in to comment.