PDA

View Full Version : Using bindValue with QSqlTableModel.setFilter()



manuels
11th December 2010, 13:16
Hi,

I'd like to use the setFilter() function of a QSqlTableModel.

I could do it using

model.setFilter("name LIKE %"+name+"%");
But to prevent SQL injection attacks, I'd like to do it like that:

model.setFilter("name LIKE :name);
The problem is, that I don't know how to bind the :name value because the filter is just populated to the model.query() after calling model.select().

How can I bind the value of :name?


Thanks!

Manuel