Load all objects of m_type in the database into memory.
140{
141 gnc_commodity_table* pTable;
142
144 std::string sql("SELECT * FROM " COMMODITIES_TABLE);
145 auto stmt = sql_be->create_statement_from_sql(sql);
147
148 for (auto row : *result)
149 {
150 auto pCommodity = load_single_commodity (sql_be, row);
151
152 if (pCommodity != NULL)
153 {
155
160 qof_instance_set_guid (QOF_INSTANCE (pCommodity), &guid);
161 }
162
163 }
164 std::string pkey(col_table[0]->name());
165 sql = "SELECT DISTINCT ";
166 sql += pkey + " FROM " COMMODITIES_TABLE;
167 gnc_sql_slots_load_for_sql_subquery (sql_be, sql,
168 (BookLookupFn)gnc_commodity_find_commodity_by_guid);
169}
void commodity_for_postload_processing(gnc_commodity *)
Register a commodity to be committed after loading is complete.
GncSqlResultPtr execute_select_statement(const GncSqlStatementPtr &stmt) const noexcept
Executes an SQL SELECT statement and returns the result rows.
gnc_commodity_table * gnc_commodity_table_get_table(QofBook *book)
Returns the commodity table associated with a book.
gnc_commodity * gnc_commodity_table_insert(gnc_commodity_table *table, gnc_commodity *comm)
Add a new commodity to the commodity table.
#define qof_instance_is_dirty
Return value of is_dirty flag.
const GncGUID * qof_instance_get_guid(gconstpointer inst)
Return the GncGUID of this instance.
The type used to store guids in C.