目前,在node.js中,如果我想在MySQL表中的多列中搜索字符串,我必须这样做:
mysqlConnection.query(
"SELECT * FROM my_table WHERE column_a LIKE ? OR column_b LIKE ? OR column_c LIKE ?",
[searchString, searchString, searchString],
callback
);
我希望能够这样做:
mysqlConnection.query(
"SELECT * FROM my_table WHERE column_a LIKE ? OR column_b LIKE ? OR column_c LIKE ?",
searchString, callback
);
或者甚至可能使用命名参数:
mysqlConnection.query(
"SELECT * FROM my_table WHERE column_a LIKE :searchString OR column_b LIKE :searchString OR column_c LIKE :searchString",
{searchString: "needle"},
callback
);
我有办法吗?