http://qs321.pair.com?node_id=266074


in reply to Re: Re: Test if string is already quote()'d?
in thread Test if string is already quote()'d?

If this is the case, then I would suggest enforcing a coding standard along the lines of never quote a string until just before applying to the database.

The question is a bit vague. Where are these strings coming from (database? user? other code?)? Maybe the O.P. should ask themself: what is the contract of the code that I am writing?.

It sounds like the current contract is something like: put stuff in the database that may or may not be ready to go in the database. Since there is no way to tell if something is ready or not, the contract cannot be fulfilled.

...And you can't tell if something is prepared or not. If I hand you the string 'hello', do I want you to insert 'hello' or do I want you to insert '''hello''' ?