MyMoneyDatabaseMgr Class Reference

#include <mymoneydatabasemgr.h>

Inheritance diagram for MyMoneyDatabaseMgr:

IMyMoneyStorage IMyMoneySerialize MyMoneyKeyValueContainer
Collaboration diagram for MyMoneyDatabaseMgr:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 MyMoneyDatabaseMgr ()
 ~MyMoneyDatabaseMgr ()
virtual const MyMoneyPayee user (void) const
virtual const QDate creationDate (void) const
virtual const QDate lastModificationDate (void) const
virtual unsigned int currentFixVersion (void) const
virtual unsigned int fileFixVersion (void) const
virtual void setUser (const MyMoneyPayee &user)
virtual void setFileFixVersion (const unsigned int v)
virtual void setValue (const QString &key, const QString &value)
virtual const QString value (const QString &key) const
virtual void deletePair (const QString &key)
virtual MyMoneyDatabaseMgr const * duplicate (void)
virtual void addAccount (MyMoneyAccount &account)
virtual void addAccount (MyMoneyAccount &parent, MyMoneyAccount &account)
virtual void addPayee (MyMoneyPayee &payee)
virtual const MyMoneyPayee payee (const QString &id) const
virtual const MyMoneyPayee payeeByName (const QString &payee) const
virtual void modifyPayee (const MyMoneyPayee &payee)
virtual void removePayee (const MyMoneyPayee &payee)
virtual const QValueList
< MyMoneyPayee
payeeList (void) const
virtual const MyMoneyAccount account (const QString &id) const
virtual bool isStandardAccount (const QString &id) const
virtual void setAccountName (const QString &id, const QString &name)
virtual void addInstitution (MyMoneyInstitution &institution)
virtual void addTransaction (MyMoneyTransaction &transaction, const bool skipAccountUpdate=false)
virtual bool hasActiveSplits (const QString &id) const
virtual const MyMoneyMoney balance (const QString &id, const QDate &date) const
virtual const MyMoneyMoney totalBalance (const QString &id, const QDate &date) const
virtual const MyMoneyInstitution institution (const QString &id) const
virtual bool dirty (void) const
virtual void setDirty (void)
virtual unsigned int accountCount (void) const
virtual const QValueList
< MyMoneyInstitution
institutionList (void) const
virtual void modifyAccount (const MyMoneyAccount &account, const bool skipCheck=false)
virtual void modifyInstitution (const MyMoneyInstitution &institution)
virtual void modifyTransaction (const MyMoneyTransaction &transaction)
virtual void reparentAccount (MyMoneyAccount &account, MyMoneyAccount &parent)
virtual void removeTransaction (const MyMoneyTransaction &transaction)
virtual unsigned int transactionCount (const QString &account=QString()) const
virtual const QMap< QString,
unsigned long > 
transactionCountMap (void) const
virtual const QValueList
< MyMoneyTransaction
transactionList (MyMoneyTransactionFilter &filter) const
virtual void transactionList (QValueList< MyMoneyTransaction > &list, MyMoneyTransactionFilter &filter) const
virtual void transactionList (QValueList< QPair< MyMoneyTransaction, MyMoneySplit > > &list, MyMoneyTransactionFilter &filter) const
virtual void removeAccount (const MyMoneyAccount &account)
virtual void removeInstitution (const MyMoneyInstitution &institution)
virtual const MyMoneyTransaction transaction (const QString &id) const
virtual const MyMoneyTransaction transaction (const QString &account, const int idx) const
virtual unsigned int institutionCount (void) const
virtual void accountList (QValueList< MyMoneyAccount > &list) const
virtual const MyMoneyAccount liability (void) const
virtual const MyMoneyAccount asset (void) const
virtual const MyMoneyAccount expense (void) const
virtual const MyMoneyAccount income (void) const
virtual const MyMoneyAccount equity (void) const
virtual void addSecurity (MyMoneySecurity &security)
virtual void modifySecurity (const MyMoneySecurity &security)
virtual void removeSecurity (const MyMoneySecurity &security)
virtual const MyMoneySecurity security (const QString &id) const
virtual const QValueList
< MyMoneySecurity
securityList (void) const
virtual void addPrice (const MyMoneyPrice &price)
virtual void removePrice (const MyMoneyPrice &price)
virtual const MyMoneyPrice price (const QString &fromId, const QString &toId, const QDate &date, const bool exactDate) const
virtual const MyMoneyPriceList priceList (void) const
virtual void addSchedule (MyMoneySchedule &sched)
virtual void modifySchedule (const MyMoneySchedule &sched)
virtual void removeSchedule (const MyMoneySchedule &sched)
virtual const MyMoneySchedule schedule (const QString &id) const
virtual const QValueList
< MyMoneySchedule
scheduleList (const QString &accountId=QString(), const MyMoneySchedule::typeE type=MyMoneySchedule::TYPE_ANY, const MyMoneySchedule::occurenceE occurence=MyMoneySchedule::OCCUR_ANY, const MyMoneySchedule::paymentTypeE paymentType=MyMoneySchedule::STYPE_ANY, const QDate &startDate=QDate(), const QDate &endDate=QDate(), const bool overdue=false) const
virtual const QValueList
< MyMoneySchedule
scheduleListEx (int scheduleTypes, int scheduleOcurrences, int schedulePaymentTypes, QDate startDate, const QStringList &accounts=QStringList()) const
virtual void addCurrency (const MyMoneySecurity &currency)
virtual void modifyCurrency (const MyMoneySecurity &currency)
virtual void removeCurrency (const MyMoneySecurity &currency)
virtual const MyMoneySecurity currency (const QString &id) const
virtual const QValueList
< MyMoneySecurity
currencyList (void) const
virtual const QValueList
< MyMoneyReport
reportList (void) const
virtual void addReport (MyMoneyReport &report)
virtual void modifyReport (const MyMoneyReport &report)
virtual unsigned countReports (void) const
virtual const MyMoneyReport report (const QString &id) const
virtual void removeReport (const MyMoneyReport &report)
virtual const QValueList
< MyMoneyBudget
budgetList (void) const
virtual void addBudget (MyMoneyBudget &budget)
virtual const MyMoneyBudget budgetByName (const QString &budget) const
virtual void modifyBudget (const MyMoneyBudget &budget)
virtual unsigned countBudgets (void) const
virtual MyMoneyBudget budget (const QString &id) const
virtual void removeBudget (const MyMoneyBudget &budget)
virtual void clearCache (void)
virtual bool isReferenced (const MyMoneyObject &obj, const MyMoneyFileBitArray &skipCheck=MyMoneyFileBitArray()) const
virtual void close (void)
virtual void startTransaction (void)
virtual bool commitTransaction (void)
virtual void rollbackTransaction (void)
virtual void setCreationDate (const QDate &val)
virtual KSharedPtr
< MyMoneyStorageSql
connectToDatabase (const KURL &url)
virtual void fillStorage ()
virtual void setLastModificationDate (const QDate &val)
virtual bool isDuplicateTransaction (const QString &) const
virtual void loadAccounts (const QMap< QString, MyMoneyAccount > &map)
virtual void loadTransactions (const QMap< QString, MyMoneyTransaction > &map)
virtual void loadInstitutions (const QMap< QString, MyMoneyInstitution > &map)
virtual void loadPayees (const QMap< QString, MyMoneyPayee > &map)
virtual void loadSchedules (const QMap< QString, MyMoneySchedule > &map)
virtual void loadSecurities (const QMap< QString, MyMoneySecurity > &map)
virtual void loadCurrencies (const QMap< QString, MyMoneySecurity > &map)
virtual void loadReports (const QMap< QString, MyMoneyReport > &reports)
virtual void loadBudgets (const QMap< QString, MyMoneyBudget > &budgets)
virtual void loadPrices (const MyMoneyPriceList &list)
virtual unsigned long accountId (void) const
virtual unsigned long transactionId (void) const
virtual unsigned long payeeId (void) const
virtual unsigned long institutionId (void) const
virtual unsigned long scheduleId (void) const
virtual unsigned long securityId (void) const
virtual unsigned long reportId (void) const
virtual unsigned long budgetId (void) const
virtual void loadAccountId (const unsigned long id)
virtual void loadTransactionId (const unsigned long id)
virtual void loadPayeeId (const unsigned long id)
virtual void loadInstitutionId (const unsigned long id)
virtual void loadScheduleId (const unsigned long id)
virtual void loadSecurityId (const unsigned long id)
virtual void loadReportId (const unsigned long id)
virtual void loadBudgetId (const unsigned long id)
virtual const QMap< QString,
QString > 
pairs (void) const
virtual void setPairs (const QMap< QString, QString > &list)
virtual void rebuildAccountBalances (void)

