Re: troubles with unicode

Petr Jakeš <[email protected]>
Newsgroups gmane.comp.python.sqlobject
Message-ID <CAERU-Vbu4-bcipTv0bkhptLy7mCdPobu-anxj3g4aWEu8d0VAA@mail.gmail.com>
>   That's ok. "fromDatabase" schema guessing in SQLObject is a bit
> primitive. It works slightly better for The Big Three (MySQL, Postgres,
> SQLite) but still far from ideal.
>   You have a chance to improve the machinery for Firebird - it is in
> FirebirdConnection class, methods columnsFromSchema and guessClass.
>

With some luck I will check it this weekend (I can not promiss). It looks
like it gives different results with different versions of Firebird.
Actually I am trying to migrate TurboGears working application to an other
machine. The Python, TurboGears, kinterbasdb, SQLObject are the same
version. The only differences are version of Firebird and different Ubuntu
version.

>
> > Before inserting/updating to the database it is necessary to check, if
> the
> > inserted value type is the same as declared in the table Class
> definition
>

>    That strange - it's the job of validators.
>
Yes, that is what I have found strange as well...

>
> > (it is not possible to send string in to the integer column for example).
> > Strange.
>
>    Well, that's that job - IntCol's validator doesn't allow strings but
> allows any object that can be coerced to int.
>
> > Is there some way how to check/set/convert column type according to the
> > Class definition?
>
>    See the code in .set() that converts input values:
>
>            for name, value in kw.items():
>                from_python = getattr(self, '_SO_from_python_%s' % name,
> None)
>                if from_python:
>                    dbValue = from_python(value, self._SO_validatorState)
>                else:
>                    dbValue = value
>                to_python = getattr(self, '_SO_to_python_%s' % name, None)
>                if to_python:
>                    value = to_python(dbValue, self._SO_validatorState)
>
> I will check it. My feeling was it is not a problem to coerce str to int.

OK, thanks a lot anyway.

Petr

------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d

_______________________________________________
sqlobject-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.