Enumerating all dbs in an environment
See original GitHub issueI need to open an environment and discover all of the databases. From what I understand, the database names are stored in the default, nameless db. But what encoding? Creating a db ends in a native method stub passing a String… UTF-8?
Txn<ByteBuffer> txn = env.txn(null);
env.openDbi(null).iterate(txn).forEachRemaining(kv -> {
ByteBuffer keybytes = kv.key();
String key = ???
});
It would probably be useful to add both the ability to retrieve all dbi names to Env
, as well as the ability to return all Dbi
s in an Env
as a Map<String, Dbi>
. The LMDB docs suggest that it is good practice to retrieve and re-use these anyway.
So I suppose this is mostly a question, but also a minor feature request.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:13 (5 by maintainers)
Top Results From Across the Web
Searching all databases in environment [duplicate]
1 Answer 1 ... You can use SQL Power doc for this . SQL Power Doc was written by Kendal VanDyke. It is...
Read more >How to Show List of All Databases in MySQL [Explained]
Run the following query to show list of databases: SHOW DATABASES;. You can run this statement from MySQL Command Line Client, MySQL Shell,...
Read more >How to list all databases in MySQL - SQLS*Plus
To list all databases in MySQL, execute the following command: ... mysql> show databases;. This command will work for you whether you have...
Read more >Get list of databases from SQL Server - Stack Overflow
Use the query below to get all the databases: select * from sys ...
Read more >How to Show a List of All Databases in MySQL - Linuxize
When administering MySQL database servers, one of the most common tasks you'll have to do is to get familiar with the environment.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ah, and lastly, the changes now on master have one thing I don’t like:
getDbiNames
returns null rather than an empty list when there are no names.One other comment is that there should be some javadoc that indicates that this returns the keys from the default / null name Dbi, so that for users that are not using named databases it will return all of the keys in that Dbi which might cause OOM.
I have implemented the changes suggested by @krisskross. Hope this helps with your use case, @scottcarey.