Private Member Functions

const QString nextInstitutionID (void)
const QString nextAccountID (void)
const QString nextTransactionID (void)
const QString nextPayeeID (void)
const QString nextScheduleID (void)
const QString nextSecurityID (void)
const QString nextReportID (void)
const QString nextBudgetID (void)
void removeReferences (const QString &id)

Private Attributes

QDate m_creationDate
unsigned int m_currentFixVersion
unsigned int m_fileFixVersion
QDate m_lastModificationDate
KSharedPtr< MyMoneyStorageSqlm_sql
MyMoneyPayee m_user

Static Private Attributes

static const int INSTITUTION_ID_SIZE = 6
static const int ACCOUNT_ID_SIZE = 6
static const int TRANSACTION_ID_SIZE = 18
static const int PAYEE_ID_SIZE = 6
static const int SCHEDULE_ID_SIZE = 6
static const int SECURITY_ID_SIZE = 6
static const int REPORT_ID_SIZE = 6
static const int BUDGET_ID_SIZE = 6
static const int CURRENT_FIX_VERSION = 3


Detailed Description

The MyMoneyDatabaseMgr class represents the storage engine for databases. The actual connection and internal storage is handled through the MyMoneyStorageSql interface.

The MyMoneyDatabaseMgr must have a MyMoneyStorageSql connected to a database to be useful. Once connected, data will be loaded from/sent to the database synchronously. The method dirty() will always return false. Making this many trips to the database is not very fast, so when possible, the data cache in MyMoneyFile is used.


Constructor & Destructor Documentation

MyMoneyDatabaseMgr::MyMoneyDatabaseMgr (  ) 

MyMoneyDatabaseMgr::~MyMoneyDatabaseMgr (  ) 


Member Function Documentation

virtual const MyMoneyPayee MyMoneyDatabaseMgr::user ( void   )  const [virtual]

Implements IMyMoneySerialize.

virtual const QDate MyMoneyDatabaseMgr::creationDate ( void   )  const [virtual]

Implements IMyMoneySerialize.

virtual const QDate MyMoneyDatabaseMgr::lastModificationDate ( void   )  const [virtual]

Implements IMyMoneySerialize.

virtual unsigned int MyMoneyDatabaseMgr::currentFixVersion ( void   )  const [virtual]

Implements IMyMoneySerialize.

virtual unsigned int MyMoneyDatabaseMgr::fileFixVersion ( void   )  const [virtual]

Implements IMyMoneySerialize.

virtual void MyMoneyDatabaseMgr::setUser ( const MyMoneyPayee user  )  [virtual]

Implements IMyMoneySerialize.

virtual void MyMoneyDatabaseMgr::setFileFixVersion ( const unsigned int  v  )  [virtual]

Implements IMyMoneySerialize.

virtual void MyMoneyDatabaseMgr::setValue ( const QString &  key,
const QString &  value 
) [virtual]

This method is used to add a key/value pair to the container or modify an existing pair.

Parameters:
key const reference to QString with the key to search for
value const reference to QString with the value for this key

Reimplemented from MyMoneyKeyValueContainer.

virtual const QString MyMoneyDatabaseMgr::value ( const QString &  key  )  const [virtual]

This method can be used to retrieve the value for a specific key. If the key is unknown in this container, an empty string will be returned.

Parameters:
key const reference to QString with the key to search for
Returns:
reference to value of this key. If the key does not exist, an emtpy string is returned.

Reimplemented from MyMoneyKeyValueContainer.

virtual void MyMoneyDatabaseMgr::deletePair ( const QString &  key  )  [virtual]

This method is used to remove an existing key/value pair from the container. If the key does not exist, the container is not changed.

Parameters:
key const reference to QString with the key to remove

