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-989] Datatype information needs to be added. #45

Merged
merged 3 commits into from
Mar 12, 2024
Merged
Changes from 2 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
135 changes: 128 additions & 7 deletions src/jdbc/cubrid/jdbc/driver/CUBRIDDatabaseMetaData.java
Original file line number Diff line number Diff line change
Expand Up @@ -1963,10 +1963,22 @@ public synchronized ResultSet getTypeInfo() throws SQLException {
"FLOAT",
"DOUBLE",
"VARCHAR",
"STRING",
"DATE",
"TIME",
"TIMESTAMP",
"DATETIME"
"TIMESTAMPTZ",
"TIMESTAMPLTZ",
"DATETIME",
"DATETIMETZ",
"DATETIMELTZ",
"BLOB",
"CLOB",
"ENUM",
"MULTISET",
"SET",
"LIST",
"JSON"
};
/* Data Type */
Object[] column2 = {
Expand All @@ -1986,10 +1998,22 @@ public synchronized ResultSet getTypeInfo() throws SQLException {
new Short((short) java.sql.Types.REAL),
new Short((short) java.sql.Types.DOUBLE),
new Short((short) java.sql.Types.VARCHAR),
new Short((short) java.sql.Types.VARCHAR),
new Short((short) java.sql.Types.DATE),
new Short((short) java.sql.Types.TIME),
new Short((short) java.sql.Types.TIMESTAMP),
new Short((short) java.sql.Types.TIMESTAMP)
new Short((short) java.sql.Types.TIMESTAMP_WITH_TIMEZONE),
new Short((short) java.sql.Types.TIMESTAMP_WITH_TIMEZONE),
new Short((short) java.sql.Types.TIMESTAMP),
new Short((short) java.sql.Types.TIMESTAMP_WITH_TIMEZONE),
new Short((short) java.sql.Types.TIMESTAMP_WITH_TIMEZONE),
new Short((short) java.sql.Types.BLOB),
new Short((short) java.sql.Types.CLOB),
new Short((short) java.sql.Types.VARCHAR),
new Short((short) java.sql.Types.ARRAY),
new Short((short) java.sql.Types.ARRAY),
new Short((short) java.sql.Types.ARRAY),
new Short((short) java.sql.Types.VARCHAR)
};
/* Precision */
Object[] column3 = {
Expand All @@ -2009,10 +2033,22 @@ public synchronized ResultSet getTypeInfo() throws SQLException {
new Integer(38),
new Integer(38),
new Integer(1073741823),
new Integer(1073741823),
new Integer(10),
new Integer(11),
new Integer(22),
new Integer(26)
new Integer(29),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you look at dbtype_def.h, the precision of the data type is defined.
The precision value seems to be different.

The information below is the precision of the data type.
#define DB_TIMESTAMP_PRECISION 19
#define DB_TIMESTAMPTZ_PRECISION DB_TIMESTAMP_PRECISION
#define DB_DATETIME_PRECISION 23
#define DB_DATETIMETZ_PRECISION DB_DATETIME_PRECISION

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you're right. I set the precision for output, but the timezone is stored separately, so the input standard seems to be correct.
It's changed.
Thanks for review.

new Integer(29),
new Integer(26),
new Integer(33),
new Integer(33),
new Integer(1073741823),
new Integer(1073741823),
new Integer(1073741823),
new Integer(1073741823),
new Integer(1073741823),
new Integer(1073741823),
new Integer(1073741823)
};
/* Literal prefix */
Object[] column4 = {
Expand All @@ -2032,20 +2068,33 @@ public synchronized ResultSet getTypeInfo() throws SQLException {
null,
null,
"'",
"'",
"DATE'",
"TIME'",
"TIMESTAMP'",
"DATETIME'"
"TIMESTAMPTZ'",
"TIMESTAMPLTZ'",
"DATETIME'",
"DATETIMETZ'",
"DATETIMELTZ'",
null,
null,
"'",
"MULTISET",
"SET",
"LIST",
"'"
};
/* Literal Suffix */
Object[] column5 = {
"'", null, null, "'", "'", "'", "'", "'", null, null, null, null, null, null, null, "'",
"'", "'", "'", "'"
"'", "'", "'", "'", "'", "'", "'", "'", "'", null, null, "'", null, null, null, "'"
};
/* Create Params */
Object[] column6 = {
"(8)", "(3)", null, null, null, null, null, null, null, null, null, null, null, null,
null, null, null, null, null, null
null, null, null, null, null, null, null, null, null, null, null, null, null, null,
null, null, null, null
};
/* Nullable */
Object column7 = new Short((short) typeNullable);
Expand All @@ -2070,6 +2119,18 @@ public synchronized ResultSet getTypeInfo() throws SQLException {
new Boolean(false),
new Boolean(false),
new Boolean(false),
new Boolean(false),
new Boolean(false),
new Boolean(false),
new Boolean(false),
new Boolean(false),
new Boolean(false),
new Boolean(false),
new Boolean(false),
new Boolean(true),
new Boolean(true),
new Boolean(true),
new Boolean(true),
new Boolean(false)
};
/* Searchable */
Expand All @@ -2090,6 +2151,18 @@ public synchronized ResultSet getTypeInfo() throws SQLException {
new Short((short) typePredBasic),
new Short((short) typePredBasic),
new Short((short) typeSearchable),
new Short((short) typeSearchable),
new Short((short) typePredBasic),
new Short((short) typePredBasic),
new Short((short) typePredBasic),
new Short((short) typePredBasic),
new Short((short) typePredBasic),
new Short((short) typePredBasic),
new Short((short) typePredBasic),
new Short((short) typePredBasic),
new Short((short) typePredBasic),
new Short((short) typePredBasic),
new Short((short) typePredBasic),
new Short((short) typePredBasic),
new Short((short) typePredBasic),
new Short((short) typePredBasic),
Expand All @@ -2116,6 +2189,18 @@ public synchronized ResultSet getTypeInfo() throws SQLException {
new Boolean(true),
new Boolean(true),
new Boolean(true),
new Boolean(true),
new Boolean(true),
new Boolean(true),
new Boolean(true),
new Boolean(true),
new Boolean(true),
new Boolean(true),
new Boolean(true),
new Boolean(true),
new Boolean(true),
new Boolean(true),
new Boolean(true),
new Boolean(true)
};
/* FIXED_PREC_SCALE */
Expand All @@ -2139,6 +2224,18 @@ public synchronized ResultSet getTypeInfo() throws SQLException {
new Boolean(false),
new Boolean(false),
new Boolean(false),
new Boolean(false),
new Boolean(false),
new Boolean(false),
new Boolean(false),
new Boolean(false),
new Boolean(false),
new Boolean(false),
new Boolean(false),
new Boolean(false),
new Boolean(false),
new Boolean(false),
new Boolean(false),
new Boolean(false)
};
/* AUTO_INCREMENT */
Expand Down Expand Up @@ -2166,6 +2263,18 @@ public synchronized ResultSet getTypeInfo() throws SQLException {
new Integer(0),
new Integer(0),
new Integer(0),
new Integer(0),
new Integer(0),
new Integer(0),
new Integer(0),
new Integer(0),
new Integer(0),
new Integer(0),
new Integer(0),
new Integer(0),
new Integer(0),
new Integer(0),
new Integer(0),
new Integer(0)
};
/* MAXIMUM_SCALE */
Expand All @@ -2189,6 +2298,18 @@ public synchronized ResultSet getTypeInfo() throws SQLException {
new Integer(0),
new Integer(0),
new Integer(0),
new Integer(0),
new Integer(0),
new Integer(0),
new Integer(0),
new Integer(0),
new Integer(0),
new Integer(0),
new Integer(0),
new Integer(0),
new Integer(0),
new Integer(0),
new Integer(0),
new Integer(0)
};
/* SQL_DATA_TYPE */
Expand All @@ -2204,7 +2325,7 @@ public synchronized ResultSet getTypeInfo() throws SQLException {
value[15] = column16;
value[16] = column17;
value[17] = column18;
for (int i = 0; i < 18; i++) {
for (int i = 0; i < column1.length; i++) {
value[0] = column1[i];
value[1] = column2[i];
value[2] = column3[i];
Expand Down
Loading