mardi 14 novembre 2023

Sqlite_orm "and" operator operands doesn't match

I'm building a database repository class with every method the user needs to interact with a sqlite_orm database. In the method that checks if the user exists based on an username and password provided and I can't get pass this error from the "and" operator :

Severity Code Description Project File Line Suppression State Error C2678 binary '&&': no operator found which takes a left-hand operand of type 'sqlite_orm::internal::where_t<sqlite_orm::internal::is_equal_t<std::string UserDB::* ,std::string>>' (or there is no acceptable conversion)

This is the method :

int8_t DatabaseRepository::CheckUserExists(const std::string& inputUsername, const std::string& inputPassword)
{
    auto result = m_db->select(sql::columns(&UserDB::id),
        sql::where(sql::c(&UserDB::username) == inputUsername) and sql::c(&UserDB::password) == inputPassword);

    if (!result.empty())
        return result.front();
    else
        return -1;
}

I've checked the sqlite_orm pdf documentation and I've wrote the method as it is in the pdf and even Chat gpt can't solve this too.

Aucun commentaire:

Enregistrer un commentaire