I am attempting to run a match query of an exact phase. but my phrase is contained in a variable. I can accomplish it with the exact phrase as a constant but not as a variable.
I am running MySQL 8.0 and workbench 8.0.
build environment: win10 MinGW with custom built mysql connector.
when I run the query within workbench it works perfectly.
SELECT * FROM schema.table WHERE MATCH(phrase) AGAINST( '"exact phrase with whitespace"' IN BOOLEAN MODE);
when ran from c++ program as a prepared statement like the following it works.
qry.prepare( "SELECT * FROM schema.table WHERE MATCH(phrase) AGAINST( '\"exact phrase with whitespace\"' IN BOOLEAN MODE)" );
However I cannot seem to get working if making my "exact phrase" is dynamic in a variable. all of the below work for matching any of the words in the phrase. but none will return a true for only an exact phrase.
qry.prepare( "SELECT * FROM schema.table WHERE MATCH(phrase) AGAINST( :phrase IN BOOLEAN MODE)" );
qry.bindValue( ":phrase", phrase );
qry.prepare( "SELECT * FROM schema.table WHERE MATCH(phrase) AGAINST( CONCAT(""\":phrase""\") IN BOOLEAN MODE)" );
qry.bindValue( ":phrase", phrase );
qry.prepare( "SELECT * FROM schema.table WHERE MATCH(phrase) AGAINST( '""\""%phrase%"""\" IN BOOLEAN MODE)" );
what am I missing? thank you in advance for any assistance.