summaryrefslogtreecommitdiff
path: root/pynslcd/ether.py
diff options
context:
space:
mode:
authorArthur de Jong <arthur@arthurdejong.org>2013-04-16 17:48:10 +0200
committerArthur de Jong <arthur@arthurdejong.org>2013-08-17 12:31:36 +0200
commitb0b57234790da62c9dd6ba11b3093e9b80678f94 (patch)
tree0d0ac7b04bce86d760b5ed96928abaf59d31fafc /pynslcd/ether.py
parent84d22e608b03c154d11e54ff34d7b87bf1d78cfa (diff)
Move cache table creation to modules
This also moves the creation of a SQLite database connection to a _get_connection() function to ensure the cache is only created when the caches are instantiated.
Diffstat (limited to 'pynslcd/ether.py')
-rw-r--r--pynslcd/ether.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/pynslcd/ether.py b/pynslcd/ether.py
index d5d8c06..e5060ca 100644
--- a/pynslcd/ether.py
+++ b/pynslcd/ether.py
@@ -59,7 +59,14 @@ class Search(search.LDAPSearch):
class Cache(cache.Cache):
- pass
+
+ create_sql = '''
+ CREATE TABLE IF NOT EXISTS `ether_cache`
+ ( `cn` TEXT NOT NULL COLLATE NOCASE,
+ `macAddress` TEXT NOT NULL COLLATE NOCASE,
+ `mtime` TIMESTAMP NOT NULL,
+ UNIQUE (`cn`, `macAddress`) );
+ '''
class EtherRequest(common.Request):