Reimplemented from MyMoneyKeyValueContainer.

virtual MyMoneyDatabaseMgr const* MyMoneyDatabaseMgr::duplicate ( void   )  [virtual]

This method is used to duplicate an IMyMoneyStorage object and return a pointer to the newly created copy. The caller of this method is the new owner of the object and must destroy it.

Implements IMyMoneyStorage.

virtual void MyMoneyDatabaseMgr::addAccount ( MyMoneyAccount account  )  [virtual]

This method is used to create a new account

An exception will be thrown upon error conditions.

Parameters:
account MyMoneyAccount filled with data

Implements IMyMoneySerialize.

virtual void MyMoneyDatabaseMgr::addAccount ( MyMoneyAccount parent,
MyMoneyAccount account 
) [virtual]

This method is used to add one account as sub-ordinate to another (parent) account. The objects that are passed will be modified accordingly.

An exception will be thrown upon error conditions.

Parameters:
parent parent account the account should be added to
account the account to be added

Implements IMyMoneySerialize.

virtual void MyMoneyDatabaseMgr::addPayee ( MyMoneyPayee payee  )  [virtual]

This method is used to create a new payee

An exception will be thrown upon error conditions

Parameters:
payee MyMoneyPayee reference to payee information

Implements IMyMoneySerialize.

virtual const MyMoneyPayee MyMoneyDatabaseMgr::payee ( const QString &  id  )  const [virtual]

This method is used to retrieve information about a payee An exception will be thrown upon error conditions.

Parameters:
id QString reference to id of payee
Returns:
MyMoneyPayee object of payee

Implements IMyMoneyStorage.

virtual const MyMoneyPayee MyMoneyDatabaseMgr::payeeByName ( const QString &  payee  )  const [virtual]

This method is used to retrieve the id to a corresponding name of a payee/receiver. An exception will be thrown upon error conditions.

Parameters:
payee QString reference to name of payee
Returns:
MyMoneyPayee object of payee

Implements IMyMoneyStorage.

virtual void MyMoneyDatabaseMgr::modifyPayee ( const MyMoneyPayee payee  )  [virtual]

This method is used to modify an existing payee

An exception will be thrown upon error conditions

Parameters:
payee MyMoneyPayee reference to payee information

Implements IMyMoneyStorage.

virtual void MyMoneyDatabaseMgr::removePayee ( const MyMoneyPayee payee  )  [virtual]

This method is used to remove an existing payee

An exception will be thrown upon error conditions

Parameters:
payee MyMoneyPayee reference to payee information

Implements IMyMoneyStorage.

virtual const QValueList<MyMoneyPayee> MyMoneyDatabaseMgr::payeeList ( void   )  const [virtual]

This method returns a list of the payees inside a MyMoneyStorage object

Returns:
QValueList<MyMoneyPayee> containing the payee information

Implements IMyMoneySerialize.

virtual const MyMoneyAccount MyMoneyDatabaseMgr::account ( const QString &  id  )  const [virtual]

Returns the account addressed by it's id.

An exception will be thrown upon error conditions.

Parameters:
id id of the account to locate.
Returns:
reference to MyMoneyAccount object. An exception is thrown if the id is unknown

Implements IMyMoneyStorage.

virtual bool MyMoneyDatabaseMgr::isStandardAccount ( const QString &  id  )  const [virtual]

This method is used to check whether a given account id references one of the standard accounts or not.

An exception will be thrown upon error conditions.

Parameters:
id account id
Returns:
true if account-id is one of the standards, false otherwise

Implements IMyMoneyStorage.

virtual void MyMoneyDatabaseMgr::setAccountName ( const QString &  id,
const QString &  name 
) [virtual]

This method is used to set the name for the specified standard account within the storage area. An exception will be thrown, if an error occurs

Parameters:
id QString reference to one of the standard accounts.
name QString reference to the name to be set

Implements IMyMoneyStorage.

virtual void MyMoneyDatabaseMgr::addInstitution ( MyMoneyInstitution institution  )  [virtual]

Adds an institution to the storage. A respective institution-ID will be generated within this record. The ID is stored as QString in the object passed as argument.

An exception will be thrown upon error conditions.

Parameters:
institution The complete institution information in a MyMoneyInstitution object

Implements IMyMoneySerialize.

virtual void MyMoneyDatabaseMgr::addTransaction ( MyMoneyTransaction transaction,
const bool  skipAccountUpdate = false 
) [virtual]

Adds a transaction to the file-global transaction pool. A respective transaction-ID will be generated within this record. The ID is stored QString with the object.

An exception will be thrown upon error conditions.

Parameters:
transaction reference to the transaction
skipAccountUpdate if set, the transaction lists of the accounts referenced in the splits are not updated. This is used for bulk loading a lot of transactions but not during normal operation

Implements IMyMoneySerialize.

virtual bool MyMoneyDatabaseMgr::hasActiveSplits ( const QString &  id  )  const [virtual]

This method is used to determince, if the account with the given ID is referenced by any split in m_transactionList.

An exception will be thrown upon error conditions.

Parameters:
id id of the account to be checked for
Returns:
true if account is referenced, false otherwise

Implements IMyMoneyStorage.

virtual const MyMoneyMoney MyMoneyDatabaseMgr::balance ( const QString &  id,
const QDate &  date 
) const [virtual]

This method is used to return the actual balance of an account without it's sub-ordinate accounts. If a date is presented, the balance at the beginning of this date (not including any transaction on this date) is returned. Otherwise all recorded transactions are included in the balance.

Parameters:
id id of the account in question
date return balance for specific date
Returns:
balance of the account as MyMoneyMoney object

Implements IMyMoneyStorage.

virtual const MyMoneyMoney MyMoneyDatabaseMgr::totalBalance ( const QString &  id,
const QDate &  date 
) const [virtual]

This method is used to return the actual balance of an account including it's sub-ordinate accounts. If a date is presented, the balance at the beginning of this date (not including any transaction on this date) is returned. Otherwise all recorded transactions are included in the balance.

Parameters:
id id of the account in question
date return balance for specific date
Returns:
balance of the account as MyMoneyMoney object

Implements IMyMoneyStorage.

virtual const MyMoneyInstitution MyMoneyDatabaseMgr::institution ( const QString &  id  )  const [virtual]

