mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Use a std::unique_ptr for GncSqlStatement for better memory management.
This commit is contained in:
@@ -143,14 +143,12 @@ load_single_commodity (GncSqlBackend* be, GncSqlRow& row)
|
||||
void
|
||||
GncSqlCommodityBackend::load_all (GncSqlBackend* be)
|
||||
{
|
||||
GncSqlStatement* stmt;
|
||||
gnc_commodity_table* pTable;
|
||||
|
||||
pTable = gnc_commodity_table_get_table (be->book);
|
||||
stmt = gnc_sql_create_select_statement (be, COMMODITIES_TABLE);
|
||||
if (stmt == NULL) return;
|
||||
auto stmt = gnc_sql_create_select_statement (be, COMMODITIES_TABLE);
|
||||
if (stmt == nullptr) return;
|
||||
auto result = gnc_sql_execute_select_statement (be, stmt);
|
||||
delete stmt;
|
||||
|
||||
for (auto row : *result)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user