summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2006-04-15 07:44:06 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:04:07 -0500
commit6aa32f4217cfa659d042d3e6a72ec156f11b9675 (patch)
tree205f5434f30334665c3f88c37aeffd9a3cf2cb6e /source4
parentcf0343dfa9a477004cd21d7632032d86adf8b259 (diff)
downloadsamba-6aa32f4217cfa659d042d3e6a72ec156f11b9675.tar.gz
samba-6aa32f4217cfa659d042d3e6a72ec156f11b9675.tar.bz2
samba-6aa32f4217cfa659d042d3e6a72ec156f11b9675.zip
r15090: Since we wrap the swig wrapper in another layer of Python, there isn't
much point in doing lots of %rename calls in tdb.i so get rid of them. (This used to be commit 983321f769a6ebc298f1f69bca1ac41ddc860606)
Diffstat (limited to 'source4')
-rw-r--r--source4/lib/tdb/swig/Tdb.py43
-rw-r--r--source4/lib/tdb/swig/tdb.i22
2 files changed, 22 insertions, 43 deletions
diff --git a/source4/lib/tdb/swig/Tdb.py b/source4/lib/tdb/swig/Tdb.py
index ef0165ed8b..aac7a90354 100644
--- a/source4/lib/tdb/swig/Tdb.py
+++ b/source4/lib/tdb/swig/Tdb.py
@@ -20,15 +20,16 @@
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
-import tdb, os
+import os
+from tdb import *
# Open flags
-DEFAULT = tdb.TDB_DEFAULT
-CLEAR_IF_FIRST = tdb.TDB_CLEAR_IF_FIRST
-INTERNAL = tdb.TDB_INTERNAL
-NOLOCK = tdb.TDB_NOLOCK
-NOMMAP = tdb.TDB_NOMMAP
+DEFAULT = TDB_DEFAULT
+CLEAR_IF_FIRST = TDB_CLEAR_IF_FIRST
+INTERNAL = TDB_INTERNAL
+NOLOCK = TDB_NOLOCK
+NOMMAP = TDB_NOMMAP
# Class representing a TDB file
@@ -36,40 +37,40 @@ class Tdb:
# Create and destroy Tdb objects
- def __init__(self, name, hash_size = 0, flags = tdb.TDB_DEFAULT,
+ def __init__(self, name, hash_size = 0, flags = TDB_DEFAULT,
open_flags = os.O_RDWR | os.O_CREAT, mode = 0600):
- self.tdb = tdb.open(name, hash_size, flags, open_flags, mode)
+ self.tdb = tdb_open(name, hash_size, flags, open_flags, mode)
if self.tdb is None:
- raise IOError, tdb.errorstr(self.tdb)
+ raise IOError, tdb_errorstr(self.tdb)
def __del__(self):
self.close()
def close(self):
if hasattr(self, 'tdb') and self.tdb is not None:
- if tdb.close(self.tdb) == -1:
- raise IOError, tdb.errorstr(self.tdb)
+ if tdb_close(self.tdb) == -1:
+ raise IOError, tdb_errorstr(self.tdb)
self.tdb = None
# Random access to keys, values
def __getitem__(self, key):
- result = tdb.fetch(self.tdb, key)
+ result = tdb_fetch(self.tdb, key)
if result is None:
- raise KeyError, '%s: %s' % (key, tdb.errorstr(self.tdb))
+ raise KeyError, '%s: %s' % (key, tdb_errorstr(self.tdb))
return result
def __setitem__(self, key, item):
- if tdb.store(self.tdb, key, item) == -1:
- raise IOError, tdb.errorstr(self.tdb)
+ if tdb_store(self.tdb, key, item) == -1:
+ raise IOError, tdb_errorstr(self.tdb)
def __delitem__(self, key):
- if not tdb.exists(self.tdb, key):
- raise KeyError, '%s: %s' % (key, tdb.errorstr(self.tdb))
- tdb.delete(self.tdb, key)
+ if not tdb_exists(self.tdb, key):
+ raise KeyError, '%s: %s' % (key, tdb_errorstr(self.tdb))
+ tdb_delete(self.tdb, key)
def has_key(self, key):
- return tdb.exists(self.tdb, key)
+ return tdb_exists(self.tdb, key)
# Tdb iterator
@@ -83,12 +84,12 @@ class Tdb:
def next(self):
if self.key is None:
- self.key = tdb.firstkey(self.tdb)
+ self.key = tdb_firstkey(self.tdb)
if self.key is None:
raise StopIteration
return self.key
else:
- self.key = tdb.nextkey(self.tdb, self.key)
+ self.key = tdb_nextkey(self.tdb, self.key)
if self.key is None:
raise StopIteration
return self.key
diff --git a/source4/lib/tdb/swig/tdb.i b/source4/lib/tdb/swig/tdb.i
index 8f473c61e6..7db17b22d4 100644
--- a/source4/lib/tdb/swig/tdb.i
+++ b/source4/lib/tdb/swig/tdb.i
@@ -113,11 +113,9 @@ typedef int mode_t;
}
}
-%rename tdb_open open;
TDB_CONTEXT *tdb_open(const char *name, int hash_size, int tdb_flags,
int open_flags, mode_t mode);
-%rename tdb_open_ex open_ex;
TDB_CONTEXT *tdb_open_ex(const char *name, int hash_size, int tdb_flags,
int open_flags, mode_t mode,
tdb_log_func log_fn,
@@ -125,66 +123,46 @@ TDB_CONTEXT *tdb_open_ex(const char *name, int hash_size, int tdb_flags,
%exception;
-%rename tdb_reopen reopen;
int tdb_reopen(TDB_CONTEXT *tdb);
-%rename tdb_reopen_all reopen_all;
int tdb_reopen_all(void);
-%rename tdb_logging_function logging_function;
void tdb_logging_function(TDB_CONTEXT *tdb, tdb_log_func);
-%rename tdb_error error;
enum TDB_ERROR tdb_error(TDB_CONTEXT *tdb);
-%rename tdb_errorstr errorstr;
const char *tdb_errorstr(TDB_CONTEXT *tdb);
-%rename tdb_fetch fetch;
TDB_DATA tdb_fetch(TDB_CONTEXT *tdb, TDB_DATA key);
-%rename tdb_delete delete;
int tdb_delete(TDB_CONTEXT *tdb, TDB_DATA key);
-%rename tdb_store store;
int tdb_store(TDB_CONTEXT *tdb, TDB_DATA key, TDB_DATA dbuf, int flag = TDB_REPLACE);
-%rename tdb_append append;
int tdb_append(TDB_CONTEXT *tdb, TDB_DATA key, TDB_DATA new_dbuf);
-%rename tdb_close close;
int tdb_close(TDB_CONTEXT *tdb);
-%rename tdb_firstkey firstkey;
TDB_DATA tdb_firstkey(TDB_CONTEXT *tdb);
-%rename tdb_nextkey nextkey;
TDB_DATA tdb_nextkey(TDB_CONTEXT *tdb, TDB_DATA key);
-%rename tdb_traverse traverse;
int tdb_traverse(TDB_CONTEXT *tdb, tdb_traverse_func fn, void *state);
-%rename tdb_exists exists;
int tdb_exists(TDB_CONTEXT *tdb, TDB_DATA key);
-%rename tdb_lockall lockall;
int tdb_lockall(TDB_CONTEXT *tdb);
-%rename tdb_unlockall unlockall;
void tdb_unlockall(TDB_CONTEXT *tdb);
/* Low level locking functions: use with care */
-%rename tdb_chainlock chainlock;
int tdb_chainlock(TDB_CONTEXT *tdb, TDB_DATA key);
-%rename tdb_chainunlock chainunlock;
int tdb_chainunlock(TDB_CONTEXT *tdb, TDB_DATA key);
/* Debug functions. Not used in production. */
-%rename tdb_dump_all dump_all;
void tdb_dump_all(TDB_CONTEXT *tdb);
-%rename tdb_printfreelist printfreelist;
int tdb_printfreelist(TDB_CONTEXT *tdb);