Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception when running select on some mariiadb versions. #1059

Open
zoman2000 opened this issue Jul 11, 2023 · 3 comments
Open

Exception when running select on some mariiadb versions. #1059

zoman2000 opened this issue Jul 11, 2023 · 3 comments
Labels

Comments

@zoman2000
Copy link

zoman2000 commented Jul 11, 2023

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 vadz added the MySQL label Jul 11, 2023
@vadz
Copy link
Member

vadz commented Jul 11, 2023

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
Copy link

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
Copy link
Member

vadz commented Jul 16, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants