-
Notifications
You must be signed in to change notification settings - Fork 186
ODBC: Fix for data loading failure in Power BI Desktop #627
Changes from all commits
427bd79
401a053
11856cd
e693269
4158974
586793f
9cb48a4
c234b88
0d0c050
50d4ccf
023fb67
0b857c0
06ae486
b2ff222
3f6ff5d
ad73d91
91d5cbe
ddc725b
b946351
2bd944c
ed0afb9
22dc963
82e9a72
5022f1f
f4c7068
a76c382
debe0c5
6add9da
a80eee8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -83,6 +83,22 @@ const std::unordered_map< int, std::vector< int > > sql_es_type_map = { | |
{ES_TYPE_KEYWORD, ES_TYPE_TEXT, ES_TYPE_NESTED, ES_TYPE_OBJECT}}, | ||
{SQL_TYPE_TIMESTAMP, {ES_TYPE_DATETIME}}}; | ||
|
||
const std::unordered_map< std::string, int > data_name_data_type_map = { | ||
{ES_TYPE_NAME_BOOLEAN, SQL_BIT}, | ||
{ES_TYPE_NAME_BYTE, SQL_TINYINT}, | ||
{ES_TYPE_NAME_SHORT, SQL_SMALLINT}, | ||
{ES_TYPE_NAME_INTEGER, SQL_INTEGER}, | ||
{ES_TYPE_NAME_LONG, SQL_BIGINT}, | ||
{ES_TYPE_NAME_HALF_FLOAT, SQL_REAL}, | ||
{ES_TYPE_NAME_FLOAT, SQL_REAL}, | ||
{ES_TYPE_NAME_DOUBLE, SQL_DOUBLE}, | ||
{ES_TYPE_NAME_SCALED_FLOAT, SQL_DOUBLE}, | ||
{ES_TYPE_NAME_KEYWORD, SQL_WVARCHAR}, | ||
{ES_TYPE_NAME_TEXT, SQL_WVARCHAR}, | ||
{ES_TYPE_NAME_DATE, SQL_TYPE_TIMESTAMP}, | ||
{ES_TYPE_NAME_OBJECT, SQL_WVARCHAR}, | ||
{ES_TYPE_NAME_NESTED, SQL_WVARCHAR}}; | ||
|
||
// Boilerplate code for easy column bind handling | ||
class BindTemplate { | ||
public: | ||
|
@@ -476,8 +492,29 @@ void SetTableTuples(QResultClass *res, const TableResultSet res_type, | |
// information for its Data Preview window. | ||
std::string catalog(""); | ||
bind_tbl[TABLES_CATALOG_NAME]->UpdateData((void *)catalog.c_str(), 0); | ||
for (size_t i = 0; i < binds.size(); i++) | ||
binds[i]->AssignData(&tuple[i]); | ||
|
||
// TODO #630 - Revisit logic of adding tuples for SQLTables & SQLColumns | ||
for (size_t i = 0; i < binds.size(); i++) { | ||
// Add tuples for SQLColumns | ||
if (binds.size() > COLUMNS_SQL_DATA_TYPE) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we just report the extra columns regardless? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The same method is used while adding tuples for SQLTables as well. SQLTables has only 5 columns whereas SQLColumns has 18. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Almost wondering if it would be worth it to split some of this logic up, now that we're handling special cases for SQLTables & SQLColumns There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Created issue #630 to revisit the logic of assigning data for SQLTables & SQLColumns |
||
// Add data type for data loading issue in Power BI Desktop | ||
auto data_type = data_name_data_type_map | ||
.find(bind_tbl[COLUMNS_TYPE_NAME]->AsString())->second; | ||
if (i == COLUMNS_DATA_TYPE) { | ||
set_tuplefield_int2(&tuple[COLUMNS_DATA_TYPE], | ||
static_cast< short >(data_type)); | ||
} else if (i == COLUMNS_SQL_DATA_TYPE) { | ||
set_tuplefield_int2(&tuple[COLUMNS_SQL_DATA_TYPE], | ||
static_cast< short >(data_type)); | ||
} else { | ||
binds[i]->AssignData(&tuple[i]); | ||
} | ||
} | ||
// Add tuples for SQLTables | ||
else { | ||
binds[i]->AssignData(&tuple[i]); | ||
} | ||
} | ||
}; | ||
|
||
// General case | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use SQL type contstants here instead? (eg.
SQLWVARCHAR
)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added