Page 1 of 1

Maybe little bug in LinQ2SQL Support

Posted: Mon 22 Jun 2009 12:35
by Zero-G.
Hey

I have the latest avaiable version of dotConnect for mySQL v5.20.33

I have two tables in my database, which are related by a FK
In the Entity Developer, they are also related.
Both tables have an Timestamp field (Default Value=Current_timestamp)
When I try to add a dataentry by code like:

Code: Select all

Dim tbl1 As New Table1 With{.Field = value}
Dim tbl2 As New Table2 With{.Field = value, _
                                           .Table1 = tbl1}

Then, I get an error (by submitting the changes to the Database), that in tbl1 is an invalid date-time , because I have not set it explicit.

The second thing would be a little feature for the next entity developer:
When there is a field as Timestamp with default value Current timestamp, then it should be isVersion = true.
This is not now, and I have to change this behaivor on to 100 tables....

THX

Posted: Tue 23 Jun 2009 13:07
by AndreyR
Thank you for the report, we will investigate the situation.

Posted: Tue 23 Jun 2009 14:01
by AndreyR
This behaviour will not be added, because default current timestamp value is not enough to consider the column a version.
In addition, there should be an update trigger to justify the setting of IsVersion attribute to true.
We don't have technical opportunity to check whether this trigger is present and does the necessary work,
so this responsibilty is delegated to users.

Posted: Wed 24 Jun 2009 12:22
by Zero-G.
there should be an update trigger to justify the setting of IsVersion attribute to true
Is there more information about this? - I don't know yet, what you mean.

THX

Posted: Wed 24 Jun 2009 14:43
by AndreyR
When you insert the values, the value in the version column becomes current_timestamp().
When you update the values, the value in the version column is not changed.
So you need an update trigger to change the value of the version column.
As we can not check whether such trigger exists, we can't set IsVersion to true for the described column.

Posted: Thu 25 Jun 2009 10:45
by Zero-G.
OK.
So, am I right, when I say the following:
I have to make an update Trigger (on the server) - This trigger changes the TimeStamp Column to the current date.
When I did this, then I can set the isVersion at the entity developer to true. - So that it would work.

???????????????????????????????????????????????????????????????????????

THX

Posted: Fri 26 Jun 2009 13:43
by AndreyR
Yes, you have described the correct way to use the Version columns.