[#wallet-WalletDatabase]
= xref:wallet.adoc[wallet]::WalletDatabase
:relfileprefix: ../
:mrdocs:

An instance of this class represents one database&period;

== Synopsis

Declared in `&lt;wallet&sol;db&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
class WalletDatabase;
----

== Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:wallet/WalletDatabase/2constructor.adoc[`WalletDatabase`]         [.small]#[constructor]#
| Create dummy DB handle
| xref:wallet/WalletDatabase/2destructor.adoc[`&#126;WalletDatabase`] [.small]#[destructor]# [.small]#[virtual]#
| Destroys the database handle&period;
| xref:wallet/WalletDatabase/Backup.adoc[`Backup`]  [.small]#[virtual]#
| Back up the entire database to a file&period;
| xref:wallet/WalletDatabase/Close.adoc[`Close`]  [.small]#[virtual]#
| Flush to the database file and close the database&period; Also close the environment if no other databases are open in it&period;
| xref:wallet/WalletDatabase/Filename.adoc[`Filename`]  [.small]#[virtual]#
| Return path to main database file for logs and error messages&period;
| xref:wallet/WalletDatabase/Files.adoc[`Files`]  [.small]#[virtual]#
| Return paths to all database created files
| xref:wallet/WalletDatabase/Format.adoc[`Format`]  [.small]#[virtual]#
| Returns the name of the database format&period;
| xref:wallet/WalletDatabase/MakeBatch.adoc[`MakeBatch`]  [.small]#[virtual]#
| Make a DatabaseBatch connected to this database
| xref:wallet/WalletDatabase/Open.adoc[`Open`]  [.small]#[virtual]#
| Open the database if it is not already opened&period;
| xref:wallet/WalletDatabase/Rewrite.adoc[`Rewrite`]  [.small]#[virtual]#
| Rewrite the entire database on disk
|===


== Data Members

[cols="1,4"]
|===
| Name| Description
| xref:wallet/WalletDatabase/m_refcount.adoc[`m&lowbar;refcount`] 
| Counts the number of active database users to be sure that the database is not closed while someone is using it
|===


== Non-Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:wallet/MakeDatabase.adoc[`MakeDatabase`]
| Creates or opens a wallet database at the given path&period;
| xref:wallet/MakeInMemoryWalletDatabase.adoc[`MakeInMemoryWalletDatabase`]
| Create a new in&hyphen;memory wallet database&period;
| xref:wallet/MakeWalletDatabase.adoc[`MakeWalletDatabase`]
| Open the database backend for a wallet&period;
| xref:wallet/RunWithinTxn.adoc[`RunWithinTxn`]
| Executes the provided function &apos;func&apos; within a database transaction context&period;
|===

== Derived Classes

[cols="1,4"]
|===
| Name| Description
| xref:wallet/BerkeleyRODatabase.adoc[`BerkeleyRODatabase`] 
| A class representing a BerkeleyDB file from which we can only read records&period; This is used only for migration of legacy to descriptor wallets
| xref:wallet/SQLiteDatabase.adoc[`SQLiteDatabase`] 
| An instance of this class represents one SQLite3 database&period;
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
