Vely logo install | documentation | examples | changelog
16.10.0 released May 10, 2023
delete-query

Purpose: Delete memory associated with a query.

delete-query <query name> [ skip-data ]

A named query (see clause "name" in run-query) can be deleted with delete-query by specifying the <query name>. Deletion means that all memory allocated for a query will be freed. It means query results will be freed as well. Do not delete query if its results are still referenced afterwards.

However, if "skip-data" clause is used, then the query results will not be deleted; rather everything else will be. This means the results of query-result statement or "output define" clause in run-query statement will not be freed. This is useful if you want to keep the results of a query and otherwise release all of its resources. Note that the results will remain allocated even if you do not obtain them via "query-result" or "output define" clause, for instance.

Make sure not to delete anything twice. For instance, do not use delete-mem to delete query data such as error message, column name or results, while using delete-query as well. By the same token, if you use "skip-data", you can use delete-mem to free query results later.

See memory_handling for more on when (not) to delete memory explicitly like this; the same rules apply as for delete-mem.
Examples
run-query @db="drop table if exists test" no-loop name drop_query
delete-query drop_query

See also
Database ( begin-transaction   commit-transaction   current-row   database_config_file   database_queries   delete-query   on-error   prepared_statements   query-result   rollback-transaction   run-query  )  SEE ALL (documentation)


Copyright (c) 2017-2023 Dasoftver LLC