Assertion failed



  • Hi. I have a very simple Sql query

    @query.clear();
    query.prepare("select FIO from inspectors where FIO=:FIO");
    query.bindValue(":FIO",text.trimmed());
    query.exec();@

    When it is executed I get this error:
    Assertion failed!
    Program:...
    File:.\libmysql.c

    When I change my Sql statement to
    @"select id from inspectors where FIO=:FIO"@

    the error is gone.
    So, what is the problem?Thanx a lot!


  • Moderators

    and which assert is hit? What's it's condition?

    Also IMO your first query doesn't make much sense :)



  • Expression: param->buffer_length!=0
    I just check if I already have a record with this FIO. At the beginnig my query was
    @select *from inspectors where FIO=:FIO@

    But i still had this mistake.And only when I change it to

    @select id from inspectors where FIO=:FIO@

    it works fine


  • Moderators

    @
    select from inspectors where FIO=:FIO
    @
    You are missing a space after the "
    "



  • I'm very sorry. I wrote it wrong only here. In my programm the query is correct=)


  • Moderators

    may it be possible that text.trimmed() results in an empty string in your application?



  • No, it is impossible....May it be connected somehow with the fact that one of the fields in my db has got type TEXT?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.