HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UT_SqlBaseDriver Class Referenceabstract

#include <UT_SQL.h>

+ Inheritance diagram for UT_SqlBaseDriver:

Public Member Functions

virtual ~UT_SqlBaseDriver ()=default
 
 UT_NON_COPYABLE (UT_SqlBaseDriver)
 
virtual void setHostName (const UT_StringHolder &host)
 
virtual void setPort (int port)
 
virtual void setUserName (const UT_StringHolder &user)
 
virtual void setPassword (const UT_StringHolder &password)
 
virtual void setDatabaseName (const UT_StringHolder &db_name)
 
virtual void setConnectOptions (const UT_Options &options)
 
virtual bool connect (UT_ErrorCode *ec=nullptr)=0
 
virtual bool close (UT_ErrorCode *ec=nullptr)=0
 
virtual NO_DISCARD bool isValid () const =0
 
virtual NO_DISCARD bool isReadOnly (const char *db="main", UT_ErrorCode *ec=nullptr) const =0
 
virtual NO_DISCARD voidnativeAPI ()=0
 
virtual NO_DISCARD voidnativeAPI () const =0
 
virtual NO_DISCARD
UT_SharedPtr
< UT_SqlStatementImpl
createStatementImpl ()=0
 
virtual NO_DISCARD
UT_SharedPtr
< UT_SqlStatementImpl
createStatementImpl () const =0
 
virtual NO_DISCARD bool tableExists (const UT_StringRef &name, UT_ErrorCode *ec=nullptr) const =0
 Check if the specified table exists. More...
 
virtual NO_DISCARD bool indexExists (const UT_StringRef &name, UT_ErrorCode *ec=nullptr) const =0
 
virtual NO_DISCARD bool viewExists (const UT_StringRef &name, UT_ErrorCode *ec=nullptr) const =0
 
virtual NO_DISCARD bool columnExists (const UT_StringRef &table_name, const UT_StringRef &column_name, UT_ErrorCode *ec=nullptr) const =0
 
virtual NO_DISCARD UT_StringHolder errorMessage () const =0
 
virtual NO_DISCARD int errorCode () const =0
 
virtual NO_DISCARD int extendedErrorCode () const =0
 
virtual bool startTransaction (UT_ErrorCode *ec=nullptr)=0
 
virtual bool endTransaction (bool commit, UT_ErrorCode *ec=nullptr)=0
 
virtual UT_SharedPtr
< UT_SqlStatementImpl
cachedStatement (const UT_SqlStatementHandleId &id, const UT_StringRef &sql, UT_ErrorCode *ec=nullptr) const =0
 
virtual UT_SharedPtr
< UT_SqlStatementImpl
findCachedStatement (const UT_SqlStatementHandleId &id) const =0
 
virtual NO_DISCARD UT_StringHolder getSchema (UT_ErrorCode *ec=nullptr) const =0
 
template<typename... Args>
bool run (UT_ErrorCode *ec, const UT_StringRef &sql, Args &&...args)
 Helper function to run an sql statement with provided typed args. More...
 
virtual int exec (const UT_StringRef &sql, UT_ErrorCode *ec=nullptr) const =0
 Returns the number of rows modified, inserted or deleted. More...
 

Protected Member Functions

 UT_SqlBaseDriver ()=default
 

Detailed Description

Definition at line 883 of file UT_SQL.h.

Constructor & Destructor Documentation

virtual UT_SqlBaseDriver::~UT_SqlBaseDriver ( )
virtualdefault
UT_SqlBaseDriver::UT_SqlBaseDriver ( )
protecteddefault

Member Function Documentation

virtual UT_SharedPtr<UT_SqlStatementImpl> UT_SqlBaseDriver::cachedStatement ( const UT_SqlStatementHandleId id,
const UT_StringRef sql,
UT_ErrorCode ec = nullptr 
) const
pure virtual

Get a sql statement that is retrieved from the cache. If the statement is not already cached then its compiled and then cached if the compiled statement is valid.

Implemented in UT_SqliteDriver.

virtual bool UT_SqlBaseDriver::close ( UT_ErrorCode ec = nullptr)
pure virtual

Implemented in UT_SqliteDriver.

virtual NO_DISCARD bool UT_SqlBaseDriver::columnExists ( const UT_StringRef table_name,
const UT_StringRef column_name,
UT_ErrorCode ec = nullptr 
) const
pure virtual

Implemented in UT_SqliteDriver.

virtual bool UT_SqlBaseDriver::connect ( UT_ErrorCode ec = nullptr)
pure virtual

Implemented in UT_SqliteDriver.

virtual NO_DISCARD UT_SharedPtr<UT_SqlStatementImpl> UT_SqlBaseDriver::createStatementImpl ( )
pure virtual

Implemented in UT_SqliteDriver.

