Python - sqlite exception "Error near s" - Is my sqlite statement incorrect?
<p>I currently have a sqlite statement that looks like this in the debugger</p>

<pre><code>'SELECT id FROM ITable where question=\\'Is your child\\'s serial correct?\\''
</code></pre>

<p>this is the code</p>

<pre><code>def TestStatement(question,patient_id,student_id):
    try:
        str = "SELECT id FROM ITable where question='%s' " %(question)
        r = executeSelect(str) #&lt;&lt;--------Exception occurs here
    except Exception as e:
        return "Exception Occured"
    return r
</code></pre>

<p>The question parameter is:</p>

<pre><code>'Is your child\\'s serial correct?'
</code></pre>

<p>The exception returned is:</p>

<pre><code>near "s": syntax error
</code></pre>

<p>I cannot modify the question parameter. Any suggestions on what I might be doing wrong ? or why this sql statement is incorrect ?</p>