On 27/11/2007, Oleg Broytmann <[EMAIL PROTECTED]> wrote:
> On Tue, Nov 27, 2007 at 02:56:59PM +0100, Markus Gritsch wrote:
> > But if a BLOB contains just bytes which do *not* trigger the
> > Exception, the BLOB in the query *does* get converted to unicode, and
> > I doubt this would be the desired behavior.
>
>    The absence of try/except in question wouldn't prevent anything in this
> case, right?

Right, but the presence of this try/except does swallow Exceptions
which might be helpful in some other cases.  Having this try/except
here unconditionally for all cases just prevents from getting an
exception when converting to unicode e.g. if one has specified a wrong
encoding.  This is dangerous.  Instead of getting an exception, the
code just continues to run, issuing a query containing the wrong
characters for the DB.

> But it helps (as I've heard) in case of a BLOB that triggers
> the exception.

But I doubt that the BLOB would be inserted *correctly* if it gets
converted to unicode using the specified encoding.  IMO it would be
desired to insert the BLOB as it is, without trying to decode it.  As
already said, for example BLOBS which contain only bytes in the ASCII
range would not trigger the Exception, and do get converted.  The BLOB
in the DB would then contain wrong bytes.

Markus

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to