mirror of
https://github.com/MariaDB/server.git
synced 2025-01-22 14:54:20 +01:00
enable dump of db with unknown parameters
git-svn-id: file:///svn/tokudb@1916 c7de825b-a66e-492c-adef-691d508d4ae1
This commit is contained in:
parent
0e803cdd71
commit
a7f529c996
1 changed files with 6 additions and 5 deletions
|
@ -21,7 +21,7 @@ int dbdump(char *dbfile, char *dbname) {
|
|||
#else
|
||||
Db db(0, DB_CXX_NO_EXCEPTIONS);
|
||||
#endif
|
||||
r = db.open(0, dbfile, dbname, DB_BTREE, 0, 0777);
|
||||
r = db.open(0, dbfile, dbname, DB_BTREE, DB_UNKNOWN, 0777);
|
||||
if (r != 0) {
|
||||
printf("cant open %s:%s\n", dbfile, dbname);
|
||||
#if USE_ENV
|
||||
|
@ -33,18 +33,19 @@ int dbdump(char *dbfile, char *dbname) {
|
|||
Dbc *cursor;
|
||||
r = db.cursor(0, &cursor, 0); assert(r == 0);
|
||||
|
||||
Dbt key; key.set_flags(DB_DBT_REALLOC);
|
||||
Dbt val; val.set_flags(DB_DBT_REALLOC);
|
||||
for (;;) {
|
||||
Dbt key; key.set_flags(DB_DBT_MALLOC);
|
||||
Dbt val; val.set_flags(DB_DBT_MALLOC);
|
||||
r = cursor->get(&key, &val, DB_NEXT);
|
||||
if (r != 0) break;
|
||||
// printf("%.*s\n", key.get_size(), (char *)key.get_data());
|
||||
hexdump(&key);
|
||||
free(key.get_data());
|
||||
// printf("%.*s\n", val.get_size(), (char *)val.get_data());
|
||||
hexdump(&val);
|
||||
free(val.get_data());
|
||||
}
|
||||
if (key.get_data()) free(key.get_data());
|
||||
if (val.get_data()) free(val.get_data());
|
||||
|
||||
r = cursor->close(); assert(r == 0);
|
||||
r = db.close(0); assert(r == 0);
|
||||
#if USE_ENV
|
||||
|
|
Loading…
Add table
Reference in a new issue