|
Post by mythrix on Dec 27, 2021 10:09:27 GMT
Hi,
As per my thread a few weeks ago I wanted to add a new table to my users' database and managed to do so manually.
In order to do that I followed the advice in the manual about version control, so have a version number in a different table that the game can then update from by adding the table if the user comes in with an old version.
That mostly works fine, but sometimes if the player does something odd like alt-f4 during game creation for example, then it all goes wrong. At that point the database thinks it isn't updated but it actually is, and so it tries to add the table again and crashes. At this point the game is permanently broken because this happens on start up. That's just one example - a few things can cause this and I don't know what all of them are.
The super simple solution would be some way to test if the table actually exists before trying to add it, but I can't see any apparent way to test for existence without causing a crash. Am I missing something?
Or does anyone have any other simple solution to this issue? Essentially by using version control I've opened myself up to potentially game breaking crashes when trying to update and would like a more stable way to do it.
Thanks!
|
|
|
Post by echo17 on Dec 27, 2021 14:58:10 GMT
Please see this FAQ: FAQYou'll just need to modify the query to filter on the table name that you would like to test, something like: "SELECT name FROM sqlite_master WHERE type = 'table' and name = 'myTable'"
You can use the QueryFirstRecord method to see if the record exists.
|
|
|
Post by mythrix on Dec 27, 2021 21:21:28 GMT
Please see this FAQ: FAQYou'll just need to modify the query to filter on the table name that you would like to test, something like: "SELECT name FROM sqlite_master WHERE type = 'table' and name = 'myTable'"
You can use the QueryFirstRecord method to see if the record exists.
Thank you for the quick reply - great support. I'll give this a go.
|
|
|
Post by mythrix on Jan 9, 2022 16:19:34 GMT
Was busy of Christmas but just tested this FAQ solution out. It was exactly what I needed, thank you.
After some success with my game on Steam (3k sales) I'm now about to start a new project, and this will be at the heart of the new one once again. Really appreciate the hard work you've put in to making it so functional; excellent product.
|
|
|
Post by echo17 on Jan 9, 2022 17:56:45 GMT
Awesome! Thanks so much for the kinds words and update. Congratulations on your success! If you want to post a link to your game here, that might inspire others (and send some sales your way )
|
|