unload _sv_inmem

Hello!

How can I unload from the memory _sv_inmem tables?

i do this:

var dataset = databaseManager.getDataSetByQuery(globals.databaseName, query, _parPKs, -1);
_fs = databaseManager.getFoundSet(dataset.createDataSource('memTable'+globals.getUUID()))
_fs.loadAllRecords()

i need to unload this foundset

thanks

Hi,

To clear the in-memory table you simply do the same thing to load it but now with an empty dataset. Just make sure you pass the same column count and types.

Hope this helps.

Thaks for the tip…

is the same thing if I assign NULL to my _fs ?

It’s not the same. When you nullify a variable it can be garbage collected.
In memory tables are on the server BUT are session-bound and once created they stay there until you close the client. You can not ‘drop’ these tables.
So it’s important to manage (as in empty) these tables yourself when you don’t use them anymore and reuse them as much as possible when in the same session.

Hope this makes things clearer.

Perfect! Thanks a lot!! =)

Hi,

That should work, but the official (and simpeler) way is to delete all records from the dataset or the fiundset (has the same effect in this case):

var dataset = databaseManager.getDataSetByQuery(globals.databaseName, query, _parPKs, -1);
_fs = databaseManager.getFoundSet(dataset.createDataSource('memTable'+globals.getUUID()))
_fs.loadAllRecords()

...

dataset.removeRow(-1); //removes all rows
// or
_fs..deleteAllRecords();

Note that the table structure will live as long as the client lives.

Rob