Search code examples
regexdelphiescapinglazarus

Lazarus Pascal or Delphi - Escaping characters for security/integrity


In PHP (and MySQL) we have a host of techniques for ensuring that the data entered is valid and safe. Adding slashes, MySQL's escape string and regex are a few we often use.

I've seen THIS LINK that gives a very preliminary introduction to the subject but it is probably not complete or up-to-date.

My questions:

  1. Does Lazarus/FPC offer such features?

  2. What does Delphi offer? At least some clues or function names may give me an idea so that I may build it for Lazarus.

Thanks!


Solution

  • In almost any framework most reliable way to guard against bad data is not to try to escape it, but to simply always use prepared statements.

    Lazarus/FreePascal is not an exception to this rule - see some examples how to use prepared statements in FreePascal.