コード例 #1
0
ファイル: gnc-invoice-sql.cpp プロジェクト: Isendir/gnucash
static void
load_all_invoices( GncSqlBackend* be )
{
    GncSqlStatement* stmt;
    GncSqlResult* result;

    g_return_if_fail( be != NULL );

    stmt = gnc_sql_create_select_statement( be, TABLE_NAME );
    result = gnc_sql_execute_select_statement( be, stmt );
    gnc_sql_statement_dispose( stmt );
    if ( result != NULL )
    {
        GncSqlRow* row;
        GList* list = NULL;

        row = gnc_sql_result_get_first_row( result );
        while ( row != NULL )
        {
            GncInvoice* pInvoice = load_single_invoice( be, row );
            if ( pInvoice != NULL )
            {
                list = g_list_append( list, pInvoice );
            }
            row = gnc_sql_result_get_next_row( result );
        }
        gnc_sql_result_dispose( result );

        if ( list != NULL )
        {
            gnc_sql_slots_load_for_list( be, list );
            g_list_free( list );
        }
    }
}
コード例 #2
0
ファイル: gnc-invoice-sql.cpp プロジェクト: tmertens/gnucash
void
GncSqlInvoiceBackend::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());
    auto result = be->execute_select_statement(stmt);
    InstanceVec instances;

    for (auto row : *result)
    {
        GncInvoice* pInvoice = load_single_invoice (be, row);
        if (pInvoice != nullptr)
            instances.push_back(QOF_INSTANCE(pInvoice));
    }

    if (!instances.empty())
        gnc_sql_slots_load_for_instancevec (be, instances);
}