slackbuilds/development/mysql-workbench/mysql-workbench-column-labe...

45 lines
1.5 KiB
Diff

diff --git a/backend/wbpublic/objimpl/db.query/db_query_Resultset.cpp b/backend/wbpublic/objimpl/db.query/db_query_Resultset.cpp
index 1b69f22..82de11f 100644
--- a/backend/wbpublic/objimpl/db.query/db_query_Resultset.cpp
+++ b/backend/wbpublic/objimpl/db.query/db_query_Resultset.cpp
@@ -241,7 +241,11 @@ public:
const int last_column= meta->getColumnCount();
for (int i = 1; i <= last_column; i++)
{
+#ifdef MYSQLCPPCONN_VERSION_1_1_5
+ column_by_name[meta->getColumnLabel(i)]= i;
+#else
column_by_name[meta->getColumnName(i)]= i;
+#endif
std::string type;
switch (meta->getColumnType(i))
@@ -308,7 +312,11 @@ public:
db_query_ResultsetColumnRef column(aself->get_grt());
column->owner(aself);
+#ifdef MYSQLCPPCONN_VERSION_1_1_5
+ column->name(std::string(meta->getColumnLabel(i)));
+#else
column->name(std::string(meta->getColumnName(i)));
+#endif
column->columnType(type);
self->columns().insert(column);
diff --git a/modules/db.mysql.query/src/dbquery.cpp b/modules/db.mysql.query/src/dbquery.cpp
index 428bad3..74db1dc 100644
--- a/modules/db.mysql.query/src/dbquery.cpp
+++ b/modules/db.mysql.query/src/dbquery.cpp
@@ -521,7 +521,11 @@ std::string DbMySQLQueryImpl::resultFieldName(int result, int field)
throw std::invalid_argument("Invalid resultset");
sql::ResultSet *res = _resultsets[result];
+#ifdef MYSQLCPPCONN_VERSION_1_1_5
+ return res->getMetaData()->getColumnLabel(field);
+#else
return res->getMetaData()->getColumnName(field);
+#endif
}