Returns the institution of a given ID

Parameters:
id id of the institution to locate
Returns:
MyMoneyInstitution object filled with data. If the institution could not be found, an exception will be thrown

Implements IMyMoneyStorage.

virtual bool MyMoneyDatabaseMgr::dirty ( void   )  const [virtual]

This method returns an indicator if the storage object has been changed after it has last been saved to permanent storage.

Returns:
true if changed, false if not (for a database, always false).

Implements IMyMoneyStorage.

virtual void MyMoneyDatabaseMgr::setDirty ( void   )  [virtual]

This method can be used by an external object to force the storage object to be dirty. This is used e.g. when an upload to an external destination failed but the previous storage to a local disk was ok.

Since the database is synchronized with the application, this method is a no-op.

Implements IMyMoneyStorage.

virtual unsigned int MyMoneyDatabaseMgr::accountCount ( void   )  const [virtual]

This method returns the number of accounts currently known to this storage in the range 0..MAXUINT

Returns:
number of accounts currently known inside a MyMoneyFile object

Implements IMyMoneyStorage.

virtual const QValueList<MyMoneyInstitution> MyMoneyDatabaseMgr::institutionList ( void   )  const [virtual]

This method returns a list of the institutions inside a MyMoneyStorage object

Returns:
QValueList<MyMoneyInstitution> containing the institution information

Implements IMyMoneySerialize.

virtual void MyMoneyDatabaseMgr::modifyAccount ( const MyMoneyAccount account,
const bool  skipCheck = false 
) [virtual]

Modifies an already existing account in the file global account pool.

An exception will be thrown upon error conditions.

Parameters:
account reference to the new account information
skipCheck allows to skip the builtin consistency checks

Implements IMyMoneyStorage.

virtual void MyMoneyDatabaseMgr::modifyInstitution ( const MyMoneyInstitution institution  )  [virtual]

Modifies an already existing institution in the file global institution pool.

An exception will be thrown upon error conditions.

Parameters:
institution The complete new institution information

Implements IMyMoneyStorage.

virtual void MyMoneyDatabaseMgr::modifyTransaction ( const MyMoneyTransaction transaction  )  [virtual]

This method is used to update a specific transaction in the transaction pool of the MyMoneyFile object

An exception will be thrown upon error conditions.

Parameters:
transaction reference to transaction to be changed

Implements IMyMoneyStorage.

virtual void MyMoneyDatabaseMgr::reparentAccount ( MyMoneyAccount account,
MyMoneyAccount parent 
) [virtual]

This method re-parents an existing account

An exception will be thrown upon error conditions.

Parameters:
account MyMoneyAccount reference to account to be re-parented
parent MyMoneyAccount reference to new parent account

Implements IMyMoneyStorage.

virtual void MyMoneyDatabaseMgr::removeTransaction ( const MyMoneyTransaction transaction  )  [virtual]

This method is used to remove a transaction from the transaction pool (journal).

An exception will be thrown upon error conditions.

Parameters:
transaction const reference to transaction to be deleted

Implements IMyMoneyStorage.

virtual unsigned int MyMoneyDatabaseMgr::transactionCount ( const QString &  account = QString()  )  const [virtual]

This method returns the number of transactions currently known to file in the range 0..MAXUINT

Parameters:
account QString reference to account id. If account is empty + all transactions (the journal) will be counted. If account is not empty it returns the number of transactions that have splits in this account.
Returns:
number of transactions in journal/account

Implements IMyMoneyStorage.

virtual const QMap<QString, unsigned long> MyMoneyDatabaseMgr::transactionCountMap ( void   )  const [virtual]

This method returns a QMap filled with the number of transactions per account. The account id serves as index into the map. If one needs to have all transactionCounts() for many accounts, this method is faster than calling transactionCount(const QString& account) many times.

Returns:
QMap with numbers of transactions per account

Implements IMyMoneyStorage.

virtual const QValueList<MyMoneyTransaction> MyMoneyDatabaseMgr::transactionList ( MyMoneyTransactionFilter filter  )  const [virtual]

This method is used to pull a list of transactions from the file global transaction pool. It returns all those transactions that match the filter passed as argument. If the filter is empty, the whole journal will be returned. The list returned is sorted according to the transactions posting date. If more than one transaction exists for the same date, the order among them is undefined.

Parameters:
filter MyMoneyTransactionFilter object with the match criteria
Returns:
set of transactions in form of a QValueList<MyMoneyTransaction>

Implements IMyMoneyStorage.

virtual void MyMoneyDatabaseMgr::transactionList ( QValueList< MyMoneyTransaction > &  list,
MyMoneyTransactionFilter filter 
) const [virtual]

This method is the same as above, but instead of a return value, a parameter is used.

Parameters:
list The set of transactions returned. The list passed in will be cleared before filling with results.
filter MyMoneyTransactionFilter object with the match criteria

Implements IMyMoneySerialize.

virtual void MyMoneyDatabaseMgr::transactionList ( QValueList< QPair< MyMoneyTransaction, MyMoneySplit > > &  list,
MyMoneyTransactionFilter filter 
) const [virtual]

This method is the same as above, but the list contains pairs of transactions and splits.

Parameters:
list The set of transactions returned. The list passed in will be cleared before filling with results.
filter MyMoneyTransactionFilter object with the match criteria

Implements IMyMoneyStorage.

virtual void MyMoneyDatabaseMgr::removeAccount ( const MyMoneyAccount account  )  [virtual]

Deletes an existing account from the file global account pool This method only allows to remove accounts that are not referenced by any split. Use moveSplits() to move splits to another account. An exception is thrown in case of a problem.

Parameters:
account reference to the account to be deleted.

Implements IMyMoneyStorage.

virtual void MyMoneyDatabaseMgr::removeInstitution ( const MyMoneyInstitution institution  )  [virtual]

Deletes an existing institution from the file global institution pool Also modifies the accounts that reference this institution as their institution.

An exception will be thrown upon error conditions.

Parameters:
institution institution to be deleted.

Implements IMyMoneyStorage.

virtual const MyMoneyTransaction MyMoneyDatabaseMgr::transaction ( const QString &  id  )  const [virtual]

This method is used to extract a transaction from the file global transaction pool through an id. In case of an invalid id, an exception will be thrown.

