From: Petr J. <pet...@tp...> - 2012-01-31 17:28:34
|
> 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 |