improved sql comment handling#73
Conversation
|
Please note that the tests are currently not passing when run on travis (https://travis-ci.org/travis-ci/marginalia/jobs/431465306). Possibly due to the dependency on the old It also looks like the tests haven't been enabled for a while now though. So fixing that seems out of scope for this patch. I was able to successfully run the tests locally via: |
| end | ||
|
|
||
| def self.escape_sql_comment(str) | ||
| str = str.dup |
There was a problem hiding this comment.
Can't we only dup if the str includes the patterns bellow? I want to save the extra allocation if not needed.
|
I've made the dup conditional. In fact I'm not sure if it is even needed. Since the |
| def self.escape_sql_comment(str) | ||
| if str.include?('/*') || str.include?('*/') | ||
| str = str.dup | ||
| end |
There was a problem hiding this comment.
You are right, we don't need the dup. gsub should already create a new string for us.
|
Removed the |
|
Thanks. i am cleaning up test and releasing a new gem version |
This is an improved version of #56.