19.0.0 released Nov 08, 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


You are free to copy, redistribute and adapt this web page (even commercially), as long as you give credit and provide a dofollow link back to this page - see full license at CC-BY-4.0. Copyright (c) 2019-2023 Dasoftver LLC. Vely and elephant logo are trademarks of Dasoftver LLC. The software and information on this web site are provided "AS IS" and without any warranties or guarantees of any kind. Icons from table-icons.io copyright PaweĊ‚ Kuna, licensed under MIT license.