Load all objects of m_type in the database into memory.
138{
139 gnc_commodity_table* pTable;
140
142 std::string sql("SELECT * FROM " COMMODITIES_TABLE);
143 auto stmt = sql_be->create_statement_from_sql(sql);
145
146 for (auto row : *result)
147 {
148 auto pCommodity = load_single_commodity (sql_be, row);
149
150 if (pCommodity != NULL)
151 {
153
158 qof_instance_set_guid (QOF_INSTANCE (pCommodity), &guid);
159 }
160
161 }
162 std::string pkey(col_table[0]->name());
163 sql = "SELECT DISTINCT ";
164 sql += pkey + " FROM " COMMODITIES_TABLE;
165 gnc_sql_slots_load_for_sql_subquery (sql_be, sql,
166 (BookLookupFn)gnc_commodity_find_commodity_by_guid);
167}
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.