static void load_all_lots( GncSqlBackend* be ) { GncSqlStatement* stmt; GncSqlResult* result; g_return_if_fail( be != NULL ); stmt = gnc_sql_create_select_statement( be, TABLE_NAME ); if ( stmt != NULL ) { result = gnc_sql_execute_select_statement( be, stmt ); gnc_sql_statement_dispose( stmt ); if ( result != NULL ) { GncSqlRow* row = gnc_sql_result_get_first_row( result ); gchar* sql; while ( row != NULL ) { load_single_lot( be, row ); row = gnc_sql_result_get_next_row( result ); } gnc_sql_result_dispose( result ); sql = g_strdup_printf( "SELECT DISTINCT guid FROM %s", TABLE_NAME ); gnc_sql_slots_load_for_sql_subquery( be, sql, (BookLookupFn)gnc_lot_lookup ); g_free( sql ); } } }
void GncSqlLotsBackend::load_all (GncSqlBackend* be) { g_return_if_fail (be != NULL); std::stringstream sql; sql << "SELECT * FROM " << TABLE_NAME; auto stmt = be->create_statement_from_sql(sql.str()); if (stmt != nullptr) { auto result = be->execute_select_statement(stmt); if (result->begin () == nullptr) return; for (auto row : *result) load_single_lot (be, row); auto sql = g_strdup_printf ("SELECT DISTINCT guid FROM %s", TABLE_NAME); gnc_sql_slots_load_for_sql_subquery (be, sql, (BookLookupFn)gnc_lot_lookup); g_free (sql); } }