Re: Fwd: Re: [Modeling-users] ec.fetch and SQL "in"
Status: Abandoned
Brought to you by:
sbigaret
|
From: Sebastien B. <sbi...@us...> - 2003-07-08 18:28:08
|
Yannick Gingras <yan...@sa...> wrote:
> Argh, I think we have a problem when there is only one elem in the
> choice list :
>=20
> <Fault 1: 'Modeling.Adaptor.GeneralAdaptorException:Couldn\'t evaluate=20
> expression SELECT t0.id, t0.gl_id, t0.fs2_id FROM FSLINK t0 WHERE (t0.fs2=
_id=20
> NOT IN (4,) AND t0.gl_id LIKE 1). Reason:=20
> _mysql_exceptions.ProgrammingError:(1064, "You have an error in your SQL=
=20
> syntax near \') AND t0.gl_id LIKE 1)\' at line 1")'>
>=20
> I don't think that : "NOT IN (4,)" is legal...
No it isn't! Thanks for reporting.
Apply the enclosed patch to your version, it should solve the problem.
-- S=E9bastien.
------------------------------------------------------------------------
--- SQLExpression.py Tue Jul 8 20:19:19 2003
+++ SQLExpression.py Tue Jul 8 20:20:13 2003
@@ -1191,7 +1191,7 @@
value=3DaQualifier.value()
=20=20=20=20=20
if aQualifier.operator() in (QualifierOperatorIn, QualifierOperatorNot=
In):
- value=3Dtuple(value)
+ value=3Dself.sqlStringForInOperatorValue(value)
=20=20=20=20=20=20=20
if not caseInsensitive:
operatorStr=3Dself.sqlStringForSelector(aQualifier.operator(), value)
@@ -1208,6 +1208,14 @@
else:
return self.sqlStringForCaseInsensitiveLike(keyString, valueString)
=20
+ def sqlStringForInOperatorValue(self, aList):
+ """
+ """
+ if len(aList)=3D=3D1:
+ return '(%s)'%aList[0]
+ else:
+ return str(tuple(aList))
+=20=20=20=20
def sqlStringForNegatedQualifier(self, aQualifier):
"""
Returns the SQL string for the supplied Qualifier
------------------------------------------------------------------------
|