Previous way of constructing the SQL was causing a syntax error. Some interaction between prepared statements and GStrings.