Skip to content

How to handle newline char? #1420

@angerangel

Description

@angerangel

I don't know how to handle text with newline char. For example this code doesn't work:

temp = "This 
is an example
of multiline
text"

escaped = client.escape(temp)

tSQL = "INSERT into table1 (code,description) VALUES (1, #{escaped}) ;"
results = client.query(tSQL)

and I get error in syntax, because \n is a newline and get error:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '\\nis an example\\nof multiline\\ntext)'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions