Fixed bug in getLastQuery() not including tail SQL.

Amended replacePlaceHolders() function to include any left over SQL after binding the final variable.