virtual NO_DISCARD UT_SharedPtr<UT_SqlStatementImpl> UT_SqlBaseDriver::createStatementImpl ( ) const
pure virtual

Implemented in UT_SqliteDriver.

virtual bool UT_SqlBaseDriver::endTransaction ( bool  commit,
UT_ErrorCode ec = nullptr 
)
pure virtual

Implemented in UT_SqliteDriver.

virtual NO_DISCARD int UT_SqlBaseDriver::errorCode ( ) const
pure virtual

Implemented in UT_SqliteDriver.

virtual NO_DISCARD UT_StringHolder UT_SqlBaseDriver::errorMessage ( ) const
pure virtual

Implemented in UT_SqliteDriver.

virtual int UT_SqlBaseDriver::exec ( const UT_StringRef sql,
UT_ErrorCode ec = nullptr 
) const
pure virtual

Returns the number of rows modified, inserted or deleted.

Implemented in UT_SqliteDriver.

virtual NO_DISCARD int UT_SqlBaseDriver::extendedErrorCode ( ) const
pure virtual

Implemented in UT_SqliteDriver.

virtual UT_SharedPtr<UT_SqlStatementImpl> UT_SqlBaseDriver::findCachedStatement ( const UT_SqlStatementHandleId id) const
pure virtual

Find an sql handle based on its id. The sql statement must have already been added from cachedStatement(). This method is typically used when a statement has already been compiled and added to the cache but needs to be dynamically looked up some time later.

Implemented in UT_SqliteDriver.

virtual NO_DISCARD UT_StringHolder UT_SqlBaseDriver::getSchema ( UT_ErrorCode ec = nullptr) const
pure virtual

Implemented in UT_SqliteDriver.

virtual NO_DISCARD bool UT_SqlBaseDriver::indexExists ( const UT_StringRef name,
UT_ErrorCode ec = nullptr 
) const
pure virtual

Implemented in UT_SqliteDriver.

virtual NO_DISCARD bool UT_SqlBaseDriver::isReadOnly ( const char *  db = "main",
UT_ErrorCode ec = nullptr 
) const
pure virtual

Implemented in UT_SqliteDriver.

virtual NO_DISCARD bool UT_SqlBaseDriver::isValid ( ) const
pure virtual

Implemented in UT_SqliteDriver.

virtual NO_DISCARD void* UT_SqlBaseDriver::nativeAPI ( )
pure virtual

Implemented in UT_SqliteDriver.

virtual NO_DISCARD void* UT_SqlBaseDriver::nativeAPI ( ) const
pure virtual

Implemented in UT_SqliteDriver.

template<typename... Args>
bool UT_SqlBaseDriver::run ( UT_ErrorCode ec,
const UT_StringRef sql,
Args &&...  args 
)
inline

Helper function to run an sql statement with provided typed args.

Definition at line 976 of file UT_SQL.h.

virtual void UT_SqlBaseDriver::setConnectOptions ( const UT_Options options)
inlinevirtual

Reimplemented in UT_SqliteDriver.

Definition at line 904 of file UT_SQL.h.

virtual void UT_SqlBaseDriver::setDatabaseName ( const UT_StringHolder db_name)
inlinevirtual

Reimplemented in UT_SqliteDriver.

Definition at line 901 of file UT_SQL.h.

virtual void UT_SqlBaseDriver::setHostName ( const UT_StringHolder host)
inlinevirtual

Definition at line 889 of file UT_SQL.h.

virtual void UT_SqlBaseDriver::setPassword ( const UT_StringHolder password)
inlinevirtual

Definition at line 898 of file UT_SQL.h.

virtual void UT_SqlBaseDriver::setPort ( int  port)
inlinevirtual

Definition at line 892 of file UT_SQL.h.

virtual void UT_SqlBaseDriver::setUserName ( const UT_StringHolder user)
inlinevirtual

Definition at line 895 of file UT_SQL.h.

virtual bool UT_SqlBaseDriver::startTransaction ( UT_ErrorCode ec = nullptr)
pure virtual

These are primarily used by UT_SqlTransaction (but can be used by any client code) and provide an abstraction that resembles nested transations. This is inspired by (and follows the same behaviour as): https://developer.android.com/reference/android/database/sqlite/SQLiteDatabase#beginTransaction()

Implemented in UT_SqliteDriver.

virtual NO_DISCARD bool UT_SqlBaseDriver::tableExists ( const UT_StringRef name,
UT_ErrorCode ec = nullptr 
) const
pure virtual

Check if the specified table exists.

Implemented in UT_SqliteDriver.

UT_SqlBaseDriver::UT_NON_COPYABLE ( UT_SqlBaseDriver  )
virtual NO_DISCARD bool UT_SqlBaseDriver::viewExists ( const UT_StringRef name,
UT_ErrorCode ec = nullptr 
) const
pure virtual

Implemented in UT_SqliteDriver.


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