Skip to content

Commit

Permalink
Add retrieval of jdbc types as string
Browse files Browse the repository at this point in the history
  • Loading branch information
TobiasHafner authored and gartens committed Aug 6, 2024
1 parent fc302cb commit f43b05a
Showing 1 changed file with 44 additions and 1 deletion.
45 changes: 44 additions & 1 deletion src/main/java/org/polypheny/jdbc/types/TypedValue.java
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,7 @@ public String asString() throws SQLException {
case LIST:
case FILE:
case DOCUMENT:
return otherValue.toString();
throw new PrismInterfaceServiceException( PrismInterfaceErrors.DATA_TYPE_MISMATCH, "This value cannot be returned as a string." );
}
throw new PrismInterfaceServiceException( PrismInterfaceErrors.DATA_TYPE_MISMATCH, "This value cannot be returned as a string." );
}
Expand Down Expand Up @@ -1459,4 +1459,47 @@ private static PolyInterval getInterval( ProtoInterval interval ) {
return new PolyInterval( interval.getMonths(), interval.getMilliseconds() );
}


@Override
public String toString() {
if ( isSerialized ) {
deserialize();
}
switch ( valueCase ) {
case BOOLEAN:
return "" + booleanValue;
case INTEGER:
return "" + integerValue;
case LONG:
return "" + bigintValue;
case BIG_DECIMAL:
return "" + bigDecimalValue;
case FLOAT:
return "" + floatValue;
case DOUBLE:
return "" + doubleValue;
case DATE:
return "" + dateValue;
case TIME:
return "" + timeValue;
case TIMESTAMP:
return "" + timestampValue;
case INTERVAL:
return "" + otherValue;
case STRING:
return varcharValue;
case BINARY:
return "BINARY";
case NULL:
return "NULL";
case LIST:
return "LIST";
case FILE:
return "FILE";
case DOCUMENT:
return "DOCUMENT";
}
return "";
}

}

0 comments on commit f43b05a

Please sign in to comment.