SOCI / soci

Official repository of the SOCI - The C++ Database Access Library
http://soci.sourceforge.net/
Boost Software License 1.0
1.37k stars 472 forks source link

Exception when running select on some mariiadb versions. #1059

Open zoman2000 opened 12 months ago

zoman2000 commented 12 months ago

Using SOCI (tag 4.0.3) and latest commit.

A code is something like this:

void show_tables(int ac, char** av) {
  std::shared_ptr<soci::session> sql;
  string dsn = create_dsn(((ac > 1) ? av[1] : "localhost"));
  sql.reset(new soci::session("mysql", dsn));

  vector<string> result;

  auto s = (*sql).prepare << "SHOW TABLES";
  soci::rowset<soci::row> rowss = s;
  for (auto& row : rowss) { // **fails here with the exception**
    string data = row.get<string>(0);
    result.push_back(data);
  }

  for (auto& val : result) {
    cout << val << '\n';
  }
}

Client OS OpenSuSE 15.5

1) when connecting to mariadb on another host, version of DB 11.0.2 - throws esception EXCEPTION: Cannot convert data: string "" is not a number while fetching data from "SHOW TABLES"

2) when connecting to host with mariadb version 5.6.43 (i.e. some very very old one) NO ERRORS

3) when connecting to host with mariadb version 10.16.4 NO ERRORS

vadz commented 12 months ago

Sorry, no idea what's going on here and I don't use MariaDB myself. Please try to debug it yourself, e.g. check where is the exception being thrown from exactly.

alex-kuzza-aaa commented 11 months ago

Sorry, no idea what's going on here and I don't use MariaDB myself. Please try to debug it yourself, e.g. check where is the exception being thrown from exactly.

Is there any sample bootstrap project. I'm compiling the SOCI lib locally and install it, so to change that need to figure out how to hook this up. If you can help - that will be great, thank you.

vadz commented 11 months ago

Ideal would be to add a failing unit test showing this problem and use the (existing) unit test to run it -- this should be simple to do and could be also used to test that it's fixed later.