Skip to content

Commit

Permalink
Fix find column type with column prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
lucarota committed Oct 24, 2024
1 parent 3c13191 commit ec9e16c
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.ascendix.salesforce</groupId>
<artifactId>salesforce-jdbc</artifactId>
<version>1.6.9${suffix.version}-release</version>
<version>1.6.10${suffix.version}-release</version>
<packaging>jar</packaging>

<name>Salesforce JDBC Driver</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ private Optional<T> parse(Object o) {
}

if (o instanceof String val) {
return Optional.of(conversion.apply(val));
return Optional.ofNullable(conversion.apply(val));
}

if (o.getClass().isAssignableFrom(clazz)) {
Expand All @@ -217,7 +217,7 @@ private Optional<T> parse(Object o) {
}
}

return Optional.of(conversion.apply(o.toString()));
return Optional.ofNullable(conversion.apply(o.toString()));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,15 @@ private TypeInfo findColumnType(String name) {
return TypeInfo.lookupTypeInfo(metadata.getColumnTypeName(i));
}
}
String[] prefix = StringUtils.split(name, '.');
if (prefix.length > 0) {
name = String.join(".", List.of(prefix).subList(1, prefix.length));
for (int i = 1; i <= metadata.getColumnCount(); i++) {
if (name.equalsIgnoreCase(metadata.getColumnName(i))) {
return TypeInfo.lookupTypeInfo(metadata.getColumnTypeName(i));
}
}
}
} catch (SQLException e) {
// ignore
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ private void visitInternal(SelectItem<Expression> fieldSpec) {
if (prefixNames.size() > 1 && prefixNames.get(0).equals(rootEntityName)) {
alias = String.join(".", prefixNames.subList(1, prefixNames.size())) + name;
} else {
alias = column.getTable().getFullyQualifiedName()+ "." + name;
alias = column.getTable().getFullyQualifiedName() + "." + name;
}
}
FieldDef result = createFieldDef(name, alias, prefixNames);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ private Constants() {

public static final int DRIVER_MAJOR_VER = 1;
public static final int DRIVER_MINOR_VER = 6;
public static final int DRIVER_REVISION_VER = 9;
public static final int DRIVER_REVISION_VER = 10;

public static final String DRIVER_VERSION = DRIVER_MAJOR_VER + "." + DRIVER_MINOR_VER + "." + DRIVER_REVISION_VER;

Expand Down

0 comments on commit ec9e16c

Please sign in to comment.