Parameters:
id id of transaction as QString.
Returns:
the requested transaction

Implements IMyMoneyStorage.

virtual const MyMoneyTransaction MyMoneyDatabaseMgr::transaction ( const QString &  account,
const int  idx 
) const [virtual]

This method is used to extract a transaction from the file global transaction pool through an index into an account.

Parameters:
account id of the account as QString
idx number of transaction in this account
Returns:
MyMoneyTransaction object

Implements IMyMoneyStorage.

virtual unsigned int MyMoneyDatabaseMgr::institutionCount ( void   )  const [virtual]

This method returns the number of institutions currently known to file in the range 0..MAXUINT

Returns:
number of institutions known to file

Implements IMyMoneyStorage.

virtual void MyMoneyDatabaseMgr::accountList ( QValueList< MyMoneyAccount > &  list  )  const [virtual]

This method returns a list of accounts inside the storage object.

Parameters:
list reference to QValueList receiving the account objects
Note:
The standard accounts will not be returned

Implements IMyMoneySerialize.

virtual const MyMoneyAccount MyMoneyDatabaseMgr::liability ( void   )  const [virtual]

This method is used to return the standard liability account

Returns:
MyMoneyAccount liability account(group)

Implements IMyMoneySerialize.

virtual const MyMoneyAccount MyMoneyDatabaseMgr::asset ( void   )  const [virtual]

This method is used to return the standard asset account

Returns:
MyMoneyAccount asset account(group)

Implements IMyMoneySerialize.

virtual const MyMoneyAccount MyMoneyDatabaseMgr::expense ( void   )  const [virtual]

This method is used to return the standard expense account

Returns:
MyMoneyAccount expense account(group)

Implements IMyMoneySerialize.

virtual const MyMoneyAccount MyMoneyDatabaseMgr::income ( void   )  const [virtual]

This method is used to return the standard income account

Returns:
MyMoneyAccount income account(group)

Implements IMyMoneySerialize.

virtual const MyMoneyAccount MyMoneyDatabaseMgr::equity ( void   )  const [virtual]

This method is used to return the standard equity account

Returns:
MyMoneyAccount equity account(group)

Implements IMyMoneySerialize.

virtual void MyMoneyDatabaseMgr::addSecurity ( MyMoneySecurity security  )  [virtual]

This method is used to create a new security object. The ID will be created automatically. The object passed with the parameter security is modified to contain the assigned id.

An exception will be thrown upon error conditions.

Parameters:
security MyMoneySecurity filled with data

Implements IMyMoneyStorage.

virtual void MyMoneyDatabaseMgr::modifySecurity ( const MyMoneySecurity security  )  [virtual]

This method is used to modify an existing MyMoneySecurity object.

An exception will be thrown upon erronous situations.

Parameters:
security reference to the MyMoneySecurity object to be updated

Implements IMyMoneyStorage.

virtual void MyMoneyDatabaseMgr::removeSecurity ( const MyMoneySecurity security  )  [virtual]

This method is used to remove an existing MyMoneySecurity object from the engine.

An exception will be thrown upon erronous situations.

Parameters:
security reference to the MyMoneySecurity object to be removed

Implements IMyMoneyStorage.

virtual const MyMoneySecurity MyMoneyDatabaseMgr::security ( const QString &  id  )  const [virtual]

This method is used to retrieve a single MyMoneySecurity object. The id of the object must be supplied in the parameter id.

An exception will be thrown upon erronous situations.

Parameters:
id QString containing the id of the MyMoneySecurity object
Returns:
MyMoneySecurity object

Implements IMyMoneyStorage.

virtual const QValueList<MyMoneySecurity> MyMoneyDatabaseMgr::securityList ( void   )  const [virtual]

This method returns a list of the security objects inside a MyMoneyStorage object

Returns:
QValueList<MyMoneySecurity> containing objects

Implements IMyMoneySerialize.

virtual void MyMoneyDatabaseMgr::addPrice ( const MyMoneyPrice price  )  [virtual]

This method adds a price entry to the price list.

Implements IMyMoneySerialize.

virtual void MyMoneyDatabaseMgr::removePrice ( const MyMoneyPrice price  )  [virtual]

Implements IMyMoneyStorage.

virtual const MyMoneyPrice MyMoneyDatabaseMgr::price ( const QString &  fromId,
const QString &  toId,
const QDate &  date,
const bool  exactDate 
) const [virtual]

Implements IMyMoneyStorage.

virtual const MyMoneyPriceList MyMoneyDatabaseMgr::priceList ( void   )  const [virtual]

This method returns a list of all prices.

Returns:
MyMoneyPriceList of all MyMoneyPrice objects.

Implements IMyMoneySerialize.

virtual void MyMoneyDatabaseMgr::addSchedule ( MyMoneySchedule sched  )  [virtual]

This method is used to add a scheduled transaction to the engine. It must be sure, that the id of the object is not filled. When the method returns to the caller, the id will be filled with the newly created object id value.

An exception will be thrown upon erronous situations.

Parameters:
sched reference to the MyMoneySchedule object

Implements IMyMoneyStorage.

virtual void MyMoneyDatabaseMgr::modifySchedule ( const MyMoneySchedule sched  )  [virtual]

This method is used to modify an existing MyMoneySchedule object. Therefor, the id attribute of the object must be set.

An exception will be thrown upon erronous situations.

Parameters:
sched const reference to the MyMoneySchedule object to be updated

Implements IMyMoneyStorage.

virtual void MyMoneyDatabaseMgr::removeSchedule ( const MyMoneySchedule sched  )  [virtual]

This method is used to remove an existing MyMoneySchedule object from the engine. The id attribute of the object must be set.

An exception will be thrown upon erronous situations.

Parameters:
sched const reference to the MyMoneySchedule object to be updated

Implements IMyMoneyStorage.

virtual const MyMoneySchedule MyMoneyDatabaseMgr::schedule ( const QString &  id  )  const [virtual]

This method is used to retrieve a single MyMoneySchedule object. The id of the object must be supplied in the parameter id.

An exception will be thrown upon erronous situations.

Parameters:
id QString containing the id of the MyMoneySchedule object
Returns:
MyMoneySchedule object

Implements IMyMoneyStorage.

