GDBMS 1.0
|
#include <hash_table.h>
Public Member Functions | |
hash_table (char *table_name, char *folder_name, int columns_nr, char *columns, char *columns_searchby, char *unique) | |
A constructor. | |
hash_table (char *table_name, char *folder_name, char *columns, char *columns_searchby, char *unique) | |
A constructor. | |
~hash_table () | |
A destructor. | |
void | AddRecord (char *column_names, char *values) |
Adds a record to the hash table.. | |
void | DeleteRecord (char *column_name, char *value) |
Deletes the first occurence of a record of column_name which has value. | |
void | UpdateRecord (char *where_column, char *where_value, char *column_names, char *column_values) |
A record updater. | |
char * | FindRecord (char *where_column_name, char *where_column_value, char *find_column) |
A record finder. | |
void | FindByIdAndReturnColNamesAndValues (char *id, string &cnames, string &cvalues, char *requested_id=0) |
A record finder. | |
virtual int | getMAXID () |
void | BeginTransaction (char *folder, int id) |
void | EndTransaction () |
void | split (char *str, int *numbers_splitted, char ***splitted) |
Protected Member Functions | |
unsigned | hash (string const &key) |
Protected Attributes | |
std::string | transaction_folder |
std::string | table_folder |
std::string | tblname |
char ** | colls_searchby |
int | n_cols_sby |
int | transaction_id |
Definition at line 1 of file hash_table.h.
hash_table::hash_table | ( | char * | table_name, |
char * | folder_name, | ||
int | columns_nr, | ||
char * | columns, | ||
char * | columns_searchby, | ||
char * | unique | ||
) |
A constructor.
table_name | a string parameter that contains the table name. |
folder_name | a string parameter that contains the path to the folder of where the files of the hash table are going to be stored ot retrieved. |
columns_nr | a number of the columns. |
columns | a ; separated names of the columns of the relation. |
columns_searchby | a ; separated names of the columns of the relation, which will be use in search, so that indexes for them could be created |
unique | the name of the unique identifier column. |
If the relation is already created, it is not created again. Only the class is properly initialized. If you want to create a new hash table in the folder, simply erase its contents and run the program with defined instance of this type and this constructor.
Definition at line 24 of file hash_table.cpp.
hash_table::hash_table | ( | char * | table_name, |
char * | folder_name, | ||
char * | columns, | ||
char * | columns_searchby, | ||
char * | unique | ||
) |
A constructor.
table_name | a string parameter that contains the table name. |
folder_name | a string parameter that contains the path to the folder of where the files of the hash table are going to be stored ot retrieved. |
columns | a ; separated names of the columns of the relation. |
columns_searchby | a ; separated names of the columns of the relation, which will be use in search, so that indexes for them could be created |
unique | the name of the unique identifier column. |
If the relation is already created, it is not created again. Only the class is properly initialized. If you want to create a new hash table in the folder, simply erase its contents and run the program with defined instance of this type and this constructor.
Definition at line 18 of file hash_table.cpp.
hash_table::~hash_table | ( | ) |
A destructor.
The destructor only destroys the instance of the class, but not the hash table.
Definition at line 153 of file hash_table.cpp.
void hash_table::AddRecord | ( | char * | column_names, |
char * | values | ||
) |
Adds a record to the hash table..
column_names | a string parameter that contains ; separated names of the columns of the record. |
values | a string parameter that contains ; separated values of the columns of the record. |
Reimplemented in tr_twin_ht.
Definition at line 182 of file hash_table.cpp.
void hash_table::BeginTransaction | ( | char * | folder, |
int | id | ||
) |
void hash_table::DeleteRecord | ( | char * | column_name, |
char * | value | ||
) |
Deletes the first occurence of a record of column_name which has value.
column_name | a string parameter that contains the name of the column. |
value | a string parameter that contains the value of the column that the record to be deleted must have |
Reimplemented in tr_twin_ht.
Definition at line 417 of file hash_table.cpp.
void hash_table::EndTransaction | ( | ) |
Definition at line 939 of file hash_table.cpp.
void hash_table::FindByIdAndReturnColNamesAndValues | ( | char * | id, |
string & | cnames, | ||
string & | cvalues, | ||
char * | requested_id = 0 |
||
) |
A record finder.
id | a string parameter that contains the id of the record which is to be found |
cnames | a string alias which is to be used as a return value of the column names found for the record |
cvalues | a string alias which is to be used as a return value of the column values found for the record |
requested_id | a pointer to a string which if is not NULL changes the id field value with the value pointed by this pointer |
Definition at line 897 of file hash_table.cpp.
char * hash_table::FindRecord | ( | char * | where_column_name, |
char * | where_column_value, | ||
char * | find_column | ||
) |
A record finder.
where_column_name | a string parameter that contains the name of the column by which the record to be found must be searched. |
where_column_value | a string parameter that contains the value which determines the record to be found. |
find_column | a string parameter that contains the name of the column which value is to be returned |
Reimplemented in tr_twin_ht.
Definition at line 606 of file hash_table.cpp.
int hash_table::getMAXID | ( | ) | [virtual] |
Reimplemented in tr_twin_ht.
Definition at line 845 of file hash_table.cpp.
unsigned int hash_table::hash | ( | string const & | key | ) | [protected] |
Definition at line 166 of file hash_table.cpp.
void hash_table::split | ( | char * | str, |
int * | numbers_splitted, | ||
char *** | splitted | ||
) |
void hash_table::UpdateRecord | ( | char * | where_column, |
char * | where_value, | ||
char * | column_names, | ||
char * | column_values | ||
) |
A record updater.
where_column | a string parameter that contains the name of the column by which the record to be updated must be searched. |
where_value | a string parameter that contains the value which determines the record to be updated. |
column_names | a string parameter that contains ; separated names of the update fields |
column_values | a string parameter that contains ; separated values of the update fields |
Reimplemented in tr_twin_ht.
Definition at line 718 of file hash_table.cpp.
char** hash_table::colls_searchby [protected] |
Definition at line 142 of file hash_table.h.
int hash_table::n_cols_sby [protected] |
Definition at line 143 of file hash_table.h.
std::string hash_table::table_folder [protected] |
Definition at line 140 of file hash_table.h.
std::string hash_table::tblname [protected] |
Definition at line 141 of file hash_table.h.
std::string hash_table::transaction_folder [protected] |
Definition at line 139 of file hash_table.h.
int hash_table::transaction_id [protected] |
Definition at line 145 of file hash_table.h.