title: sqlite3_mprintf - should I always use %Q as format specifier instead of %s?
body: <p>Excerpt from SQLite reference on sqlite3_mprintf() API</p>
  
  <p><a href="http://www.sqlite.org/c3ref/mprintf.html" rel="noreferrer">http://www.sqlite.org/c3ref/mprintf.html</a></p>
  
  <p>"The %Q option works like %q except it also adds single quotes around the outside of the total string. Additionally, if the parameter in the argument list is a NULL pointer, %Q substitutes the text "NULL" (without single quotes)."</p>
  
  <p>When using %q, we have to be careful to always use single quotes around it e.g. </p>
  
  <pre><code>char *zText = "It's a happy day!";
  char *zSQL = sqlite3_mprintf("INSERT INTO table VALUES('%q')", zText);
  </code></pre>
  
  <p>It seems more convenient to always use %Q instead of %q as follows:</p>
  
  <pre><code>char *zSQL = sqlite3_mprintf("INSERT INTO table VALUES(%Q)", zText);
  </code></pre>
  
  <p>My question - is there a valid use case where '%q' is more suitable or more efficient? Or can I safely use %Q as a replacement for %s in all statements?</p>