mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2024-12-14 10:13:05 +02:00
Add Db object getters missed in e4901d50
.
dbOpen() loaded the version and data directory but there was no way to get the data externally. Contributed by Cynthia Shang.
This commit is contained in:
parent
27e8235812
commit
c4533765fb
30
src/db/db.c
30
src/db/db.c
@ -301,6 +301,36 @@ dbMove(Db *this, MemContext *parentNew)
|
|||||||
FUNCTION_TEST_RETURN(this);
|
FUNCTION_TEST_RETURN(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/***********************************************************************************************************************************
|
||||||
|
Get pg data path loaded from the data_directory GUC
|
||||||
|
***********************************************************************************************************************************/
|
||||||
|
const String *
|
||||||
|
dbPgDataPath(const Db *this)
|
||||||
|
{
|
||||||
|
FUNCTION_TEST_BEGIN();
|
||||||
|
FUNCTION_TEST_PARAM(DB, this);
|
||||||
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(this->pgDataPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
/***********************************************************************************************************************************
|
||||||
|
Get pg version loaded from the server_version_num GUC
|
||||||
|
***********************************************************************************************************************************/
|
||||||
|
unsigned int
|
||||||
|
dbPgVersion(const Db *this)
|
||||||
|
{
|
||||||
|
FUNCTION_TEST_BEGIN();
|
||||||
|
FUNCTION_TEST_PARAM(DB, this);
|
||||||
|
FUNCTION_TEST_END();
|
||||||
|
|
||||||
|
ASSERT(this != NULL);
|
||||||
|
|
||||||
|
FUNCTION_TEST_RETURN(this->pgVersion);
|
||||||
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
Render as string for logging
|
Render as string for logging
|
||||||
***********************************************************************************************************************************/
|
***********************************************************************************************************************************/
|
||||||
|
@ -33,6 +33,12 @@ void dbClose(Db *this);
|
|||||||
|
|
||||||
Db *dbMove(Db *this, MemContext *parentNew);
|
Db *dbMove(Db *this, MemContext *parentNew);
|
||||||
|
|
||||||
|
/***********************************************************************************************************************************
|
||||||
|
Getters
|
||||||
|
***********************************************************************************************************************************/
|
||||||
|
const String *dbPgDataPath(const Db *this);
|
||||||
|
unsigned int dbPgVersion(const Db *this);
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
Destructor
|
Destructor
|
||||||
***********************************************************************************************************************************/
|
***********************************************************************************************************************************/
|
||||||
|
@ -156,6 +156,8 @@ testRun(void)
|
|||||||
TEST_RESULT_BOOL(result.primary != NULL, true, " check primary");
|
TEST_RESULT_BOOL(result.primary != NULL, true, " check primary");
|
||||||
TEST_RESULT_INT(result.standbyId, 0, " check standby id");
|
TEST_RESULT_INT(result.standbyId, 0, " check standby id");
|
||||||
TEST_RESULT_BOOL(result.standby == NULL, true, " check standby");
|
TEST_RESULT_BOOL(result.standby == NULL, true, " check standby");
|
||||||
|
TEST_RESULT_INT(dbPgVersion(result.primary), PG_VERSION_84, " version set");
|
||||||
|
TEST_RESULT_STR(strPtr(dbPgDataPath(result.primary)), "/pgdata", " path set");
|
||||||
|
|
||||||
TEST_RESULT_VOID(dbFree(result.primary), "free primary");
|
TEST_RESULT_VOID(dbFree(result.primary), "free primary");
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user