GnuCash  5.6-150-g038405b370+
Data Structures | Functions
gnc-transaction-sql.h File Reference

load and save data to SQL More...

#include "Transaction.h"
#include "qof.h"
#include "Account.h"

Go to the source code of this file.

Data Structures

class  GncSqlTransBackend
 
class  GncSqlSplitBackend
 
struct  acct_balances_t
 

Functions

void gnc_sql_transaction_load_tx_for_account (GncSqlBackend *sql_be, Account *account)
 Loads all transactions which have splits for a specific account. More...
 

Detailed Description

load and save data to SQL

Author
Copyright (c) 2006-2008 Phil Longstaff plong.nosp@m.staf.nosp@m.f@rog.nosp@m.ers..nosp@m.com

This file implements the top-level QofBackend API for saving/ restoring data to/from an SQL database

Definition in file gnc-transaction-sql.h.

Function Documentation

◆ gnc_sql_transaction_load_tx_for_account()

void gnc_sql_transaction_load_tx_for_account ( GncSqlBackend sql_be,
Account account 
)

Loads all transactions which have splits for a specific account.

Parameters
sql_beSQL backend
accountAccount

Loads all transactions which have splits for a specific account.

Parameters
sql_beSQL backend
accountAccount

Definition at line 687 of file gnc-transaction-sql.cpp.

689 {
690  const GncGUID* guid;
691 
692  g_return_if_fail (sql_be != NULL);
693  g_return_if_fail (account != NULL);
694 
695  guid = qof_instance_get_guid (QOF_INSTANCE (account));
696 
697  const std::string tpkey(tx_col_table[0]->name()); //guid
698  const std::string spkey(split_col_table[0]->name()); //guid
699  const std::string stkey(split_col_table[1]->name()); //txn_guid
700  const std::string sakey(split_col_table[2]->name()); //account_guid
701  std::string sql("(SELECT DISTINCT ");
702  sql += stkey + " FROM " SPLIT_TABLE " WHERE " + sakey + " = '";
703  sql += gnc::GUID(*guid).to_string() + "')";
704  query_transactions (sql_be, sql);
705 }
const GncGUID * qof_instance_get_guid(gconstpointer inst)
Return the GncGUID of this instance.
The type used to store guids in C.
Definition: guid.h:75