title: How to remove commas from string in database with SQLite in C?
body: <p>I have problem on removing all comma from string data in SQLite database.</p>
  <p>The program is based on C so I use C API of SQLite as sqlite3_mprintf().
  I try to get rows matched with input and it needs to be checked without comma(,).</p>
  <p>REPLACE() of SQLite is used as REPLACE(data, ',', '').</p>
  <p>Sample code is below.</p>
  <pre><code>sqlite3_stmt *main_stmt;
  const char* comma = &quot;','&quot;;
  const char* removeComma = &quot;''&quot;
  char *zSQL;
  zSQL = sqlite3_mprintf(SELECT * FROM table WHERE (REPLACE(colA||colB, %w, %w) LIKE %%%q%%, comma, removeComma, input);
  int result = sqlite3_prepare_v2(database, zSQL, -1, &amp;main_stmt, 0);
  </code></pre>
  <p>I refer the sqlite3 reference.
  <a href="https://www.sqlite.org/printf.html" rel="nofollow noreferrer">https://www.sqlite.org/printf.html</a></p>
  <p>Any Substitution Types of SQLite3 reference delete apostrophes from input data.
  It makes REPLACE() functions different from what I think.</p>
  <p>What I expect is <code>SELECT * FROM table WHERE (REPLACE(colA||colB, ',', '') LIKE %q</code>
  by passing <strong>','</strong> and <strong>''</strong> as argument of <strong>sqlite3_mprintf()</strong>.</p>
  <p>However, result is changed as <code>SELECT * FROM table WHERE (REPLACE(colA||colB, ,, ) LIKE %q</code>
  so comma is not removed from data, colA||colB, and result is different from what I expect.</p>
  <p>Are there any idea to input comma as first argument of REPLACE() with apostrophes
  and blank with apostrophes as second argument?</p>