| |
| Publicado el 12,febrero 2016 - 16:36 |
This is a strange problem... I have in analysis (mysql tables) a table with a timestamp field whose default value is CURRENT_TIMESTAMP (defined on MySql). So in analysis I see it as DateTime field with "NULL authorized" check disabled, as expeced, and empty default value.
When I insert a record my HAdd gives an error telling that that field cannot be null. This due to the fact that I never assign a value to that field in my code for triggering Mysql to fill it with default CURRENT_TIMESTAMP. I sniffed the mysql queries and I saw that the query made by the engine to Mysql tries to assign NULL to that field, as If a Hadd has to set ALL table fields.
When I worked witb MySql 5.6 if I set the field to NULL (even if null was not allowed) it run fine... With 5.7 it does not accept this trick anymore. The only way I found to keep out the field with CURRENT_TIMESTAMP default value is to delete it from the datafile in analysis... Bad solution because I need to remove it by hand each time I resync the analysis... Is there another way? With a query by hand it's fine, I would like to make run HAdd
Thank you. |
| |
| |
| | | |
|
| | |
| |
| Publicado el 12,febrero 2016 - 17:32 |
Yes, Hadd set all the table fields.
If the only change is the mysql version probably it's one change in the behaviour between mysql versions.
What happens if you change your analysis to disallow null? |
| |
| |
| | | |
|
| | |
| |
| Publicado el 12,febrero 2016 - 17:51 |
In analysis the field has null always disallowed. As in Mysql. It's a specific timestamp value, for my use it cannot be null. It is "default value CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP" |
| |
| |
| | | |
|
| | |
| |
| Publicado el 12,febrero 2016 - 18:30 |
| if you fill it with datesys()+timesys() it works? |
| |
| |
| | | |
|
| | |
| |
| Publicado el 12,febrero 2016 - 19:23 |
| Sure but it is machine client timestamp not mysql's |
| |
| |
| | | |
|
| | |
| |
| Publicado el 12,febrero 2016 - 19:49 |
| filling the field with one trigger on mysql instead of default value is acceptable for you? |
| |
| |
| | | |
|
| | |
| |
| Publicado el 13,febrero 2016 - 14:17 |
| Any trick is ok for me. Even removing the field from analysis. That solved the problem. My hope was having a standard way to do it that i don't know because of my inexperience |
| |
| |
| | | |
|
| | |
| |
| Publicado el 13,febrero 2016 - 21:06 |
Hey StefanoG,
using the native access and you have an item in the analysis that must have the value NULL when you write the record with HAdd() or HModify() then you have to set the ..Null property to True, e.g. Customer.CURRENT_TIMESTAMP..Null = True. When you have optional foreign keys (value is NULL or is an existing value in the linked file (or SQL table), then you have to set the ..Null property also, something like this:
IF Customer.iIDCountry < 1 THEN Customer.iIDCountry..Null = True HModify(Customer)
greetings, Xavier |
| |
| |
| | | |
|
| | |