On Mon, Jan 30, 2012 at 02:23:56AM +0100, Petr Jake?? wrote:
> It was necessary to define all the column names and column types  manually
> in the table Class definition.

   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.

> 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.

> (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)

Oleg.
-- 
     Oleg Broytman            http://phdru.name/            p...@phdru.name
           Programmers don't die, they just GOSUB without RETURN.

------------------------------------------------------------------------------
Try before you buy = See our experts in action!
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-dev2
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to