virtual const QValueList<MyMoneySchedule> MyMoneyDatabaseMgr::scheduleList ( const QString &  accountId = QString(),
const MyMoneySchedule::typeE  type = MyMoneySchedule::TYPE_ANY,
const MyMoneySchedule::occurenceE  occurence = MyMoneySchedule::OCCUR_ANY,
const MyMoneySchedule::paymentTypeE  paymentType = MyMoneySchedule::STYPE_ANY,
const QDate &  startDate = QDate(),
const QDate &  endDate = QDate(),
const bool  overdue = false 
) const [virtual]

This method is used to extract a list of scheduled transactions according to the filter criteria passed as arguments.

Parameters:
accountId only search for scheduled transactions that reference accound accountId. If accountId is the empty string, this filter is off. Default is QString().
type only schedules of type type are searched for. See MyMoneySchedule::typeE for details. Default is MyMoneySchedule::TYPE_ANY
occurence only schedules of occurence type occurance are searched for. See MyMoneySchedule::occurenceE for details. Default is MyMoneySchedule::OCCUR_ANY
paymentType only schedules of payment method paymentType are searched for. See MyMoneySchedule::paymentTypeE for details. Default is MyMoneySchedule::STYPE_ANY
startDate only schedules with payment dates after startDate are searched for. Default is all dates (QDate()).
endDate only schedules with payment dates ending prior to endDate are searched for. Default is all dates (QDate()).
overdue if true, only those schedules that are overdue are searched for. Default is false (all schedules will be returned).
Returns:
const QValueList<MyMoneySchedule> list of schedule objects.

Implements IMyMoneySerialize.

virtual const QValueList<MyMoneySchedule> MyMoneyDatabaseMgr::scheduleListEx ( int  scheduleTypes,
int  scheduleOcurrences,
int  schedulePaymentTypes,
QDate  startDate,
const QStringList &  accounts = QStringList() 
) const [virtual]

Implements IMyMoneySerialize.

virtual void MyMoneyDatabaseMgr::addCurrency ( const MyMoneySecurity currency  )  [virtual]

This method is used to add a new currency object to the engine. The ID of the object is the trading symbol, so there is no need for an additional ID since the symbol is guaranteed to be unique.

An exception will be thrown upon erronous situations.

Parameters:
currency reference to the MyMoneySecurity object

Implements IMyMoneyStorage.

virtual void MyMoneyDatabaseMgr::modifyCurrency ( const MyMoneySecurity currency  )  [virtual]

This method is used to modify an existing MyMoneySecurity object.

An exception will be thrown upon erronous situations.

Parameters:
currency reference to the MyMoneyCurrency object

Implements IMyMoneyStorage.

virtual void MyMoneyDatabaseMgr::removeCurrency ( const MyMoneySecurity currency  )  [virtual]

This method is used to remove an existing MyMoneySecurity object from the engine.

An exception will be thrown upon erronous situations.

Parameters:
currency reference to the MyMoneySecurity object

Implements IMyMoneyStorage.

virtual const MyMoneySecurity MyMoneyDatabaseMgr::currency ( const QString &  id  )  const [virtual]

This method is used to retrieve a single MyMoneySecurity object. The id of the object must be supplied in the parameter id.

An exception will be thrown upon erronous situations.

Parameters:
id QString containing the id of the MyMoneySecurity object
Returns:
MyMoneyCurrency object

Implements IMyMoneyStorage.

virtual const QValueList<MyMoneySecurity> MyMoneyDatabaseMgr::currencyList ( void   )  const [virtual]

This method is used to retrieve the list of all currencies known to the engine.

An exception will be thrown upon erronous situations.

Returns:
QValueList of all MyMoneySecurity objects representing a currency.

Implements IMyMoneySerialize.

virtual const QValueList<MyMoneyReport> MyMoneyDatabaseMgr::reportList ( void   )  const [virtual]

This method is used to retrieve the list of all reports known to the engine.

An exception will be thrown upon erronous situations.

Returns:
QValueList of all MyMoneyReport objects.

Implements IMyMoneySerialize.

virtual void MyMoneyDatabaseMgr::addReport ( MyMoneyReport report  )  [virtual]

This method is used to add a new report to the engine. It must be sure, that the id of the object is not filled. When the method returns to the caller, the id will be filled with the newly created object id value.

An exception will be thrown upon erronous situations.

Parameters:
report reference to the MyMoneyReport object

Implements IMyMoneyStorage.

virtual void MyMoneyDatabaseMgr::modifyReport ( const MyMoneyReport report  )  [virtual]

This method is used to modify an existing MyMoneyReport object. Therefor, the id attribute of the object must be set.

An exception will be thrown upon erronous situations.

Parameters:
report const reference to the MyMoneyReport object to be updated

Implements IMyMoneyStorage.

virtual unsigned MyMoneyDatabaseMgr::countReports ( void   )  const [virtual]

This method returns the number of reports currently known to file in the range 0..MAXUINT

Returns:
number of reports known to file

Implements IMyMoneyStorage.

virtual const MyMoneyReport MyMoneyDatabaseMgr::report ( const QString &  id  )  const [virtual]

This method is used to retrieve a single MyMoneyReport object. The id of the object must be supplied in the parameter id.

An exception will be thrown upon erronous situations.

Parameters:
id QString containing the id of the MyMoneyReport object
Returns:
MyMoneyReport object

Implements IMyMoneyStorage.

virtual void MyMoneyDatabaseMgr::removeReport ( const MyMoneyReport report  )  [virtual]

This method is used to remove an existing MyMoneyReport object from the engine. The id attribute of the object must be set.

An exception will be thrown upon erronous situations.

Parameters:
report const reference to the MyMoneyReport object to be updated

Implements IMyMoneyStorage.

virtual const QValueList<MyMoneyBudget> MyMoneyDatabaseMgr::budgetList ( void   )  const [virtual]

This method is used to retrieve the list of all budgets known to the engine.

An exception will be thrown upon erronous situations.

Returns:
QValueList of all MyMoneyBudget objects.

Implements IMyMoneySerialize.

virtual void MyMoneyDatabaseMgr::addBudget ( MyMoneyBudget budget  )  [virtual]

This method is used to add a new budget to the engine. It must be sure, that the id of the object is not filled. When the method returns to the caller, the id will be filled with the newly created object id value.

