Toshihiko
    Preparing search index...

    Function escape

    • Escapes special characters in a string to prevent SQL injection when used in SQL queries. This function should be used on user-provided input before it is inserted into a SQL query.

      Escapes the following characters:

      • \n (newline)
      • ' (single quote)
      • " (double quote)
      • \t (tab)
      • \0 (null byte)
      • \r (carriage return)
      • \b (backspace)
      • \x1a (substitute character)
      • \ (backslash)

      Parameters

      • str: string

        The string to be escaped for use in SQL queries.

      Returns string

      The escaped string safe for use in SQL queries.