← Back to team overview

maria-developers team mailing list archive

mysql_stmt_prepare_start returns with error code 2006

 

Hi Folks,

 I am currently working on a c++11 asio based async connector for mariadb. The library takes advantage of mariadb’s async interface (mysql_*_start, mysql_*_cont functions). The whole point would be to prevent blocking in mysql operations and make operations cancellable via a reasonable interface.

Some example code:

TEST_CASE("tmp3") {
    init_db();
    asio::io_service io;
    amdb::connector conn(io);
    bool saved = false;

    entity e(42, 3.14, "our entity");
    amdb::auth_info auth("root");

    conn.async_connect(amdb::null_endpoint, "edbtest", auth, amdb::default_flags, [&] (const std::error_code& ec) {
        REQUIRE(!ec);
        conn.async_write_entity(e, [&] (const std::error_code &ec) {
            INFO(ec);
            REQUIRE(!ec);

            if (!ec) {
                saved = true;
            }
            io.stop();
        });
    });
    io.run();
    REQUIRE(saved);
}


async_write_entity() is an extra feature of the lib, which is generating an sql “batch” of prepared statements to persist hierarchical objects and executes that batch.

Unfortunately I am receiving an error 2006 from my very first mysql_stmt_prepare call. This error roughly translates to "connection to mysql server is gone”. I cannot really spot the issue with my operation, could someone give me a hint about this error (typical causes, what to check, etc etc.)? I am a bit clueless here how to tackle this problem.

Since the batch generation/execution code is a bit convoluted and complex, i would not paste it here now, but if someone can point me in the right direction i can share relevant parts.

Thanks in advance
 Andras

-- 
András Szabó
Sent with Airmail

Follow ups