Skip to content

Commit

Permalink
Added precision and scale to column metadata (#64)
Browse files Browse the repository at this point in the history
  • Loading branch information
janfh authored Nov 22, 2024
1 parent 8dffb55 commit 5159e7d
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 15 deletions.
20 changes: 15 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,27 +87,37 @@ Output:
"display_size" : 3,
"label" : "DEPTNO",
"name" : "DEPTNO",
"type" : "CHAR"
"type" : "CHAR",
"precision" : 3,
"scale" : 0
}, {
"display_size" : 36,
"label" : "DEPTNAME",
"name" : "DEPTNAME",
"type" : "VARCHAR"
"type" : "VARCHAR",
"precision" : 36,
"scale" : 0
}, {
"display_size" : 6,
"label" : "MGRNO",
"name" : "MGRNO",
"type" : "CHAR"
"type" : "CHAR",
"precision" : 6,
"scale" : 0
}, {
"display_size" : 3,
"label" : "ADMRDEPT",
"name" : "ADMRDEPT",
"type" : "CHAR"
"type" : "CHAR",
"precision" : 3,
"scale" : 0
}, {
"display_size" : 16,
"label" : "LOCATION",
"name" : "LOCATION",
"type" : "CHAR"
"type" : "CHAR",
"precision" : 16,
"scale" : 0
} ],
"job" : "930740/QUSER/QZDASOINIT"
},
Expand Down
72 changes: 62 additions & 10 deletions src/main/java/io/github/mapepire_ibmi/types/ColumnMetadata.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,18 @@ public class ColumnMetadata {
@JsonProperty("type")
private String type;

/**
* The precision/length of the column.
*/
@JsonProperty("precision")
private int precision;

/**
* The scale of the column.
*/
@JsonProperty("scale")
private int scale;

/**
* Construct a new ColumnMetadata instance.
*/
Expand All @@ -39,22 +51,26 @@ public ColumnMetadata() {

/**
* Construct a new ColumnMetadata instance.
*
*
* @param displaySize The display size of the column.
* @param label The label of the column.
* @param name The name of the column.
* @param type The type of the column.
* @param precision The precision/length of the column.
* @param scale The scale of the column.
*/
public ColumnMetadata(int displaySize, String label, String name, String type) {
public ColumnMetadata(int displaySize, String label, String name, String type, int precision, int scale) {
this.displaySize = displaySize;
this.label = label;
this.name = name;
this.type = type;
this.precision = precision;
this.scale = scale;
}

/**
* Get the display size of the column.
*
*
* @return The display size of the column.
*/
public int getDisplaySize() {
Expand All @@ -63,7 +79,7 @@ public int getDisplaySize() {

/**
* Set the display size of the column.
*
*
* @param displaySize The display size of the column.
*/
public void setDisplaySize(int displaySize) {
Expand All @@ -72,7 +88,7 @@ public void setDisplaySize(int displaySize) {

/**
* Get the label of the column.
*
*
* @return The label of the column.
*/
public String getLabel() {
Expand All @@ -81,7 +97,7 @@ public String getLabel() {

/**
* Set the label of the column.
*
*
* @param label The label of the column.
*/
public void setLabel(String label) {
Expand All @@ -90,7 +106,7 @@ public void setLabel(String label) {

/**
* Get the name of the column.
*
*
* @return The name of the column.
*/
public String getName() {
Expand All @@ -99,7 +115,7 @@ public String getName() {

/**
* Set the name of the column.
*
*
* @param name The name of the column.
*/
public void setName(String name) {
Expand All @@ -108,7 +124,7 @@ public void setName(String name) {

/**
* Get the type of the column.
*
*
* @return The type of the column.
*/
public String getType() {
Expand All @@ -117,10 +133,46 @@ public String getType() {

/**
* Set the type of the column.
*
*
* @param type The type of the column.
*/
public void setType(String type) {
this.type = type;
}

/**
* Get the precision/length of the column.
*
* @return The precision/length of the column.
*/
public int getPrecision() {
return precision;
}

/**
* Set the precision/length of the column.
*
* @param precision The precision/length of the column.
*/
public void setPrecision(int precision) {
this.precision = precision;
}

/**
* Get the scale of the column.
*
* @return The scale of the column.
*/
public int getScale() {
return scale;
}

/**
* Set the scale of the column.
*
* @param scale The scale of the column.
*/
public void setScale(int scale) {
this.scale = scale;
}
}

0 comments on commit 5159e7d

Please sign in to comment.