<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
p, li { white-space: pre-wrap; }
</style></head><body style=" font-family:'DejaVu Sans'; font-size:9pt; font-weight:400; font-style:normal;">
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">Hello,</p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; "> </p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">I have a problem with QtSql.</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">In my code, I want update a table of a PostgreSQL data base. </p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">In my table I have a column 'dateOut' and it this column is what I want to update :</p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; "> </p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; "> </p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" color:#000000;">def _update(</span><span style=" font-family:'Monospace'; color:#000000; background-color:#ffffff;">query</span><span style=" color:#000000;">, </span><span style=" font-family:'Monospace'; color:#000000; background-color:#ffffff;">lst</span><span style=" color:#000000;">):</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-family:'Courier New,courier'; color:#000000;">    </span><span style=" font-family:'Monospace'; color:#000000; background-color:#ffffff;">model</span><span style=" font-family:'Courier New,courier'; color:#000000;"> = </span><span style=" font-family:'Monospace'; color:#000000; background-color:#ffffff;">QtSql</span><span style=" font-family:'Courier New,courier'; color:#000000;">.</span><span style=" font-family:'Monospace'; color:#000000; background-color:#ffffff;">QSqlTableModel</span><span style=" font-family:'Courier New,courier'; color:#000000;">()</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-family:'Courier New,courier'; color:#000000;">    </span><span style=" font-family:'Monospace'; color:#000000; background-color:#ffffff;">model</span><span style=" font-family:'Courier New,courier'; color:#000000;">.</span><span style=" font-family:'Monospace'; color:#000000; background-color:#ffffff;">setQuery</span><span style=" font-family:'Courier New,courier'; color:#000000;">(</span><span style=" font-family:'Monospace'; color:#000000; background-color:#ffffff;">QtSql</span><span style=" font-family:'Courier New,courier'; color:#000000;">.</span><span style=" font-family:'Monospace'; color:#000000; background-color:#ffffff;">QSqlQuery</span><span style=" font-family:'Courier New,courier'; color:#000000;">(</span><span style=" font-family:'Monospace'; color:#000000; background-color:#ffffff;">query</span><span style=" font-family:'Courier New,courier'; color:#000000;">))</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-family:'Courier New,courier'; color:#000000;">    </span><span style=" font-family:'Monospace'; color:#000000; background-color:#ffffff;">model</span><span style=" font-family:'Courier New,courier'; color:#000000;">.</span><span style=" font-family:'Monospace'; color:#000000; background-color:#ffffff;">select</span><span style=" font-family:'Courier New,courier'; color:#000000;">()</span></p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; "> </p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-family:'Courier New,courier'; color:#000000;">    </span><span style=" font-family:'Monospace'; color:#000000; background-color:#ffffff;">record</span><span style=" font-family:'Courier New,courier'; color:#000000;"> = </span><span style=" font-family:'Monospace'; color:#000000; background-color:#ffffff;">model</span><span style=" font-family:'Courier New,courier'; color:#000000;">.</span><span style=" font-family:'Monospace'; color:#000000; background-color:#ffffff;">record</span><span style=" font-family:'Courier New,courier'; color:#000000;">(0)</span></p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; "> </p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-family:'Courier New,courier'; color:#000000;">    </span><span style=" font-family:'Monospace'; color:#000000; background-color:#ffffff;">record</span><span style=" font-family:'Courier New,courier'; color:#000000;">.</span><span style=" font-family:'Monospace'; color:#000000; background-color:#ffffff;">setValue</span><span style=" font-family:'Courier New,courier'; color:#000000;">('dateOut', </span><span style=" font-family:'Monospace'; color:#000000; background-color:#ffffff;">lst</span><span style=" font-family:'Courier New,courier'; color:#000000;">[2])</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-family:'Courier New,courier'; color:#000000;">    </span><span style=" font-family:'Monospace'; color:#000000; background-color:#ffffff;">model</span><span style=" font-family:'Courier New,courier'; color:#000000;">.</span><span style=" font-family:'Monospace'; color:#000000; background-color:#ffffff;">setRecord</span><span style=" font-family:'Courier New,courier'; color:#000000;">(0, </span><span style=" font-family:'Monospace'; color:#000000; background-color:#ffffff;">record</span><span style=" font-family:'Courier New,courier'; color:#000000;">)</span></p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; "> </p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-family:'Courier New,courier'; color:#000000;">    print(</span><span style=" font-family:'Monospace'; color:#000000; background-color:#ffffff;">model</span><span style=" font-family:'Courier New,courier'; color:#000000;">.</span><span style=" font-family:'Monospace'; color:#000000; background-color:#ffffff;">lastError</span><span style=" font-family:'Courier New,courier'; color:#000000;">().</span><span style=" font-family:'Monospace'; color:#000000; background-color:#ffffff;">text</span><span style=" font-family:'Courier New,courier'; color:#000000;">())</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-family:'Courier New,courier'; color:#000000;">    </span><span style=" font-family:'Monospace'; color:#000000; background-color:#ffffff;">model</span><span style=" font-family:'Courier New,courier'; color:#000000;">.</span><span style=" font-family:'Monospace'; color:#000000; background-color:#ffffff;">submitAll</span><span style=" font-family:'Courier New,courier'; color:#000000;">()</span></p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; "> </p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; "> </p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-family:'Courier New,courier'; color:#000000;">But I have this error :</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">ERREUR:  erreur de syntaxe sur ou près de « = »</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">LIGNE 1 : PREPARE qpsqlpstmt_1 AS UPDATE  SET "dateout"=$1 WHERE "id" ...</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">                                                       ^</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">(42601) QPSQL: Unable to prepare statement</p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; "> </p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; "> </p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">Have you an idea ?</p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; "> </p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; "> </p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">Thanks you in advance</p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; "> </p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">Charlie</p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; "> </p></body></html>