B
B
becks2015-02-13 17:50:02
MySQL
becks, 2015-02-13 17:50:02

Why doesn't the bindValue method in QSqlQuery escape characters when inserting into MySQL?

I came across a surprising feature, bindValue does not escape characters from the parameter exclusively when working with MySQL. I did not run into such behavior with other bases. Just in case, I checked the installation in the database via .Net, everything works well, i.e. the problem is not in the server settings or any other.

QString selectStr= QString("INSERT INTO %1 (id, guid, content) VALUES(:id, :guid, :content)").arg(tbName);

    sql_query.prepare(selectStr);
    sql_query.bindValue(":id", id64);
    sql_query.bindValue(":guid", guid);
    sql_query.bindValue(":content", t);

    sql_query.exec();

Has anyone experienced similar behavior?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question