Patch the getSql() method in Record