Skip to content

Commit

Permalink
0001993: Add support for composite data types in postgres
Browse files Browse the repository at this point in the history
  • Loading branch information
chenson42 committed Sep 26, 2014
1 parent 4bc236f commit 83b4a3f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Expand Up @@ -57,7 +57,7 @@ public PostgreSqlTriggerTemplate(ISymmetricDialect symmetricDialect) {
" lpad(cast(round(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" ;
clobColumnTemplate = "case when $(tableAlias).\"$(columnName)\" is null then '' else '\"' || replace(replace(cast($(tableAlias).\"$(columnName)\" as varchar),$$\\$$,$$\\\\$$),'\"',$$\\\"$$) || '\"' end" ;
blobColumnTemplate = "case when $(tableAlias).\"$(columnName)\" is null then '' else '\"' || pg_catalog.encode($(tableAlias).\"$(columnName)\", 'base64') || '\"' end" ;
wrappedBlobColumnTemplate = "case when $(tableAlias).\"$(columnName)\" is null then '' else '\"' || $(defaultSchema)$(prefixName)_largeobject($(tableAlias).\"$(columnName)\") || '\"' end" ;
booleanColumnTemplate = "case when $(tableAlias).\"$(columnName)\" is null then '' when $(tableAlias).\"$(columnName)\" then '\"1\"' else '\"0\"' end" ;
Expand Down
Expand Up @@ -106,13 +106,16 @@ protected void setPrimaryKeyConstraintName(Connection connection, Table table) t
@Override
protected Integer mapUnknownJdbcTypeForColumn(Map<String, Object> values) {
String typeName = (String) values.get("TYPE_NAME");
Integer type = (Integer) values.get("DATA_TYPE");
if (typeName != null && typeName.equalsIgnoreCase("ABSTIME")) {
return Types.TIMESTAMP;
} else if (typeName != null && typeName.equalsIgnoreCase("TIMESTAMPTZ")) {
// lets use the same type code that oracle uses
return MAPPED_TIMESTAMPTZ;
} else if (PostgreSqlDatabasePlatform.isBlobStoredByReference(typeName)) {
return Types.BLOB;
} else if (type != null && type == Types.STRUCT) {
return Types.LONGVARCHAR;
} else {
return super.mapUnknownJdbcTypeForColumn(values);
}
Expand Down

0 comments on commit 83b4a3f

Please sign in to comment.