SQLite escape string c++

后端 未结 2 1630
遥遥无期
遥遥无期 2020-12-17 00:22

Consider the following code

char bar[] = \"hello world \\\"One\\\", two, \'three\'\";
char *zSQL = sqlite3_mprintf(\"INSERT INTO stuff (`foo`) VALUES (\'%q\         


        
相关标签:
2条回答
  • 2020-12-17 00:31

    No. Use bound parameters.

    See:
    http://www.sqlite.org/c3ref/prepare.html
    http://www.sqlite.org/c3ref/bind_blob.html

    0 讨论(0)
  • 2020-12-17 00:38

    You have the same question that many have posed. There isn't anything built in.

    The better solution to string concatenation would be to bind parameters, which sidesteps the escaping issue.

    0 讨论(0)
提交回复
热议问题