An exception will be thrown upon erronous situations.

Parameters:
budget reference to the MyMoneyBudget object

Implements IMyMoneyStorage.

virtual const MyMoneyBudget MyMoneyDatabaseMgr::budgetByName ( const QString &  budget  )  const [virtual]

This method is used to retrieve the id to a corresponding name of a budget An exception will be thrown upon error conditions.

Parameters:
budget QString reference to name of budget
Returns:
MyMoneyBudget object of budget

Implements IMyMoneyStorage.

virtual void MyMoneyDatabaseMgr::modifyBudget ( const MyMoneyBudget budget  )  [virtual]

This method is used to modify an existing MyMoneyBudget object. Therefor, the id attribute of the object must be set.

An exception will be thrown upon erronous situations.

Parameters:
budget const reference to the MyMoneyBudget object to be updated

Implements IMyMoneyStorage.

virtual unsigned MyMoneyDatabaseMgr::countBudgets ( void   )  const [virtual]

This method returns the number of budgets currently known to file in the range 0..MAXUINT

Returns:
number of budgets known to file

Implements IMyMoneyStorage.

virtual MyMoneyBudget MyMoneyDatabaseMgr::budget ( const QString &  id  )  const [virtual]

This method is used to retrieve a single MyMoneyBudget object. The id of the object must be supplied in the parameter id.

An exception will be thrown upon erronous situations.

Parameters:
id QString containing the id of the MyMoneyBudget object
Returns:
MyMoneyBudget object

Implements IMyMoneyStorage.

virtual void MyMoneyDatabaseMgr::removeBudget ( const MyMoneyBudget budget  )  [virtual]

This method is used to remove an existing MyMoneyBudget object from the engine. The id attribute of the object must be set.

An exception will be thrown upon erronous situations.

Parameters:
budget const reference to the MyMoneyBudget object to be updated

Implements IMyMoneyStorage.

virtual void MyMoneyDatabaseMgr::clearCache ( void   )  [virtual]

Clear all internal caches (used internally for performance measurements)

Implements IMyMoneyStorage.

virtual bool MyMoneyDatabaseMgr::isReferenced ( const MyMoneyObject obj,
const MyMoneyFileBitArray skipCheck = MyMoneyFileBitArray() 
) const [virtual]

This method checks, if the given object is referenced by another engine object.

Parameters:
obj const reference to object to be checked
skipCheck MyMoneyFileBitArray with ReferenceCheckBits set for which the check should be skipped
Return values:
false object is not referenced
true institution is referenced

Implements IMyMoneyStorage.

virtual void MyMoneyDatabaseMgr::close ( void   )  [virtual]

This method is provided to allow closing of the database before logoff

Implements IMyMoneyStorage.

virtual void MyMoneyDatabaseMgr::startTransaction ( void   )  [virtual]

These methods have to be provided to allow transaction safe data handling.

Implements IMyMoneyStorage.

virtual bool MyMoneyDatabaseMgr::commitTransaction ( void   )  [virtual]

Implements IMyMoneyStorage.

virtual void MyMoneyDatabaseMgr::rollbackTransaction ( void   )  [virtual]

Implements IMyMoneyStorage.

virtual void MyMoneyDatabaseMgr::setCreationDate ( const QDate &  val  )  [virtual]

Implements IMyMoneySerialize.

virtual KSharedPtr<MyMoneyStorageSql> MyMoneyDatabaseMgr::connectToDatabase ( const KURL &  url  )  [virtual]

This method is used to get a SQL reader for subsequent database access

Implements IMyMoneySerialize.

virtual void MyMoneyDatabaseMgr::fillStorage (  )  [virtual]

This method is used when a database file is open, and the data is to be saved in a different file or format. It will ensure that all data from the database is available in memory to enable it to be written.

Implements IMyMoneySerialize.

virtual void MyMoneyDatabaseMgr::setLastModificationDate ( const QDate &  val  )  [virtual]

This method is used to set the last modification date of the storage object. It also clears the dirty flag and should therefor be called as last operation when loading from a file.

Parameters:
val QDate of last modification

Implements IMyMoneySerialize.

virtual bool MyMoneyDatabaseMgr::isDuplicateTransaction ( const QString &   )  const [virtual]

This method returns whether a given transaction is already in memory, to avoid reloading it from the database

Implements IMyMoneySerialize.

virtual void MyMoneyDatabaseMgr::loadAccounts ( const QMap< QString, MyMoneyAccount > &  map  )  [virtual]

Implements IMyMoneySerialize.

virtual void MyMoneyDatabaseMgr::loadTransactions ( const QMap< QString, MyMoneyTransaction > &  map  )  [virtual]

Implements IMyMoneySerialize.

virtual void MyMoneyDatabaseMgr::loadInstitutions ( const QMap< QString, MyMoneyInstitution > &  map  )  [virtual]

Implements IMyMoneySerialize.

virtual void MyMoneyDatabaseMgr::loadPayees ( const QMap< QString, MyMoneyPayee > &  map  )  [virtual]

Implements IMyMoneySerialize.

virtual void MyMoneyDatabaseMgr::loadSchedules ( const QMap< QString, MyMoneySchedule > &  map  )  [virtual]

Implements IMyMoneySerialize.

virtual void MyMoneyDatabaseMgr::loadSecurities ( const QMap< QString, MyMoneySecurity > &  map  )  [virtual]

Implements IMyMoneySerialize.

virtual void MyMoneyDatabaseMgr::loadCurrencies ( const QMap< QString, MyMoneySecurity > &  map  )  [virtual]

Implements IMyMoneySerialize.

virtual void MyMoneyDatabaseMgr::loadReports ( const QMap< QString, MyMoneyReport > &  reports  )  [virtual]

Implements IMyMoneySerialize.

virtual void MyMoneyDatabaseMgr::loadBudgets ( const QMap< QString, MyMoneyBudget > &  budgets  )  [virtual]

Implements IMyMoneySerialize.

virtual void MyMoneyDatabaseMgr::loadPrices ( const MyMoneyPriceList list  )  [virtual]

Implements IMyMoneySerialize.

virtual unsigned long MyMoneyDatabaseMgr::accountId ( void   )  const [virtual]

