summaryrefslogtreecommitdiff
path: root/project2/sql
diff options
context:
space:
mode:
authorrandomdan <randomdan@localhost>2013-06-20 18:08:17 +0000
committerrandomdan <randomdan@localhost>2013-06-20 18:08:17 +0000
commit4d2de57f7ae974347767785dbb2062986d30df27 (patch)
treec6ccd43f1524adb06850795efa33d822691e30ca /project2/sql
parentAdd back some basic help output (diff)
downloadproject2-4d2de57f7ae974347767785dbb2062986d30df27.tar.bz2
project2-4d2de57f7ae974347767785dbb2062986d30df27.tar.xz
project2-4d2de57f7ae974347767785dbb2062986d30df27.zip
Move options into the global scope
Diffstat (limited to 'project2/sql')
-rw-r--r--project2/sql/sqlCache.cpp31
1 files changed, 10 insertions, 21 deletions
diff --git a/project2/sql/sqlCache.cpp b/project2/sql/sqlCache.cpp
index bb8adb1..bb61969 100644
--- a/project2/sql/sqlCache.cpp
+++ b/project2/sql/sqlCache.cpp
@@ -246,6 +246,7 @@ class SqlCache : public Cache {
s->execute();
}
+ INITOPTIONS;
private:
friend class CustomSqlCacheLoader;
const RdbmsDataSource * db;
@@ -260,24 +261,6 @@ time_t SqlCache::CacheLife;
class CustomSqlCacheLoader : public ElementLoader::For<SqlCache> {
public:
- CustomSqlCacheLoader() :
- opts("SQL Cache options")
- {
- opts
- ("cache.sql.dataSource", Options::value(&SqlCache::DataSource),
- "The default datasource to connect to")
- ("cache.sql.headerTable", Options::value(&SqlCache::HeaderTable, "p2cache"),
- "The filename to store the data in")
- ("cache.sql.life", Options::value(&SqlCache::CacheLife, 3600),
- "The age of cache entries after which they are removed (seconds)")
- ;
- }
-
- const Options * options() const
- {
- return &opts;
- }
-
void onIdle()
{
if (!SqlCache::DataSource.empty()) {
@@ -291,9 +274,15 @@ class CustomSqlCacheLoader : public ElementLoader::For<SqlCache> {
db->commit();
}
}
-
- private:
- Options opts;
};
DECLARE_CUSTOM_LOADER("sqlcache", CustomSqlCacheLoader);
+DECLARE_OPTIONS(SqlCache, "SQL Cache options")
+("cache.sql.dataSource", Options::value(&DataSource),
+ "The default datasource to connect to")
+("cache.sql.headerTable", Options::value(&HeaderTable, "p2cache"),
+ "The filename to store the data in")
+("cache.sql.life", Options::value(&CacheLife, 3600),
+ "The age of cache entries after which they are removed (seconds)")
+END_OPTIONS(SqlCache)
+