|
Post by gamer2300 on Dec 3, 2020 10:51:55 GMT
Hi I have to create an application that needs databases. Using simplesql I should do this: 1) the user opens the application and an empty db has already been defined, where the user stores data in a table. 2) When the user creates a row in the first table, it is necessary to create another database associated with that row and which contains another table, which the user can fill with his data.
This (2) happen every time the user create a new row in initial db. so i must create several db one for each row. but only if a row is created.
How should I behave using simplesql, is this possible?
|
|
|
Post by echo17 on Dec 3, 2020 13:45:23 GMT
Every time you create a row, you can just extract a template database into the user's working directory. Please see this FAQ on how to change a database at runtime: linkThe key here would be that you would have two database managers in your scene: one for the main database where the record is written, and one for the newly created database. One thing you would need to change in the code from the FAQ above is you would need a different workingName for each database to avoid overwriting the others. So, to modify the FAQ code a bit, it would look something like: TextAsset databaseFile = (TextAsset)Resources.Load("fantasy"); manager.databaseFile = databaseFile; manager.changeWorkingName = true; manager.workingName = newDatabaseName; manager.Initialize(true);
Where newDatabaseName is the name of the new database to be created. If you need all the databases open at once, then you'll need to create an array or list of SimpleSQLManager objects, one for each of the databases.
|
|
|
Post by gamer2300 on Dec 5, 2020 11:25:49 GMT
thanks for support|
|
|