Mudlet 2.1 Database Problem
Re: Mudlet 2.1 Database Problem
This change is in now. I'll look at colour echoing things next and come back to reviewing editing dates in this.
Re: Mudlet 2.1 Database Problem
This has been fixed now, the following code updates the records without errors or breaking them:Jor'Mox wrote:Specifically, this happens. You create a new record. You retrieve that record using a fetch command, and all the data is there as expected. You then try to change any field, and update the record, and an error is generated because the Timestamp format is not recognized.
Re: Mudlet 2.1 Database Problem
This has been fixed as well. Test with the following example using the latest DB.lua as a script before the examples. Please make sure to remove your copy of DB.lua when you upgrade Mudlet - if you don't, you'll never get any DB-related upgrades via Mudlet updates (as your old copy overwrites).Jor'Mox wrote:Then even when that problem is overcome, you have no way of automatically generating a new Timestamp for the record if desired, which leads to problems, since the most obvious solution is to replace the epoch value currently stored with one generated by your computer, which will be in local time. So if the record is retrieved again, and the change was made shortly after the initial record was created, it will actually show the record as having a Timestamp from before it was created.
The example above will always set the time to the current time, showing that modification is working okay.
Setting the _timestamp field directly when the timestamp is supposed to be an object isn't the best, so I'll add a number of set methods for it to be nicer.
Re: Mudlet 2.1 Database Problem
Once I'm not on my phone, I'll have to check out how you did it. I'm a curious kind of guy. ![Wink ;-)](./images/smilies/icon_e_wink.gif)
Question for you though, does this save the time stamps to the database as a string (matching the format used when they are created) or as epoch values? I know my "fix" just made it accept epoch values as valid values, but I would think that preserving the format would be nicer.
![Wink ;-)](./images/smilies/icon_e_wink.gif)
Question for you though, does this save the time stamps to the database as a string (matching the format used when they are created) or as epoch values? I know my "fix" just made it accept epoch values as valid values, but I would think that preserving the format would be nicer.
Re: Mudlet 2.1 Database Problem
It still saves them in DATETIME format as it did. SQLite presents an option of using TIME, DATE or DATETIME for doing so.
Re: Mudlet 2.1 Database Problem
Any luck in confirming the fixes?