Money Manager EX
An easy to use, money management application built with wxWidgets
DB_Table_STOCK_V1 Struct Reference

#include <DB_Table_Stock_V1.h>

+ Inheritance diagram for DB_Table_STOCK_V1:
+ Collaboration diagram for DB_Table_STOCK_V1:

Classes

struct  COMMISSION
 
struct  CURRENTPRICE
 
struct  Data
 Data is a single record in the database table. More...
 
struct  Data_Set
 A container to hold list of Data records for the table. More...
 
struct  HELDAT
 
struct  NOTES
 
struct  NUMSHARES
 
struct  PURCHASEDATE
 
struct  PURCHASEPRICE
 
struct  STOCKID
 
struct  STOCKNAME
 
struct  SYMBOL
 
struct  VALUE
 

Public Types

enum  COLUMN {
  COL_STOCKID = 0, COL_HELDAT = 1, COL_PURCHASEDATE = 2, COL_STOCKNAME = 3,
  COL_SYMBOL = 4, COL_NUMSHARES = 5, COL_PURCHASEPRICE = 6, COL_NOTES = 7,
  COL_CURRENTPRICE = 8, COL_VALUE = 9, COL_COMMISSION = 10
}
 
enum  { NUM_COLUMNS = 11 }
 
typedef DB_Table_STOCK_V1 Self
 
typedef std::vector< Self::Data * > Cache
 A container to hold a list of Data record pointers for the table in memory. More...
 
typedef std::map< int64, Self::Data * > Index_By_Id
 
typedef STOCKID PRIMARY
 

Public Member Functions

 ~DB_Table_STOCK_V1 ()
 Destructor: clears any data records stored in memory. More...
 
void destroy_cache ()
 Removes all records stored in memory (cache) for the table. More...
 
bool ensure (wxSQLite3Database *db)
 Creates the database table if the table does not exist. More...
 
bool ensure_index (wxSQLite3Database *db)
 
void ensure_data (wxSQLite3Database *db)
 
size_t num_columns () const
 
wxString name () const
 Name of the table. More...
 
 DB_Table_STOCK_V1 ()
 
Self::Datacreate ()
 Create a new Data record and add to memory table (cache) More...
 
Self::Dataclone (const Data *e)
 Create a copy of the Data record and add to memory table (cache) More...
 
bool save (Self::Data *entity, wxSQLite3Database *db, bool force_insert=false)
 Saves the Data record to the database table. More...
 
bool remove (const int64 id, wxSQLite3Database *db)
 Remove the Data record from the database and the memory table (cache) More...
 
bool remove (Self::Data *entity, wxSQLite3Database *db)
 Remove the Data record from the database and the memory table (cache) More...
 
template<typename... Args>
Self::Dataget_one (const Args &... args)
 
Self::Dataget (const int64 id, wxSQLite3Database *db)
 Search the memory table (Cache) for the data record. More...
 
Self::Dataget_record (const int64 id, wxSQLite3Database *db)
 Search the database for the data record, bypassing the cache. More...
 
const Data_Set all (wxSQLite3Database *db, const COLUMN col=COLUMN(0), const bool asc=true)
 Return a list of Data records (Data_Set) derived directly from the database. More...
 
- Public Member Functions inherited from DB_Table
 DB_Table ()
 
virtual ~DB_Table ()
 
virtual wxString query () const
 
bool exists (wxSQLite3Database *db) const
 
void drop (wxSQLite3Database *db) const
 

Static Public Member Functions

static wxString column_to_name (const COLUMN col)
 Returns the column name as a string. More...
 
static COLUMN name_to_column (const wxString &name)
 Returns the column number from the given column name. More...
 
- Static Public Member Functions inherited from DB_Table
static int64 newId ()
 

Public Attributes

Cache cache_
 
Index_By_Id index_by_id_
 
Datafake_
 
- Public Attributes inherited from DB_Table
wxString query_
 
size_t hit_
 
size_t miss_
 
size_t skip_
 

Member Typedef Documentation

◆ Cache

typedef std::vector<Self::Data*> DB_Table_STOCK_V1::Cache

