Re: Proposed change regarding trimming of strings...
Franck Routier <[email protected]> Mon, 21 Feb 2011 09:44:43 +0100
| Newsgroups | gmane.comp.java.orm.simpleorm |
|---|---|
| Organization | Axège sarl |
| Message-ID | <1298277883.2826.33.camel@franck-laptop> |
Hi,
>
> But for ordinary Varchar fields, if you ever did accidentally have
> trailing spaces in a key for a VARCHAR it would be a pretty horrible
> bug. A user could simply accidentally add a space to an input field,
> for example.
Guess what : this is exactly what happened to me a few days ago...
> Two options, be helpful or strict. I think we need both.
>
> So to be helpful, have setString and getString trim, and NULL convert.
> And then have get|setStringExact which do not. SetObject should not.
> Thus we provide basic protection. For queries, do not do any
> conversion of ? parameters -- it is up to the user to pad with spaces
> if that is required by the db if they insist on using CHARs. (Queries
> are less important because they values are not persisted.)
>
> FindReference then uses getObject or getStringExact. So a read of a
> record followed by a findReference will always work. (No conversions
> should be made as data is actually being selected from the database.)
> Beyond that, it is up to the user to pad with spaces appropriately and
> use setStringExact in the rare situations where that is what is really
> required.
>
This seems fine to me. Should I tackle the implementation ?
Regards,
Franck
------------------------------------
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/SimpleORM/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/SimpleORM/join
(Yahoo! ID required)
<*> To change settings via email:
[email protected]
[email protected]
<*> To unsubscribe from this group, send an email to:
[email protected]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/