Re: [Modeling-users] MySQL TEXT
Status: Abandoned
Brought to you by:
sbigaret
From: Sebastien B. <sbi...@us...> - 2003-03-06 22:36:58
|
Hi, Yannick Gingras <yan...@sa...> wrote: > the user guide section 2.2.4 talk about CHAR and VARCHAR external type > support but there is no mention about the support for TEXT. I have > really strange errors when using TEXT. >=20 > File "<stdin>", line 92, in insertElement > File "/usr/lib/python2.2/site-packages/Modeling/EditingContext.py",= line=20 > 678, in saveChanges > self.parentObjectStore().saveChangesInEditingContext(self) > File "/usr/lib/python2.2/site-packages/Modeling/ObjectStoreCoordina= tor.py",=20 > line 559, in saveChangesInEditingContext > raise RuntimeError, _error > RuntimeError: performChanges() failed on=20 > <Modeling.DatabaseContext.DatabaseContext instance at 0x88dd2ec>:=20 > exceptions.ValueError:Unknown value type: None for externalType: text= =20 > (attribute: JOBI18N.description) >=20 > Is it possible I am positively certain that my default value is not > None and that I did put a value in JOBI18N.description before insert. >=20 > Anyone have a clue about the cause ? Yes, this is because TEXT is an unknown sql type for the MySQLAdaptor. Didn't the validation of the model indicate it ?-) (I agree the message is not very informative, I added bug #699046) It is raised by SQLExpression.formatValueForAttribute(), which got an 'None' type from valueTypeForExternalType(). If TEXT is a valid mysql format mapped to a python string, then modify MySQLSQLExpression.valueTypeForExternalTypeMapping() in DatabaseAdaptors.MySQLAdaptorLayer: diff -c -r1.2 MySQLSQLExpression.py *** MySQLSQLExpression.py 1 Feb 2003 11:59:13 -0000 1.2 --- MySQLSQLExpression.py 6 Mar 2003 22:18:13 -0000 *************** *** 77,81 **** """ values=3DSQLExpression.valueTypeForExternalTypeMapping.im_func(se= lf) del values['timestamp'] ! values.update({ 'datetime': DateType }) return values --- 77,82 ---- """ values=3DSQLExpression.valueTypeForExternalTypeMapping.im_func(se= lf) del values['timestamp'] ! values.update({ 'datetime': DateType, ! 'text': CharacterType }) return values (SQL types should be lower-cased) =20=20 This should work ; please report and I'll apply the patch when you confirm that this is ok. Regards, -- S=E9bastien. |