A container to hold a list of Data record pointers for the table in memory.

◆ Index_By_Id

◆ PRIMARY

◆ Self

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
NUM_COLUMNS 

◆ COLUMN

Enumerator
COL_STOCKID 
COL_HELDAT 
COL_PURCHASEDATE 
COL_STOCKNAME 
COL_SYMBOL 
COL_NUMSHARES 
COL_PURCHASEPRICE 
COL_NOTES 
COL_CURRENTPRICE 
COL_VALUE 
COL_COMMISSION 

Constructor & Destructor Documentation

◆ ~DB_Table_STOCK_V1()

DB_Table_STOCK_V1::~DB_Table_STOCK_V1 ( )
inline

Destructor: clears any data records stored in memory.

◆ DB_Table_STOCK_V1()

DB_Table_STOCK_V1::DB_Table_STOCK_V1 ( )
inline

Member Function Documentation

◆ all()

const Data_Set DB_Table_STOCK_V1::all ( wxSQLite3Database *  db,
const COLUMN  col = COLUMN(0),
const bool  asc = true 
)
inline

Return a list of Data records (Data_Set) derived directly from the database.

The Data_Set is sorted based on the column number.

◆ clone()

Self::Data* DB_Table_STOCK_V1::clone ( const Data e)
inline

Create a copy of the Data record and add to memory table (cache)

◆ column_to_name()

static wxString DB_Table_STOCK_V1::column_to_name ( const COLUMN  col)
inlinestatic

Returns the column name as a string.

◆ create()

Self::Data* DB_Table_STOCK_V1::create ( )
inline

Create a new Data record and add to memory table (cache)

◆ destroy_cache()

void DB_Table_STOCK_V1::destroy_cache ( )
inline

Removes all records stored in memory (cache) for the table.

◆ ensure()

bool DB_Table_STOCK_V1::ensure ( wxSQLite3Database *  db)
inline

Creates the database table if the table does not exist.

◆ ensure_data()

void DB_Table_STOCK_V1::ensure_data ( wxSQLite3Database *  db)
inline

◆ ensure_index()

bool DB_Table_STOCK_V1::ensure_index ( wxSQLite3Database *  db)
inline

◆ get()

Self::Data* DB_Table_STOCK_V1::get ( const int64  id,
wxSQLite3Database *  db 
)
inline

Search the memory table (Cache) for the data record.

If not found in memory, search the database and update the cache.

◆ get_one()

template<typename... Args>
Self::Data* DB_Table_STOCK_V1::get_one ( const Args &...  args)
inline

◆ get_record()

Self::Data* DB_Table_STOCK_V1::get_record ( const int64  id,
wxSQLite3Database *  db 
)
inline

Search the database for the data record, bypassing the cache.

◆ name()

wxString DB_Table_STOCK_V1::name ( ) const
inlinevirtual

Name of the table.

Implements DB_Table.

◆ name_to_column()

static COLUMN DB_Table_STOCK_V1::name_to_column ( const wxString &  name)
inlinestatic

Returns the column number from the given column name.

◆ num_columns()

size_t DB_Table_STOCK_V1::num_columns ( ) const
inlinevirtual

Implements DB_Table.

◆ remove() [1/2]

bool DB_Table_STOCK_V1::remove ( const int64  id,
wxSQLite3Database *  db 
)
inline

Remove the Data record from the database and the memory table (cache)

◆ remove() [2/2]

bool DB_Table_STOCK_V1::remove ( Self::Data entity,
wxSQLite3Database *  db 
)
inline

Remove the Data record from the database and the memory table (cache)

◆ save()

bool DB_Table_STOCK_V1::save ( Self::Data entity,
wxSQLite3Database *  db,
bool  force_insert = false 
)
inline

Saves the Data record to the database table.

Either create a new record or update the existing record. Remove old record from the memory table (cache)

Member Data Documentation

◆ cache_

Cache DB_Table_STOCK_V1::cache_

◆ fake_

Data* DB_Table_STOCK_V1::fake_

◆ index_by_id_

Index_By_Id DB_Table_STOCK_V1::index_by_id_

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