update-records updates all rows

Başar Erdivanlı <[email protected]> Thu, 25 Jun 2015 01:23:01 +0300
Newsgroups gmane.lisp.clsql.general
Message-ID <CA+mnhq0+UCYf1G70R8iNxQXhOapk_7PruTo7U_-++D2cHsFsag@mail.gmail.com>
--===============7783320201679788910==
Content-Type: multipart/alternative; boundary=001a113368082c874105194af32a

--001a113368082c874105194af32a
Content-Type: text/plain; charset=UTF-8

I use clozure cl version 1.10 on linux arm.
As far as I read on the documentation, I coded the following function to
update a boolean value in a table:

(defun function-name (id)
  (clsql:update-records 'table-name
                        :av-pairs '((column_name "f"))
                        :where (eq 'id id)))

But the function above updates the value of column_name of all rows to 'f'.
I tried it with other equality predictors. Only '=' complained that id is
not a number. I also tried it with other columns, which contain smallints
or strings and equality predictors like string=. The result is always the
same: the whole column becomes 'f'.

The mail list contains many posts where I see codes like this:
...
  (with-custom-database ()
    (let ((a (get-object 3)))
      (setf (student-name a) "Joe Stud")
      (update-records-from-instance a)))...

Whereas I can't find any example of clsql:update-records.
What may be the reason?

--001a113368082c874105194af32a
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>I use clozure cl version 1.10 on linux arm.</div><div=
>As far as I read on the documentation, I coded the following function to u=
pdate a boolean value in a table:</div><div><br></div><div>(defun function-=
name (id)</div><div>=C2=A0 (clsql:update-records &#39;table-name</div><div>=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 :av-pairs &#39;((column_name &quot;f&quot;))</div><div>=C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 :where (eq &#39;id id)))</div><div><br></div><div>But the function abov=
e updates the value of column_name of all rows to &#39;f&#39;. I tried it w=
ith other equality predictors. Only &#39;=3D&#39; complained that id is not=
 a number. I also tried it with other columns, which contain smallints or s=
trings and equality predictors like string=3D. The result is always the sam=
e: the whole column becomes &#39;f&#39;.</div><div><br></div><div>The mail =
list contains many posts where I see cod<font face=3D"arial, helvetica, san=
s-serif">es like this:</font></div><div><span style=3D"font-family:arial,he=
lvetica,sans-serif;line-height:24px;text-align:justify">...</span><br></div=
><div><font face=3D"arial, helvetica, sans-serif"><span style=3D"line-heigh=
t:24px;text-align:justify">=C2=A0 (with-custom-database ()=C2=A0</span><br =
style=3D"line-height:24px;text-align:justify"><span style=3D"line-height:24=
px;text-align:justify">=C2=A0=C2=A0=C2=A0 (let ((a (get-object 3)))</span><=
br style=3D"line-height:24px;text-align:justify"><span style=3D"line-height=
:24px;text-align:justify">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (setf (student-nam=
e a) &quot;Joe Stud&quot;)</span><br style=3D"line-height:24px;text-align:j=
ustify"><span style=3D"line-height:24px;text-align:justify">=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0 (update-records-from-instance a)))...</span></font><br></di=
v><div><font face=3D"arial, helvetica, sans-serif"><span style=3D"line-heig=
ht:24px;text-align:justify"><br></span></font></div><div><font face=3D"aria=
l, helvetica, sans-serif"><span style=3D"line-height:24px;text-align:justif=
y">Whereas I can&#39;t find any example of clsql:update-records.</span></fo=
nt></div><div style=3D"text-align:justify"><font face=3D"arial, helvetica, =
sans-serif"><span style=3D"line-height:24px">What may be the reason?</span>=
</font></div></div>

--001a113368082c874105194af32a--

--===============7783320201679788910==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: base64
Content-Disposition: inline

X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KQ0xTUUwgbWFp
bGluZyBsaXN0CkNMU1FMQGI5LmNvbQpodHRwOi8vbGlzdHMuYjkuY29tL2NnaS1iaW4vbWFpbG1h
bi9saXN0aW5mby9jbHNxbAo=

--===============7783320201679788910==--