Fix saving styles in postgres where style definition includes %1 etc str...

@NathanW2 @gioman

Fix for bug #11329 - saving graduated renderer style in postgres database. 

This is a minimal change to the style saving code ensure that SQL strings for inserting and updating styles into a postgres database will not be corrupted if the style itself contains a string such as %1, %2, %3.