SOCI/soci

Exception when running select on some mariiadb versions.

zoman2000 opened this issue · 3 comments

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 "<some_table_name>" 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

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.

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

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.