This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
In our system, we have a single database server with many middle tier clients. So, we'd like to generate timestamps on the database server Our platform is SQL Server which allows this construct with the DEFAULT keyword
Note that most database calls are via Lightspeed unless performance is critical (we have up to 100k writes per second) where we use stored procedures. In the stored procedures the RDBMS generates timestamps (as above), so even if we made the middle tier use some whizzy timestamp generator, we'd still have differences in the system as a whole This SQL construct means
Is this possible in Lightspeed please? Thanks Shawn aka gbn Repro script:
|
|
|
This isn't currently possible in LightSpeed because LightSpeed expects to update the in-memory copy of the entity as well as the database record, and the current architecture doesn't support reading values out of the database. I'm investigating an approach where we would update the in-memory copy with our best estimate of the time while letting the database do its own thing; this would mean that after saving the in-memory entity could be out of sync with the database record depending on the clock difference between the middle tier and the RDBMS. This probably wouldn't be an issue unless you intended to use the in-memory entity after the save. Is that something you'd want to be able to do? (Please note we are not committing to offering this feature -- just looking at feasibility.) |
|
|
Thank you The database will be read/extracted separately for MIS and BI purposes which is where the importance of coherent timestamps becomes important. So this would be sufficient, if Lightspeed could issue the UPDATE with the DEFAULT keyword An UPDATE without DEFAULT won't affect the column in SQL Server. This is different to MySQL's auto-update on a |
|
|
Hi Shawn, This will be in the next nightly build. To use it, implement a custom timestamp strategy (as explained in the LightSpeed user guide), and have your strategy class implement the new
As previously mentioned LightSpeed will NOT read back the timestamp generated by the database. After saving changes, therefore, the entity will contain the timestamp returned from IAutoTimestampStrategy.GetTime(). If your application needs to know the timestamp generated by the database, you will need to reload the entity. If your application needs to be portable across different database engines, you can use the LightSpeedContext.DataProvider value to determine which database is being targeted. Please let us know if you run into any problems or have any feedback! |
|
|
Thank you: this is very good service It'll be next week now before we can test I'm sorry. |
|