mirror of
https://github.com/cookiengineer/audacity
synced 2025-07-30 23:49:28 +02:00
Factor ProjectFileIO::GetConnection (returning reference not pointer)
This commit is contained in:
parent
4742f4ce1c
commit
c9dec8f5a9
@ -256,7 +256,7 @@ ProjectFileIO::~ProjectFileIO()
|
||||
{
|
||||
}
|
||||
|
||||
sqlite3 *ProjectFileIO::DB()
|
||||
DBConnection &ProjectFileIO::GetConnection()
|
||||
{
|
||||
auto &curConn = CurrConn();
|
||||
if (!curConn)
|
||||
@ -270,9 +270,18 @@ sqlite3 *ProjectFileIO::DB()
|
||||
}
|
||||
}
|
||||
|
||||
return curConn->DB();
|
||||
return *curConn;
|
||||
}
|
||||
|
||||
sqlite3 *ProjectFileIO::DB()
|
||||
{
|
||||
return GetConnection().DB();
|
||||
}
|
||||
|
||||
/*!
|
||||
@pre *CurConn() does not exist
|
||||
@post *CurConn() exists or return value is false
|
||||
*/
|
||||
bool ProjectFileIO::OpenConnection(FilePath fileName /* = {} */)
|
||||
{
|
||||
auto &curConn = CurrConn();
|
||||
|
@ -142,6 +142,8 @@ public:
|
||||
// 0 for success or non-zero to stop the query
|
||||
using ExecCB = std::function<int(int cols, char **vals, char **names)>;
|
||||
|
||||
DBConnection &GetConnection();
|
||||
|
||||
private:
|
||||
void WriteXMLHeader(XMLWriter &xmlFile) const;
|
||||
void WriteXML(XMLWriter &xmlFile, bool recording = false, const std::shared_ptr<TrackList> &tracks = nullptr) /* not override */;
|
||||
|
Loading…
x
Reference in New Issue
Block a user