最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

c++ - mysql_fetch_field_direct does not return type of data anymore since updating server from mariadb 10.5 to 11.6 - Stack Over

programmeradmin2浏览0评论

i am using this C++ code since long time without problems:

 MYSQL_ROW row = mysql_fetch_row(m_hRes);
 for(UINT nIndex = 0; nIndex < nFieldsCount; nIndex++)
 {
     MYSQL_FIELD* fls = mysql_fetch_field_direct(m_hRes, nIndex);
     SQLType::e_Type eType = static_cast<SQLType::e_Type>(fls->type);

...

after updating the server from mariadb 10.5 to 11.6 fls->type is always 0 (eDecimal) which is definitly wrong in most cases. The value seems not to be written/used anymore. I updated the client dll (libmariadb.dll) as well - no difference. It seems to be a server problem. But i have no idea, why. Is there any setting for this?

i am using this C++ code since long time without problems:

 MYSQL_ROW row = mysql_fetch_row(m_hRes);
 for(UINT nIndex = 0; nIndex < nFieldsCount; nIndex++)
 {
     MYSQL_FIELD* fls = mysql_fetch_field_direct(m_hRes, nIndex);
     SQLType::e_Type eType = static_cast<SQLType::e_Type>(fls->type);

...

after updating the server from mariadb 10.5 to 11.6 fls->type is always 0 (eDecimal) which is definitly wrong in most cases. The value seems not to be written/used anymore. I updated the client dll (libmariadb.dll) as well - no difference. It seems to be a server problem. But i have no idea, why. Is there any setting for this?

Share Improve this question asked Jan 19 at 15:04 TimmTimm 515 bronze badges 4
  • You may know more than I do about it, but based on this info type is an enum, and then looking to the enum list here MYSQL_TYPE_DECIMAL is listed first, so that would be 0? – Paul T. Commented Jan 19 at 21:38
  • could you post a minimal complete program and table create and insert statements that demonstrate the problem? – ysth Commented Jan 21 at 14:42
  • what exact version of the client are you using? – ysth Commented Jan 21 at 14:43
  • I tested this in 10.5 and the main branch with this test modified to DECIMAL and returning i in the query and returned by 246, MYSQL_TYPE_NEWDECIMAL. Does the mariadb client with --column-type-info include different into? Was this a really old table can can you include SHOW CREATE TABLE output here along with a reference to the query executed. – danblack Commented Jan 23 at 6:34
Add a comment  | 

1 Answer 1

Reset to default 0

I switched from the mariadb client lib to boost::mysql and everything is working fine

Thus, the server definitly sends the data !

The client is also checked to be able receive that data because it does with an older server

In boost::mysql i need to set conn->set_meta_mode(mysql::metadata_mode::full);

There might be a similar problem with defaults and switches in mariadb, although the boost switch does not affect only the data type but column names as well...

thanks for all hints. I will try to find the switch or just keep boost

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论