HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UT_SqlOrm Class Reference

#include <UT_SQLORM.h>

Public Types

using error_callback_t = UT_Function< void(const UT_StringHolder &, const UT_ErrorCode &)>
 

Public Member Functions

 UT_SqlOrm (const UT_StringHolder &db_path)
 
 UT_SqlOrm ()
 
virtual ~UT_SqlOrm ()=default
 
 UT_NON_COPYABLE (UT_SqlOrm)
 
void configure (const UT_StringHolder &db_path, error_callback_t &&clb=error_callback_t())
 
UT_SqlStatement cursor () const
 
const UT_SqlDatabasedatabase () const
 
UT_SqlDatabasedatabase ()
 
UT_AutoSqlTransaction transaction (UT_AutoSqlTransaction::commit_callback_t &&callback, bool savepoint=true)
 
void migrate (UT_ORMMigrationResult &result, bool collect_sql=false)
 
void close (UT_ErrorCode *ec=nullptr)
 
template<typename T >
void registerModelMeta ()
 
UT_ORMModelMetaregisterModelMeta (const UT_SharedPtr< UT_ORMModelMeta > &meta)
 
UT_SharedPtr< UT_ORMModelMetalookupMeta (const UT_StringView &name)
 
const UT_Array< UT_SharedPtr
< UT_ORMModelMeta > > & 
metas () const
 

Protected Member Functions

UT_SqlDatabasegetDatabase_ ()
 
void error_ (const UT_StringHolder &error, const UT_ErrorCode &ec)
 
UT_Array< std::pair
< UT_SharedPtr
< UT_ORMMigration >, bool > > 
sortMigrations_ (const UT_Array< UT_SharedPtr< UT_ORMMigration >> &migrations, const UT_StringSet &applied_migrations, UT_ErrorCode &ec)
 
void recordMigration_ (const UT_ORMMigration &mig)
 
void collectAppliedMigrations_ (UT_StringSet &applied_migrations, UT_StringHolder &message, UT_ErrorCode &ec)
 
void createMigrationTableIfNotExist_ (UT_StringHolder &message, UT_ErrorCode &ec)
 

Static Protected Member Functions

static UT_UniquePtr
< UT_IORMOperation
createOperation (const UT_StringRef &type)
 

Protected Attributes

UT_Options myOptions
 
UT_ThreadSpecificValue
< UT_SqlDatabase
myDB
 
error_callback_t myErrorCallback
 
UT_Lock myInternalLock
 
SYS_AtomicInt32 myHasConfiguredInternals
 
UT_Array< UT_SharedPtr
< UT_ORMModelMeta > > 
myBuildStack
 
UT_Array< UT_SharedPtr
< UT_ORMModelMeta > > 
myRegisteredMetas
 

Friends

class UT_SqlOrmTable
 

Detailed Description

Definition at line 299 of file UT_SQLORM.h.

Member Typedef Documentation

Definition at line 303 of file UT_SQLORM.h.

Constructor & Destructor Documentation

UT_SqlOrm::UT_SqlOrm ( const UT_StringHolder db_path)
explicit
UT_SqlOrm::UT_SqlOrm ( )
virtual UT_SqlOrm::~UT_SqlOrm ( )
virtualdefault

Member Function Documentation

void UT_SqlOrm::close ( UT_ErrorCode ec = nullptr)
void UT_SqlOrm::collectAppliedMigrations_ ( UT_StringSet applied_migrations,
UT_StringHolder message,
UT_ErrorCode ec 
)
protected
void UT_SqlOrm::configure ( const UT_StringHolder db_path,
error_callback_t &&  clb = error_callback_t() 
)
void UT_SqlOrm::createMigrationTableIfNotExist_ ( UT_StringHolder message,
UT_ErrorCode ec 
)
protected
static UT_UniquePtr<UT_IORMOperation> UT_SqlOrm::createOperation ( const UT_StringRef type)
staticprotected
UT_SqlStatement UT_SqlOrm::cursor ( ) const
inline

Definition at line 314 of file UT_SQLORM.h.

const UT_SqlDatabase& UT_SqlOrm::database ( ) const
inline

Definition at line 318 of file UT_SQLORM.h.

UT_SqlDatabase& UT_SqlOrm::database ( )
inline

Definition at line 322 of file UT_SQLORM.h.

void UT_SqlOrm::error_ ( const UT_StringHolder error,
const UT_ErrorCode ec 
)
protected
UT_SqlDatabase& UT_SqlOrm::getDatabase_ ( )
protected
UT_SharedPtr<UT_ORMModelMeta> UT_SqlOrm::lookupMeta ( const UT_StringView name)
inline

Definition at line 378 of file UT_SQLORM.h.

const UT_Array<UT_SharedPtr<UT_ORMModelMeta> >& UT_SqlOrm::metas ( ) const
inline

Definition at line 388 of file UT_SQLORM.h.

void UT_SqlOrm::migrate ( UT_ORMMigrationResult result,
bool  collect_sql = false 
)
void UT_SqlOrm::recordMigration_ ( const UT_ORMMigration mig)
protected
template<typename T >
void UT_SqlOrm::registerModelMeta ( )
inline

Definition at line 343 of file UT_SQLORM.h.

UT_ORMModelMeta* UT_SqlOrm::registerModelMeta ( const UT_SharedPtr< UT_ORMModelMeta > &  meta)
inline

Definition at line 363 of file UT_SQLORM.h.

UT_Array<std::pair<UT_SharedPtr<UT_ORMMigration>, bool> > UT_SqlOrm::sortMigrations_ ( const UT_Array< UT_SharedPtr< UT_ORMMigration >> &  migrations,
const UT_StringSet applied_migrations,
UT_ErrorCode ec 
)
protected
UT_AutoSqlTransaction UT_SqlOrm::transaction ( UT_AutoSqlTransaction::commit_callback_t &&  callback,
bool  savepoint = true 
)
inline

Definition at line 327 of file UT_SQLORM.h.

UT_SqlOrm::UT_NON_COPYABLE ( UT_SqlOrm  )

Friends And Related Function Documentation

friend class UT_SqlOrmTable
friend

Definition at line 394 of file UT_SQLORM.h.

Member Data Documentation

UT_Array<UT_SharedPtr<UT_ORMModelMeta> > UT_SqlOrm::myBuildStack
protected

Definition at line 425 of file UT_SQLORM.h.

UT_ThreadSpecificValue<UT_SqlDatabase> UT_SqlOrm::myDB
protected

Definition at line 418 of file UT_SQLORM.h.

error_callback_t UT_SqlOrm::myErrorCallback
protected

Definition at line 419 of file UT_SQLORM.h.

SYS_AtomicInt32 UT_SqlOrm::myHasConfiguredInternals
protected

Definition at line 422 of file UT_SQLORM.h.

UT_Lock UT_SqlOrm::myInternalLock
protected

Definition at line 421 of file UT_SQLORM.h.

UT_Options UT_SqlOrm::myOptions
protected

Definition at line 417 of file UT_SQLORM.h.

UT_Array<UT_SharedPtr<UT_ORMModelMeta> > UT_SqlOrm::myRegisteredMetas
protected

Definition at line 427 of file UT_SQLORM.h.


The documentation for this class was generated from the following file: