MetriVis | Overview | Download | User Manual | Development |
Reference | Overview | Design Documentation | Reference Backend | Reference Frontend |
#include <SQLDriver.h>
Public Member Functions | |
SQLDriver (unsigned int max_cache_size=METRIVIS_DEFAULT_CACHE_SIZE) | |
Constructor, creates an SQLDriver with a vertain cache size. | |
~SQLDriver () | |
Deconstructor. | |
MultiTypePtr | Insert (std::string table_name, std::string values) |
Inserts data into a SQLite table. | |
MultiTypePtr | Insert (std::string table_name, std::string columns, std::string values) |
Inserts data into a SQLite table. | |
MultiTypePtr | Delete (std::string table_name, std::string where) |
Deletes data from a SQLite table. | |
MultiTypePtr | Select (std::vector< std::string > columns, std::string table_name) |
Selects data from a SQLite table and writes them as double array. | |
MultiTypePtr | SelectString (std::vector< std::string > columns, std::string table_name) |
Selects data from a SQLite table and writes them as string array. | |
MultiTypePtr | SelectString (std::vector< std::string > columns, std::string table_name, std::string where) |
Selects data from a SQLite table and writes them as string array. | |
MultiTypePtr | Select (std::vector< std::string > columns, std::string table_name, std::string where) |
Selects data from a SQLite table. | |
MultiTypePtr | SelectCached (std::vector< std::string > columns, std::string table_name) |
Selects data from a SQLite table cached reading. | |
MultiTypePtr | SelectStringCached (std::vector< std::string > columns, std::string table_name) |
Selects data from a SQLite table cached reading. | |
void | PreCacheSelectString (std::vector< std::string > columns, std::string table_name) |
Preexecutes the specified SQL select query and caches it. | |
void | PreCacheSelect (std::vector< std::string > columns, std::string table_name) |
Preexecutes the specified SQL select query and caches it. | |
void | set_max_cache_size (long max_cache_size) |
Interface function to max cache size. | |
long | max_cache_size () const |
Interface function to max cache size. | |
long | cache_size () const |
Interface function to cache size. | |
void | set_db_file_name (const std::string &db_file_name) |
Interface function to database_file_name. | |
Private Member Functions | |
SQLDriver (const SQLDriver &sql_driver) | |
Hide evil Constructors. | |
Private Attributes | |
LRUCache < std::string, MultiTypePtr > | cache_ |
Last recently used cache. | |
boost::mutex | cache_mutex_ |
Mutex locks running/stopping changes. | |
long | cache_size_ |
The size of the current cache in bytes. | |
long | max_cache_size_ |
The maximal cache size in bytes. | |
std::string | db_file_name_ |
File name of the data base. |
Allows synchronized access to the SQLite data base. Thread safety is implemented:
metrivis::SQLDriver::SQLDriver | ( | unsigned int | max_cache_size = METRIVIS_DEFAULT_CACHE_SIZE |
) |
Constructor, creates an SQLDriver with a vertain cache size.
cache_size,: | The size of the loacal cache int bytes. |
MultiTypePtr metrivis::SQLDriver::Insert | ( | std::string | table_name, | |
std::string | values | |||
) |
Inserts data into a SQLite table.
values,: | Comma separated list of values. | |
table_name,: | Strings containing the name of the SQL table. |
INSERT INTO table-name VALUES(value-list); *
See header file for more information.
MultiTypePtr metrivis::SQLDriver::Insert | ( | std::string | table_name, | |
std::string | columns, | |||
std::string | values | |||
) |
Inserts data into a SQLite table.
values,: | Comma separated list of values. | |
table_name,: | Strings containing the name of the SQL table. | |
columns,: | The sql table column names. |
INSERT INTO table-name (column-list) VALUES(value-list); *
See header file for more information.
MultiTypePtr metrivis::SQLDriver::Delete | ( | std::string | table_name, | |
std::string | where | |||
) |
Deletes data from a SQLite table.
table_name,: | Strings containing the name of the SQL table. | |
where,: | SQL criterion for the rows to be deleted. |
IDELETE FROM [database-name .] table-name [WHERE expr]; *
See header file for more information.
MultiTypePtr metrivis::SQLDriver::Select | ( | std::vector< std::string > | columns, | |
std::string | table_name | |||
) |
Selects data from a SQLite table and writes them as double array.
colums,: | String containing selected columns, comma separated. | |
table_name,: | Strings containing the name of the SQL table. |
SELECT columns FROM table_name;
See header file for more information.
MultiTypePtr metrivis::SQLDriver::SelectString | ( | std::vector< std::string > | columns, | |
std::string | table_name | |||
) |
Selects data from a SQLite table and writes them as string array.
colums,: | String containing selected columns, comma separated. | |
table_name,: | Strings containing the name of the SQL table. |
SELECT columns FROM table_name;
See header file for more information.
MultiTypePtr metrivis::SQLDriver::SelectString | ( | std::vector< std::string > | columns, | |
std::string | table_name, | |||
std::string | where | |||
) |
Selects data from a SQLite table and writes them as string array.
colums,: | String containing selected columns, comma separated. | |
table_name,: | Strings containing the name of the SQL table. | |
where,: | String containing selection criterions (SQL syntax). |
SELECT columns FROM table_name;
See header file for more information.
MultiTypePtr metrivis::SQLDriver::Select | ( | std::vector< std::string > | columns, | |
std::string | table_name, | |||
std::string | where | |||
) |
Selects data from a SQLite table.
colums,: | String containing selected columns, comma separated. | |
table_name,: | Strings containing the name of the SQL table. | |
where,: | String containing selection criterions (SQL syntax). |
SELECT columns FROM table_name WHERE where;
MultiTypePtr metrivis::SQLDriver::SelectCached | ( | std::vector< std::string > | columns, | |
std::string | table_name | |||
) |
Selects data from a SQLite table cached reading.
colums,: | Strings containing selected columns, comma separated. | |
table_name,: | String containing the name of the SQL table. |
SELECT columns FROM table_name;
If exactly the same select command has been executed before, the local LRU cache may contain a copy of the result data, circumventing the SQL lookup. This may safe much time for big data chunks.
Caching makes only sense for big data chunks. It assumes, that the underlaying data does not change at all.
See header file for more information.
MultiTypePtr metrivis::SQLDriver::SelectStringCached | ( | std::vector< std::string > | columns, | |
std::string | table_name | |||
) |
Selects data from a SQLite table cached reading.
colums,: | Strings containing selected columns, comma separated. | |
table_name,: | String containing the name of the SQL table. |
SELECT columns FROM table_name;
If exactly the same select command has been executed before, the local LRU cache may contain a copy of the result data, circumventing the SQL lookup. This may safe much time for big data chunks (many seconds).
Caching makes only sense for big data chunks. It assumes, that the underlaying data does not change at all.
See header file for more information.
void metrivis::SQLDriver::PreCacheSelectString | ( | std::vector< std::string > | columns, | |
std::string | table_name | |||
) |
Preexecutes the specified SQL select query and caches it.
colums,: | Strings containing selected columns, comma separated. | |
table_name,: | String containing the name of the SQL table. |
SELECT columns FROM table_name;
If exactly the same select command has been executed before, the local LRU cache may contain a copy of the result data, circumventing the SQL lookup. This may safe much time for big data chunks (many seconds).
Caching makes only sense for big data chunks. It assumes, that the underlaying data does not change at all.
See header file for more information.
void metrivis::SQLDriver::PreCacheSelect | ( | std::vector< std::string > | columns, | |
std::string | table_name | |||
) |
Preexecutes the specified SQL select query and caches it.
colums,: | Strings containing selected columns, comma separated. | |
table_name,: | String containing the name of the SQL table. |
SELECT columns FROM table_name;
If exactly the same select command has been executed before, the local LRU cache may contain a copy of the result data, circumventing the SQL lookup. This may safe much time for big data chunks (many seconds).
Caching makes only sense for big data chunks. It assumes, that the underlaying data does not change at all.
See header file for more information.
void metrivis::SQLDriver::set_max_cache_size | ( | long | max_cache_size | ) | [inline] |
Interface function to max cache size.
cache_size,: | The maximal cache size in bytes. |
long metrivis::SQLDriver::max_cache_size | ( | ) | const [inline] |
Interface function to max cache size.
long metrivis::SQLDriver::cache_size | ( | ) | const [inline] |
Interface function to cache size.
void metrivis::SQLDriver::set_db_file_name | ( | const std::string & | db_file_name | ) | [inline] |
Interface function to database_file_name.
database_file_name,: | String containing the database file name. |