Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[APIS-1000] Improve ResultSetMetaData return value for multi-schema support #54

Merged
merged 1 commit into from
Sep 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/jdbc/cubrid/jdbc/driver/CUBRIDResultSetMetaData.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public class CUBRIDResultSetMetaData implements ResultSetMetaData {
private int[] col_prec;
private int[] col_disp_size;
private int[] col_scale;
private String[] col_schema;
private String[] col_table;
private int[] col_null;
private String[] col_class_name;
Expand All @@ -66,6 +67,7 @@ protected CUBRIDResultSetMetaData(UColumnInfo[] col_info) {
col_prec = new int[col_info.length];
col_disp_size = new int[col_info.length];
col_scale = new int[col_info.length];
col_schema = new String[col_info.length];
col_table = new String[col_info.length];
col_null = new int[col_info.length];
col_class_name = new String[col_info.length];
Expand All @@ -77,7 +79,10 @@ protected CUBRIDResultSetMetaData(UColumnInfo[] col_info) {
col_name[i] = col_info[i].getColumnName();
col_prec[i] = col_info[i].getColumnPrecision();
col_scale[i] = col_info[i].getColumnScale();
col_table[i] = col_info[i].getClassName();
String tableName = col_info[i].getClassName();
int dotIndex = tableName != null ? tableName.indexOf('.') : -1;
col_schema[i] = dotIndex != -1 ? tableName.substring(0, dotIndex) : "";
col_table[i] = dotIndex != -1 ? tableName.substring(dotIndex + 1) : tableName;
col_type_name[i] = null;
col_class_name[i] = col_info[i].getFQDN();
if (col_info[i].isNullable()) col_null[i] = columnNullable;
Expand Down Expand Up @@ -452,6 +457,7 @@ protected CUBRIDResultSetMetaData(UColumnInfo[] col_info) {
col_prec = new int[col_name.length];
col_disp_size = new int[col_name.length];
col_scale = new int[col_name.length];
col_schema = new String[col_name.length];
col_table = new String[col_name.length];
col_null = new int[col_name.length];
col_class_name = new String[col_name.length];
Expand Down Expand Up @@ -513,6 +519,7 @@ protected CUBRIDResultSetMetaData(UColumnInfo[] col_info) {
}
col_scale[i] = 0;
ele_type[i] = -1;
col_schema[i] = "";
col_table[i] = "";
col_charset_name[i] = null;
if (r.nullable[i]) {
Expand Down Expand Up @@ -691,7 +698,7 @@ public String getColumnName(int column) throws SQLException {

public String getSchemaName(int column) throws SQLException {
checkColumnIndex(column);
return "";
return col_schema[column - 1];
}

public int getPrecision(int column) throws SQLException {
Expand Down
Loading