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

#include <UT_SQL.h>

Public Types

using null_tag_t = UT_SqlStatementImpl::null_tag_t
 
using Blob = UT_SqlStatementImpl::Blob
 
using DataType = UT_SqlStatementImpl::DataType
 

Public Member Functions

 UT_SqlStatement (const UT_SqlDatabase &con, const UT_StringRef &sql)
 
 UT_SqlStatement (const UT_SqlDatabase &con)
 
 UT_SqlStatement (const UT_SqlBaseDriver &driver, const UT_StringRef &sql)
 
 UT_SqlStatement (const UT_SqlBaseDriver &driver)
 
 UT_SqlStatement (const UT_SharedPtr< UT_SqlStatementImpl > &impl)
 
 ~UT_SqlStatement ()
 
 UT_NON_COPYABLE (UT_SqlStatement)
 
void reset (bool clear_bindings=false)
 
NO_DISCARD int columnAsInt (int idx) const
 
NO_DISCARD bool columnAsBool (int idx) const
 
NO_DISCARD int64 columnAsInt64 (int idx) const
 
NO_DISCARD UT_StringHolder columnAsStr (int idx) const
 
NO_DISCARD double columnAsDouble (int idx) const
 
NO_DISCARD UT_IntArray columnAsIntArray (int idx) const
 
NO_DISCARD UT_Int64Array columnAsInt64Array (int idx) const
 
NO_DISCARD UT_DateTimeField columnAsDate (int idx) const
 
NO_DISCARD const voidcolumnAsBlob (int idx, int &size) const
 
NO_DISCARD Blob columnAsBlob (int idx) const
 
NO_DISCARD null_tag_t columnAsNull (int idx) const
 
NO_DISCARD UT_StringHolder columnName (int idx) const
 
NO_DISCARD int columnCount () const
 
NO_DISCARD DataType columnType (int idx) const
 
NO_DISCARD int columnBytes (int idx) const
 
const char * sql () const
 
bool bind (int idx, null_tag_t)
 
bool bind (int idx, const UT_StringRef &value)
 
bool bind (int idx, const char *value)
 
bool bind (int idx, int value)
 
bool bind (int idx, int64 value)
 
bool bind (int idx, bool value)
 
bool bind (int idx, double value)
 
bool bind (int idx, const UT_IntArray &value)
 
bool bind (int idx, const UT_Int64Array &value)
 
bool bind (int idx, const UT_StringArray &value)
 
bool bind (int idx, const void *value, int size)
 
bool bind (int idx, Blob blob)
 
bool bind (int idx, const UT_DateTimeField &dt)
 
const UT_StringHolderintTypeString () const
 
const UT_StringHolderstringTypeString () const
 
const UT_StringHoldernullTypeString () const
 
const UT_StringHolderrealTypeString () const
 
const UT_StringHolderblobTypeString () const
 
const UT_StringHolderdateTimeTypeString () const
 
const UT_StringHolderboolTypeString () const
 
template<typename T >
T get (int idx) const
 
template<typename... Args>
bool bindAll (Args &&...args)
 
bool bindNull (int idx)
 
NO_DISCARD bool isValid () const
 
bool hasRow ()
 
bool run ()
 
bool step ()
 
const UT_ErrorCodegetError () const
 
bool prepare (const UT_StringRef &sql, UT_ErrorCode &ec)
 
bool prepare (const UT_SqlStatementHandleId &id, const UT_StringRef &sql, UT_ErrorCode &ec)
 
template<typename... Args>
UT_SqlResult execute (const UT_StringRef &sql, Args &&...args)
 Helper function to create a new statement to run a new sql statement. More...
 
template<typename... Args>
UT_SqlResult execute (const UT_SqlStatementHandleId &id, const UT_StringRef &sql, Args &&...args)
 Helper function to create a new statement to run a new sql statement. More...
 
template<typename... Args>
std::optional< std::tuple
< Args...> > 
fetchOne (UT_ErrorCode *ec=nullptr)
 
template<typename... Args>
UT_Array< std::tuple< Args...> > fetchAll (UT_ErrorCode *ec=nullptr)
 
template<typename... Args>
std::optional< std::tuple
< std::tuple< Args...> > > 
as (UT_ErrorCode *ec=nullptr)
 
NO_DISCARD bool tableExists (const UT_StringRef &name, UT_ErrorCode *ec=nullptr) const
 
int changes () const
 
template<>
double get (int idx) const
 
template<>
UT_StringHolder get (int idx) const
 
template<>
int get (int idx) const
 
template<>
int64 get (int idx) const
 
template<>
bool get (int idx) const
 
template<>
UT_DateTimeField get (int idx) const
 
template<>
const voidget (int idx) const
 

Protected Member Functions

bool bindHelper (int)
 
template<typename T , typename... Args>
bool bindHelper (int idx, T value, Args &&...args)
 
template<class... Args, std::size_t... Idxs>
std::tuple< Args...> fetchRow_ (std::index_sequence< Idxs...>)
 

Detailed Description

Definition at line 406 of file UT_SQL.h.

Member Typedef Documentation

