Skip to content

Commit

Permalink
[CALCITE-6034] Add isAutoIncrement and isGenerated args to MetaColumn…
Browse files Browse the repository at this point in the history
… constructor
  • Loading branch information
tjbanghart committed Oct 11, 2023
1 parent 247fecd commit cd3db52
Showing 1 changed file with 42 additions and 2 deletions.
44 changes: 42 additions & 2 deletions core/src/main/java/org/apache/calcite/avatica/MetaImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -352,10 +352,11 @@ public static class MetaColumn implements Named {
public final String scopeTable = null;
public final Short sourceDataType = null;
@ColumnNoNulls
public final String isAutoincrement = "";
public final String isAutoincrement;
@ColumnNoNulls
public final String isGeneratedcolumn = "";
public final String isGeneratedcolumn;

@Deprecated // to be removed before 2.0
public MetaColumn(
String tableCat,
String tableSchem,
Expand All @@ -370,6 +371,27 @@ public MetaColumn(
Integer charOctetLength,
int ordinalPosition,
String isNullable) {
this(tableCat, tableSchem, tableName, columnName, dataType, typeName, columnSize,
decimalDigits, numPrecRadix, nullable, charOctetLength, ordinalPosition, isNullable, "",
"");
}

public MetaColumn(
String tableCat,
String tableSchem,
String tableName,
String columnName,
int dataType,
String typeName,
Integer columnSize,
Integer decimalDigits,
Integer numPrecRadix,
int nullable,
Integer charOctetLength,
int ordinalPosition,
String isNullable,
String isAutoincrement,
String isGeneratedcolumn) {
this.tableCat = tableCat;
this.tableSchem = tableSchem;
this.tableName = tableName;
Expand All @@ -383,11 +405,29 @@ public MetaColumn(
this.charOctetLength = charOctetLength;
this.ordinalPosition = ordinalPosition;
this.isNullable = isNullable;
this.isAutoincrement = isAutoincrement;
this.isGeneratedcolumn = isGeneratedcolumn;
}

public String getName() {
return columnName;
}

/** Returns a copy of this MetaColumn, overriding the value of {@code isAutoincrement}. */
@SuppressWarnings("unused") // called from Calcite
public MetaColumn withIsAutoIncrement(String isAutoincrement) {
return new MetaColumn(tableCat, tableSchem, tableName, columnName, dataType, typeName,
columnSize, decimalDigits, numPrecRadix, nullable, charOctetLength, ordinalPosition,
isNullable, isAutoincrement, isGeneratedcolumn);
}

/** Returns a copy of this MetaColumn, overriding the value of {@code isGeneratedcolumn}. */
@SuppressWarnings("unused") // called from Calcite
public MetaColumn withIsGeneratedColumn(String isGeneratedcolumn) {
return new MetaColumn(tableCat, tableSchem, tableName, columnName, dataType, typeName,
columnSize, decimalDigits, numPrecRadix, nullable, charOctetLength, ordinalPosition,
isNullable, isAutoincrement, isGeneratedcolumn);
}
}

/** Metadata describing a table. */
Expand Down

0 comments on commit cd3db52

Please sign in to comment.