Support for TEMP tables

The folks at iAnywhere have recommended I use temp tables when setting up a demo. Temp tables are created on the fly when the demo user logs on, populated with records, then discarded when the user quits. Thus a secure demo environment with a stable set of sample records.

For this to work, however, Servoy needs to request the temp table rather than the conventional one when looking up a table. This may be simply a matter of proper configuration.

Possible? Or are temp tables totally unsupportable within Servoy?

There are 2 ways to use temp tables in servoy

  1. via datasetByQuery icw rawSQL plugin
  2. using different databases with same datamodel and switchServer fuction

I guess option 1 is obvious, about option 2:
-create a solution on server/tables like you normally do
-create temptables (with same names/columns) in another database and fill it with demo data
-now using databaseManager.switchServer(…) you can make servoy dynamicaly work on the temptables without breaking any databinding (assuming the datamodel and the temp datamodel are the same)

Jan,

Maybe, for a future version, we could have switchTable as well, so the use of temp tables could be made easier?

Paul

Jan Blok:
There are 2 ways to use temp tables in servoy

  1. via datasetByQuery icw rawSQL plugin
  2. using different databases with same datamodel and switchServer fuction

I guess option 1 is obvious, about option 2:
-create a solution on server/tables like you normally do
-create temptables (with same names/columns) in another database and fill it with demo data
-now using databaseManager.switchServer(…) you can make servoy dynamicaly work on the temptables without breaking any databinding (assuming the datamodel and the temp datamodel are the same)

Would appreciate some samples of the SQL statements Option2 issues to the database. That would make understanding the dialogue between Servoy and the database much clearer.

Am I correct in my assumption the databaseManager.switchServer(…) call can be made just once at the front of the user’s session?

Morley,

The SWITCH command allows you to temporarily reference a different database (with the same schema) so you can write temporary data, or have a separate “production” environment from “developement” environment, or test with “real” data that lives on another server, etc.

You can switch back and forth as many times as you want during a single client session.