Definition at line 410 of file UT_SQL.h.

Constructor & Destructor Documentation

UT_SqlStatement::UT_SqlStatement ( const UT_SqlDatabase con,
const UT_StringRef sql 
)
UT_SqlStatement::UT_SqlStatement ( const UT_SqlDatabase con)
UT_SqlStatement::UT_SqlStatement ( const UT_SqlBaseDriver driver,
const UT_StringRef sql 
)
UT_SqlStatement::UT_SqlStatement ( const UT_SqlBaseDriver driver)
UT_SqlStatement::UT_SqlStatement ( const UT_SharedPtr< UT_SqlStatementImpl > &  impl)
UT_SqlStatement::~UT_SqlStatement ( )

Member Function Documentation

template<typename... Args>
std::optional<std::tuple<std::tuple<Args...> > > UT_SqlStatement::as ( UT_ErrorCode ec = nullptr)
inline

Definition at line 729 of file UT_SQL.h.

bool UT_SqlStatement::bind ( int  idx,
null_tag_t   
)
inline

Definition at line 490 of file UT_SQL.h.

bool UT_SqlStatement::bind ( int  idx,
const UT_StringRef value 
)
inline

Definition at line 494 of file UT_SQL.h.

bool UT_SqlStatement::bind ( int  idx,
const char *  value 
)
inline

Definition at line 498 of file UT_SQL.h.

bool UT_SqlStatement::bind ( int  idx,
int  value 
)
inline

Definition at line 502 of file UT_SQL.h.

bool UT_SqlStatement::bind ( int  idx,
int64  value 
)
inline

Definition at line 506 of file UT_SQL.h.

bool UT_SqlStatement::bind ( int  idx,
bool  value 
)
inline

Definition at line 510 of file UT_SQL.h.

bool UT_SqlStatement::bind ( int  idx,
double  value 
)
inline

Definition at line 514 of file UT_SQL.h.

bool UT_SqlStatement::bind ( int  idx,
const UT_IntArray value 
)
inline

Definition at line 519 of file UT_SQL.h.

bool UT_SqlStatement::bind ( int  idx,
const UT_Int64Array value 
)
inline

Definition at line 523 of file UT_SQL.h.

bool UT_SqlStatement::bind ( int  idx,
const UT_StringArray value 
)
inline

Definition at line 527 of file UT_SQL.h.

bool UT_SqlStatement::bind ( int  idx,
const void value,
int  size 
)
inline

Definition at line 533 of file UT_SQL.h.

bool UT_SqlStatement::bind ( int  idx,
Blob  blob 
)
inline

Definition at line 537 of file UT_SQL.h.

bool UT_SqlStatement::bind ( int  idx,
const UT_DateTimeField dt 
)
inline

Definition at line 541 of file UT_SQL.h.

template<typename... Args>
bool UT_SqlStatement::bindAll ( Args &&...  args)
inline

Definition at line 586 of file UT_SQL.h.

bool UT_SqlStatement::bindHelper ( int  )
inlineprotected

Definition at line 758 of file UT_SQL.h.

template<typename T , typename... Args>
bool UT_SqlStatement::bindHelper ( int  idx,
T  value,
Args &&...  args 
)
inlineprotected

Definition at line 761 of file UT_SQL.h.

bool UT_SqlStatement::bindNull ( int  idx)
inline

Definition at line 589 of file UT_SQL.h.

const UT_StringHolder& UT_SqlStatement::blobTypeString ( ) const
inline

Definition at line 562 of file UT_SQL.h.

const UT_StringHolder& UT_SqlStatement::boolTypeString ( ) const
inline

Definition at line 570 of file UT_SQL.h.

int UT_SqlStatement::changes ( ) const
inline

Definition at line 755 of file UT_SQL.h.

NO_DISCARD const void* UT_SqlStatement::columnAsBlob ( int  idx,
int size 
) const
inline

Definition at line 453 of file UT_SQL.h.

NO_DISCARD Blob UT_SqlStatement::columnAsBlob ( int  idx) const
inline

Definition at line 457 of file UT_SQL.h.

NO_DISCARD bool UT_SqlStatement::columnAsBool ( int  idx) const
inline

Definition at line 430 of file UT_SQL.h.

NO_DISCARD UT_DateTimeField UT_SqlStatement::columnAsDate ( int  idx) const
inline

Definition at line 448 of file UT_SQL.h.

NO_DISCARD double UT_SqlStatement::columnAsDouble ( int  idx) const
inline

Definition at line 442 of file UT_SQL.h.

NO_DISCARD int UT_SqlStatement::columnAsInt ( int  idx) const
inline

Definition at line 426 of file UT_SQL.h.

NO_DISCARD int64 UT_SqlStatement::columnAsInt64 ( int  idx) const
inline

Definition at line 434 of file UT_SQL.h.

NO_DISCARD UT_Int64Array UT_SqlStatement::columnAsInt64Array ( int  idx) const
NO_DISCARD UT_IntArray UT_SqlStatement::columnAsIntArray ( int  idx) const
NO_DISCARD null_tag_t UT_SqlStatement::columnAsNull ( int  idx) const
inline