Implements IMyMoneySerialize.

virtual unsigned long MyMoneyDatabaseMgr::transactionId ( void   )  const [virtual]

Implements IMyMoneySerialize.

virtual unsigned long MyMoneyDatabaseMgr::payeeId ( void   )  const [virtual]

Implements IMyMoneySerialize.

virtual unsigned long MyMoneyDatabaseMgr::institutionId ( void   )  const [virtual]

Implements IMyMoneySerialize.

virtual unsigned long MyMoneyDatabaseMgr::scheduleId ( void   )  const [virtual]

Implements IMyMoneySerialize.

virtual unsigned long MyMoneyDatabaseMgr::securityId ( void   )  const [virtual]

Implements IMyMoneySerialize.

virtual unsigned long MyMoneyDatabaseMgr::reportId ( void   )  const [virtual]

Implements IMyMoneySerialize.

virtual unsigned long MyMoneyDatabaseMgr::budgetId ( void   )  const [virtual]

Implements IMyMoneySerialize.

virtual void MyMoneyDatabaseMgr::loadAccountId ( const unsigned long  id  )  [virtual]

Implements IMyMoneySerialize.

virtual void MyMoneyDatabaseMgr::loadTransactionId ( const unsigned long  id  )  [virtual]

Implements IMyMoneySerialize.

virtual void MyMoneyDatabaseMgr::loadPayeeId ( const unsigned long  id  )  [virtual]

Implements IMyMoneySerialize.

virtual void MyMoneyDatabaseMgr::loadInstitutionId ( const unsigned long  id  )  [virtual]

Implements IMyMoneySerialize.

virtual void MyMoneyDatabaseMgr::loadScheduleId ( const unsigned long  id  )  [virtual]

Implements IMyMoneySerialize.

virtual void MyMoneyDatabaseMgr::loadSecurityId ( const unsigned long  id  )  [virtual]

Implements IMyMoneySerialize.

virtual void MyMoneyDatabaseMgr::loadReportId ( const unsigned long  id  )  [virtual]

Implements IMyMoneySerialize.

virtual void MyMoneyDatabaseMgr::loadBudgetId ( const unsigned long  id  )  [virtual]

Implements IMyMoneySerialize.

virtual const QMap<QString, QString> MyMoneyDatabaseMgr::pairs ( void   )  const [virtual]

This method is used to retrieve the whole set of key/value pairs from the container. It is meant to be used for permanent storage functionality. See MyMoneyKeyValueContainer::pairs() for details.

Returns:
QMap<QString, QString> containing all key/value pairs of this container.

Reimplemented from MyMoneyKeyValueContainer.

virtual void MyMoneyDatabaseMgr::setPairs ( const QMap< QString, QString > &  list  )  [virtual]

This method is used to initially store a set of key/value pairs in the container. It is meant to be used for loading functionality from permanent storage. See MyMoneyKeyValueContainer::setPairs() for details

Parameters:
list const QMap<QString, QString> containing the set of key/value pairs to be loaded into the container.
Note:
All existing key/value pairs in the container will be deleted.

Reimplemented from MyMoneyKeyValueContainer.

virtual void MyMoneyDatabaseMgr::rebuildAccountBalances ( void   )  [virtual]

This method recalculates the balances of all accounts based on the transactions stored in the engine.

Implements IMyMoneySerialize.

const QString MyMoneyDatabaseMgr::nextInstitutionID ( void   )  [private]

This method is used to get the next valid ID for a institution

Returns:
id for a institution

const QString MyMoneyDatabaseMgr::nextAccountID ( void   )  [private]

This method is used to get the next valid ID for an account

Returns:
id for an account

const QString MyMoneyDatabaseMgr::nextTransactionID ( void   )  [private]

This method is used to get the next valid ID for a transaction

Returns:
id for a transaction

const QString MyMoneyDatabaseMgr::nextPayeeID ( void   )  [private]

This method is used to get the next valid ID for a payee

Returns:
id for a payee

const QString MyMoneyDatabaseMgr::nextScheduleID ( void   )  [private]

This method is used to get the next valid ID for a scheduled transaction

Returns:
id for a scheduled transaction

const QString MyMoneyDatabaseMgr::nextSecurityID ( void   )  [private]

This method is used to get the next valid ID for an security object.

Returns:
id for an security object

const QString MyMoneyDatabaseMgr::nextReportID ( void   )  [private]

const QString MyMoneyDatabaseMgr::nextBudgetID ( void   )  [private]

This method is used to get the next valid ID for a budget object.

Returns:
id for an budget object

void MyMoneyDatabaseMgr::removeReferences ( const QString &  id  )  [private]


Member Data Documentation

This member variable keeps the creation date of this MyMoneySeqAccessMgr object. It is set during the constructor and can only be modified using the stream read operator.

This member variable contains the current fix level of application data files. (see kmymoneyview.cpp)

unsigned int MyMoneyDatabaseMgr::m_fileFixVersion [private]

This member variable contains the current fix level of the presently open data file. (see kmymoneyview.cpp)

This member variable keeps the date of the last modification of the MyMoneySeqAccessMgr object.

This contains the interface with SQL reader for database access

This member variable keeps the User information.

See also:
setUser()

const int MyMoneyDatabaseMgr::INSTITUTION_ID_SIZE = 6 [static, private]

const int MyMoneyDatabaseMgr::ACCOUNT_ID_SIZE = 6 [static, private]

const int MyMoneyDatabaseMgr::TRANSACTION_ID_SIZE = 18 [static, private]

const int MyMoneyDatabaseMgr::PAYEE_ID_SIZE = 6 [static, private]

const int MyMoneyDatabaseMgr::SCHEDULE_ID_SIZE = 6 [static, private]

const int MyMoneyDatabaseMgr::SECURITY_ID_SIZE = 6 [static, private]

const int MyMoneyDatabaseMgr::REPORT_ID_SIZE = 6 [static, private]

const int MyMoneyDatabaseMgr::BUDGET_ID_SIZE = 6 [static, private]

const int MyMoneyDatabaseMgr::CURRENT_FIX_VERSION = 3 [static, private]


The documentation for this class was generated from the following file:

Generated on Wed Jan 26 13:09:12 2011 for KMyMoney by  doxygen 1.5.6