Versioned on class
Hans Karlsen (talk | contribs) (Created page with "When you set Versioned on a class we never use sql-command-update or delete for that class. Instead we use insert with TimeStampStart and TimeStampStop added as non-attribute-...") |
m ((username removed) (log details removed)) |
||
(9 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
When you set Versioned on a class we never use sql-command-update or delete for that class. Instead we use insert with TimeStampStart and TimeStampStop added as non-attribute-db-columns. | When you set Versioned on a class, we never use sql-command-update or delete for that class. Instead, we use insert with TimeStampStart and TimeStampStop added as non-attribute-db-columns. | ||
You can | You can track all the changes done on an object and retrieve old versions of that object with operators like [[OCLOperators allInstancesAtTime|allInstancesAtTime]], [[OCLOperators atTime|atTime]], or [[OCLOperators objectTimeStamp|objectTimeStamp.]] | ||
If Class1 is versioned, this is a valid expression: | |||
Class1.allinstances.changepoints(0,-1)->collect(x|x,x.objectTimeStamp, x.objectTimeStamp.timeStampToTime,x.objectTimeStamp.timeStampToTime.timeToTimeStamp) | |||
* '''Class1.allinstances.changepoints(0,-1)''': Gives a list of all versions of all Class1 objects | |||
* '''x.objectTimeStamp''' : gives the integer number timestamp | |||
* '''x.objectTimeStamp.timeStampToTime''' : looks up the corresponding calendar DateTime from ClockLog | |||
* '''x.objectTimeStamp.timeStampToTime.timeToTimeStamp''' : looks up the integer timestamp from a DateTime | |||
I had one Class1 object that I had changed 3 times: | |||
{| class="wikitable" | |||
|Eco.Framework.Impl.Frontside.DefaultLoopback | |||
|0 | |||
|2022-10-26 13:09:25 | |||
|0 | |||
|- | |||
|Eco.Framework.Impl.Frontside.DefaultLoopback | |||
|1 | |||
|2022-10-26 13:09:28 | |||
|1 | |||
|- | |||
|Eco.Framework.Impl.Frontside.DefaultLoopback | |||
|2 | |||
|2022-10-26 15:56:48 | |||
|2147483647 | |||
|} | |||
[[Category:Advanced]] | |||
[[Category:SQL]] |
Latest revision as of 06:55, 11 January 2024
When you set Versioned on a class, we never use sql-command-update or delete for that class. Instead, we use insert with TimeStampStart and TimeStampStop added as non-attribute-db-columns.
You can track all the changes done on an object and retrieve old versions of that object with operators like allInstancesAtTime, atTime, or objectTimeStamp.
If Class1 is versioned, this is a valid expression:
Class1.allinstances.changepoints(0,-1)->collect(x|x,x.objectTimeStamp, x.objectTimeStamp.timeStampToTime,x.objectTimeStamp.timeStampToTime.timeToTimeStamp)
- Class1.allinstances.changepoints(0,-1): Gives a list of all versions of all Class1 objects
- x.objectTimeStamp : gives the integer number timestamp
- x.objectTimeStamp.timeStampToTime : looks up the corresponding calendar DateTime from ClockLog
- x.objectTimeStamp.timeStampToTime.timeToTimeStamp : looks up the integer timestamp from a DateTime
I had one Class1 object that I had changed 3 times:
Eco.Framework.Impl.Frontside.DefaultLoopback | 0 | 2022-10-26 13:09:25 | 0 |
Eco.Framework.Impl.Frontside.DefaultLoopback | 1 | 2022-10-26 13:09:28 | 1 |
Eco.Framework.Impl.Frontside.DefaultLoopback | 2 | 2022-10-26 15:56:48 | 2147483647 |
This page was edited more than 1 years ago on 01/11/2024. What links here