Skip to content
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,8 @@ const std::vector< sample_data_getTypeInfo_struct > sample_data_all_types_info{
{"float", SQL_REAL, 7, "", "", "", 2, 0, 3, 0, 0, 0, "", 0, 0, SQL_REAL, 0,
10, 0},
{"date", SQL_TYPE_TIMESTAMP, 24, "", "", "", 2, 0, 3, 1, 0, 0, "", 0, 0,
SQL_TYPE_TIMESTAMP, 0, 10, 0},
{"timestamp", SQL_TYPE_TIMESTAMP, 24, "", "", "", 2, 0, 3, 1, 0, 0, "", 0, 0,
SQL_TYPE_TIMESTAMP, 0, 10, 0}};

const std::vector< sample_data_getTypeInfo_struct >
Expand Down
4 changes: 2 additions & 2 deletions sql-odbc/src/sqlodbc/opensearch_info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ const std::unordered_map< int, std::vector< int > > sql_opensearch_type_map = {
{SQL_WVARCHAR,
{OPENSEARCH_TYPE_KEYWORD, OPENSEARCH_TYPE_TEXT, OPENSEARCH_TYPE_NESTED,
OPENSEARCH_TYPE_OBJECT}},
{SQL_TYPE_TIMESTAMP, {OPENSEARCH_TYPE_DATETIME}}};
{SQL_TYPE_TIMESTAMP, {OPENSEARCH_TYPE_DATETIME, OPENSEARCH_TYPE_TIMESTAMP}}};

const std::unordered_map< std::string, int > data_name_data_type_map = {
{OPENSEARCH_TYPE_NAME_BOOLEAN, SQL_BIT},
Expand All @@ -86,7 +86,7 @@ const std::unordered_map< std::string, int > data_name_data_type_map = {
{OPENSEARCH_TYPE_NAME_SCALED_FLOAT, SQL_DOUBLE},
{OPENSEARCH_TYPE_NAME_KEYWORD, SQL_WVARCHAR},
{OPENSEARCH_TYPE_NAME_TEXT, SQL_WVARCHAR},
{OPENSEARCH_TYPE_NAME_DATE, SQL_TYPE_TIMESTAMP},
{OPENSEARCH_TYPE_NAME_TIMESTAMP, SQL_TYPE_TIMESTAMP},

Choose a reason for hiding this comment

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

Shouldn't you keep the date mapping to timestamp here as well?

Copy link
Author

Choose a reason for hiding this comment

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

Yes, I've reverted it back.

{OPENSEARCH_TYPE_NAME_OBJECT, SQL_WVARCHAR},
{OPENSEARCH_TYPE_NAME_NESTED, SQL_WVARCHAR}};

Expand Down
9 changes: 7 additions & 2 deletions sql-odbc/src/sqlodbc/opensearch_types.c
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ opensearchtype_attr_to_sqldesctype(const ConnectionClass *conn, OID type, int ty
case SQL_TYPE_DATE:
case SQL_TYPE_TIME:
case SQL_TYPE_TIMESTAMP:
return SQL_DATETIME;
return SQL_TYPE_TIMESTAMP;

Choose a reason for hiding this comment

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

I am not sure this is correct, I believe SQL_DATETIME is the correct return here?

Copy link
Author

Choose a reason for hiding this comment

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

This has be reverted in 1817773

}
return rettype;
}
Expand Down Expand Up @@ -494,6 +494,8 @@ const char *opensearchtype_attr_to_name(const ConnectionClass *conn, OID type,
return OPENSEARCH_TYPE_NAME_NESTED;
case OPENSEARCH_TYPE_DATETIME:
return OPENSEARCH_TYPE_NAME_DATE;
case OPENSEARCH_TYPE_TIMESTAMP:
return OPENSEARCH_TYPE_NAME_TIMESTAMP;
case OPENSEARCH_TYPE_OBJECT:
return OPENSEARCH_TYPE_NAME_OBJECT;
case OPENSEARCH_TYPE_VARCHAR:
Expand Down Expand Up @@ -534,6 +536,8 @@ opensearchtype_attr_column_size(const ConnectionClass *conn, OID type, int attty
return 0;
case OPENSEARCH_TYPE_DATETIME:
return 24;
case OPENSEARCH_TYPE_TIMESTAMP:
return 24;
case OPENSEARCH_TYPE_OBJECT:
return 0;
default:
Expand Down Expand Up @@ -990,7 +994,7 @@ OID sqltype_to_opensearchtype(const ConnectionClass *conn, SQLSMALLINT fSqlType)

case SQL_TIMESTAMP:
case SQL_TYPE_TIMESTAMP:
openSearchType = OPENSEARCH_TYPE_DATETIME;
openSearchType = OPENSEARCH_TYPE_TIMESTAMP;
break;

case SQL_VARBINARY:
Expand Down Expand Up @@ -1311,6 +1315,7 @@ Int2 opensearchtype_unsigned(const ConnectionClass *conn, OID type) {
case OPENSEARCH_TYPE_TEXT:
case OPENSEARCH_TYPE_NESTED:
case OPENSEARCH_TYPE_DATETIME:
case OPENSEARCH_TYPE_TIMESTAMP:
case OPENSEARCH_TYPE_OBJECT:
return SQL_TRUE;

Expand Down
1 change: 1 addition & 0 deletions sql-odbc/src/sqlodbc/opensearch_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ extern "C" {
#define OPENSEARCH_TYPE_NAME_TEXT "text"
#define OPENSEARCH_TYPE_NAME_NESTED "nested"
#define OPENSEARCH_TYPE_NAME_DATE "date"
#define OPENSEARCH_TYPE_NAME_TIMESTAMP "timestamp"
#define OPENSEARCH_TYPE_NAME_OBJECT "object"
#define OPENSEARCH_TYPE_NAME_VARCHAR "varchar"
#define OPENSEARCH_TYPE_NAME_UNSUPPORTED "unsupported"
Expand Down