Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. ATL / WTL / STL
  4. stl string parsing for DB query statement

stl string parsing for DB query statement

Scheduled Pinned Locked Moved ATL / WTL / STL
databasec++jsonhelp
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • X Offline
    X Offline
    xcavin
    wrote on last edited by
    #1

    I wanted to parse database query and replace any single quotes in any value to two single quotes. eg: problem query : insert into tbl (col1,col2,col3) values('correct','in'correct',''also incorrect'); expected query after parsing : insert into tbl (col1,col2,col3) values('correct','in''correct','''also incorrect'); can some one share code to accomplish the above using std::string or with some other STL class. Thanks in advance.

    R 1 Reply Last reply
    0
    • X xcavin

      I wanted to parse database query and replace any single quotes in any value to two single quotes. eg: problem query : insert into tbl (col1,col2,col3) values('correct','in'correct',''also incorrect'); expected query after parsing : insert into tbl (col1,col2,col3) values('correct','in''correct','''also incorrect'); can some one share code to accomplish the above using std::string or with some other STL class. Thanks in advance.

      R Offline
      R Offline
      Roland Pibinger
      wrote on last edited by
      #2

      xcavin wrote:

      I wanted to parse database query and replace any single quotes in any value to two single quotes.

      You need to write a replace_all function, see eg. http://groups.google.com/group/comp.lang.c++/browse_frm/thread/de56189adf9f6e72[^]

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups