Re: [Modeling-users] fetch qualifier problem
Status: Abandoned
Brought to you by:
sbigaret
From: Mario R. <ma...@ru...> - 2003-08-09 13:06:04
|
Sorry, I did not mention that this was running on sqlite. The problem here occurs for string values that contain '_' (for '@'. it actually works fine, sorry had it wrong the first time). Here is a (touched-up, to remove stuff) SQL output: >>> ufirst =3D '_mario' >>> u =3D ec.fetch('User',qualifier=3D'firstname ilike "*%s*"' = %(ufirst) ) Opening channel=20 <SQLiteAdaptorLayer.SQLiteAdaptorChannel.SQLiteAdaptorChannel instance=20= at 0x7db8e0> (0x7db8e0) Called Opening connection to the DB with conn.Dict: {'password': 'xxxx',=20 'database': 'db_users'} Evaluating: SELECT t0.ID, t0.FIRSTNAME, t0.etcetera, FROM User t0 WHERE=20= UPPER(t0.FIRSTNAME) LIKE UPPER('%\_mario%') rowcount: 0 Returning: None Closing adaptorChannel=20 <SQLiteAdaptorLayer.SQLiteAdaptorChannel.SQLiteAdaptorChannel instance=20= at 0x7db8e0> (0x7db8e0) Adaptor channel=20 <SQLiteAdaptorLayer.SQLiteAdaptorChannel.SQLiteAdaptorChannel instance=20= at 0x7db8e0> did close Channels are now all closed Closing the connection to the database >>> Small question: when i try the aove from inside a py program (a unittest testcase test), setting this envvar to 'YES', nothing=20 happens... or so it seems. Where should i go to get stderr (osx) ? mario On Samedi, ao=FB 9, 2003, at 14:43, Sebastien Bigaret wrote: > Hi, > > Could you please give an example string and the db server you use? > > It must be a bug. '_' is the sql equivalent for '?' in qualifier > strings (matches one character), but it should have been escaped. We=20= > had > such pbs with postgresql which were fixed, but it seems that the > pb. remains w/ other db adaptors. AFAIK '@' shouldn't be a problem on > its own. > > It could also help if you could send the generated sql statements by > setting MDL_ENABLE_DATABASE_LOGGING to true --possibly privately if > you do not want to disclose the details. > > > -- S=E9bastien. > > > Mario Ruggier <ma...@ru...> wrote: >> I have encountered this problem: if i set a string property on an=20 >> entity, >> and this contains a "special" character such as _ or @, then fetch >> does the following: >> >> ec.EditingContext() >> aprop =3D 'a_string' # contains a special characters, e.g. _ @ >> e =3D AnEntity() >> e.setAprop(aprop) >> ec.insert(e) >> ec.saveChanges() >> >> ec.fetch('AnEntity',qualifier=3D'aprop =3D=3D "%s"' %(aprop) ) # = works fine >> ec.fetch('AnEntity',qualifier=3D'aprop ilike "*%s*"' %(aprop) ) # = nada >> >> i.e. if i use the str value for testing equality, the fetch results=20= >> are ok, >> but if i use it in ilike, then the fetch result list is zero length. >> Is there something i miss here, or is this a bug? >> >> Cheers, mario > |