Definition at line 461 of file UT_SQL.h.

NO_DISCARD UT_StringHolder UT_SqlStatement::columnAsStr ( int  idx) const
inline

Definition at line 438 of file UT_SQL.h.

NO_DISCARD int UT_SqlStatement::columnBytes ( int  idx) const
inline

Definition at line 477 of file UT_SQL.h.

NO_DISCARD int UT_SqlStatement::columnCount ( ) const
inline

Definition at line 469 of file UT_SQL.h.

NO_DISCARD UT_StringHolder UT_SqlStatement::columnName ( int  idx) const
inline

Definition at line 465 of file UT_SQL.h.

NO_DISCARD DataType UT_SqlStatement::columnType ( int  idx) const
inline

Definition at line 473 of file UT_SQL.h.

const UT_StringHolder& UT_SqlStatement::dateTimeTypeString ( ) const
inline

Definition at line 566 of file UT_SQL.h.

template<typename... Args>
UT_SqlResult UT_SqlStatement::execute ( const UT_StringRef sql,
Args &&...  args 
)
inline

Helper function to create a new statement to run a new sql statement.

Definition at line 626 of file UT_SQL.h.

template<typename... Args>
UT_SqlResult UT_SqlStatement::execute ( const UT_SqlStatementHandleId id,
const UT_StringRef sql,
Args &&...  args 
)
inline

Helper function to create a new statement to run a new sql statement.

Definition at line 642 of file UT_SQL.h.

template<typename... Args>
UT_Array<std::tuple<Args...> > UT_SqlStatement::fetchAll ( UT_ErrorCode ec = nullptr)
inline

Definition at line 694 of file UT_SQL.h.

template<typename... Args>
std::optional<std::tuple<Args...> > UT_SqlStatement::fetchOne ( UT_ErrorCode ec = nullptr)
inline

Move to the next row

Definition at line 660 of file UT_SQL.h.

template<class... Args, std::size_t... Idxs>
std::tuple<Args...> UT_SqlStatement::fetchRow_ ( std::index_sequence< Idxs...>  )
inlineprotected

Definition at line 770 of file UT_SQL.h.

template<typename T >
T UT_SqlStatement::get ( int  idx) const
inline

Definition at line 576 of file UT_SQL.h.

template<>
double UT_SqlStatement::get ( int  idx) const
inline

Definition at line 782 of file UT_SQL.h.

template<>
UT_StringHolder UT_SqlStatement::get ( int  idx) const
inline

Definition at line 796 of file UT_SQL.h.

template<>
int UT_SqlStatement::get ( int  idx) const
inline

Definition at line 803 of file UT_SQL.h.

template<>
int64 UT_SqlStatement::get ( int  idx) const
inline

Definition at line 810 of file UT_SQL.h.

template<>
bool UT_SqlStatement::get ( int  idx) const
inline

Definition at line 817 of file UT_SQL.h.

template<>
UT_DateTimeField UT_SqlStatement::get ( int  idx) const
inline

Definition at line 824 of file UT_SQL.h.

template<>
const void* UT_SqlStatement::get ( int  idx) const
inline

Definition at line 831 of file UT_SQL.h.

const UT_ErrorCode& UT_SqlStatement::getError ( ) const
inline

Definition at line 615 of file UT_SQL.h.

bool UT_SqlStatement::hasRow ( )
inline

Definition at line 597 of file UT_SQL.h.

const UT_StringHolder& UT_SqlStatement::intTypeString ( ) const
inline

Definition at line 546 of file UT_SQL.h.

NO_DISCARD bool UT_SqlStatement::isValid ( ) const
inline

Definition at line 592 of file UT_SQL.h.

const UT_StringHolder& UT_SqlStatement::nullTypeString ( ) const
inline

Definition at line 554 of file UT_SQL.h.

bool UT_SqlStatement::prepare ( const UT_StringRef sql,
UT_ErrorCode ec 
)
bool UT_SqlStatement::prepare ( const UT_SqlStatementHandleId id,
const UT_StringRef sql,
UT_ErrorCode ec 
)
const UT_StringHolder& UT_SqlStatement::realTypeString ( ) const
inline

Definition at line 558 of file UT_SQL.h.

void UT_SqlStatement::reset ( bool  clear_bindings = false)
inline

Definition at line 421 of file UT_SQL.h.

bool UT_SqlStatement::run ( )
inline

Definition at line 603 of file UT_SQL.h.

const char* UT_SqlStatement::sql ( ) const
inline

Definition at line 483 of file UT_SQL.h.

bool UT_SqlStatement::step ( )
inline

Definition at line 608 of file UT_SQL.h.

const UT_StringHolder& UT_SqlStatement::stringTypeString ( ) const
inline

Definition at line 550 of file UT_SQL.h.

NO_DISCARD bool UT_SqlStatement::tableExists ( const UT_StringRef name,
UT_ErrorCode ec = nullptr 
) const
inline

Definition at line 749 of file UT_SQL.h.

UT_SqlStatement::UT_NON_COPYABLE ( UT_SqlStatement  )

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