[Zope] Error, _mysql_exceptions. 'ON DUPLICATE KEY

Kevin Carlson khcarlso@bellsouth.net
Tue, 01 Jul 2003 11:31:21 -0400


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1">
  <title></title>
</head>
<body>
This is a mysql error message that has nothing to do with zope.&nbsp; I
don't believe that mysql supports the 'ON DUPLICATE KEY' syntax...<br>
<br>
Wayne Connolly wrote:<br>
<blockquote type="cite" cite="mid004301c33f12$69bf93f0$c9698690@XP">
  <meta http-equiv="Content-Type" content="text/html; ">
  <meta content="MSHTML 6.00.2600.0" name="GENERATOR">
  <style></style>
  <div><font face="Arial" size="2">Hi, i have been playing round with
this insert/update script on zope/mysql and keep recieving the
following error...any idea's on how to get rid of this would be muchly
appreciated?</font></div>
  <div><font face="Arial" size="2">&nbsp;</font></div>
  <div>
  <div><font face="Arial" size="2"><font face="Arial" size="2">--------------------------------------------------------------------</font></font></div>
  </div>
  <div><strong>Error, <em>_mysql_exceptions.ProgrammingError</em>:</strong>
(1064, "You have an error in your SQL syntax near 'ON DUPLICATE KEY
update charts set \n plays=plays + 1\n\twhere title='wayne'' at line
14") </div>
  <div><font face="Arial" size="2">--------------------------------------------------------------------</font></div>
  <div>&nbsp;</div>
  <div><font face="Arial" size="2">the ZSQL used is below</font></div>
  <div>
  <div>&nbsp;</div>
  <div><font face="Arial" size="2">--------------------------------------------------------------------</font></div>
  </div>
  <div><font face="Arial" size="2">insert into charts<br>
&nbsp;(title,<br>
&nbsp;artist,<br>
&nbsp;genre,<br>
&nbsp;album,<br>
&nbsp;plays)<br>
&nbsp;VALUES (&lt;!--#sqlvar title type=string --&gt; ,<br>
&nbsp;&nbsp;&lt;!--#sqlvar artist type=string --&gt; ,<br>
&nbsp;&nbsp;&lt;!--#sqlvar genre type=string --&gt; ,<br>
&nbsp;&nbsp;&lt;!--#sqlvar album type=string --&gt; ,<br>
&nbsp;&nbsp;plays=1<br>
&nbsp;&nbsp;)</font></div>
  <div>&nbsp;</div>
  <div><font face="Arial" size="2">ON DUPLICATE KEY</font></div>
  <div>&nbsp;</div>
  <div><font face="Arial" size="2">update charts set <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; plays=plays + 1<br>
&nbsp;where title=&lt;dtml-sqlvar title type=nb&gt; and
artist=&lt;dtml-sqlvar artist type=nb&gt;</font></div>
</blockquote>
</body>
</html>