44 #define NO_DISCARD SYS_NO_DISCARD_RESULT
74 template <>
struct is_error_code_enum<UT::
SqlError> : true_type
81 template <
typename SqlT,
typename T,
typename = std::
void_t<>>
84 template <
typename SqlT,
typename T>
89 std::declval<SqlT &>(),
91 std::declval<const T &>()))>>
94 template <
typename SqlT,
typename T,
typename = std::
void_t<>>
97 template <
typename SqlT,
typename T>
102 std::declval<SqlT &>(),
104 std::declval<T &>()))>>
107 template <
typename SqlT,
typename T,
typename = std::
void_t<>>
110 template <
typename SqlT,
typename T>
114 std::void_t<decltype(std::declval<SqlT>().bind(0, std::declval<T>()))>>
122 mySourceFile(source_file), mySourceLine(source_line)
127 if (mySourceLine !=
id.mySourceLine)
128 return mySourceLine <
id.mySourceLine;
129 return SYSstrcmp(mySourceFile,
id.mySourceFile) < 0;
132 const char* mySourceFile;
136 #define UT_SQL_ID UT_SqlStatementHandleId(__FILE__, __LINE__)
144 const void* myPtr =
nullptr;
145 std::size_t mySize = 0;
146 bool myIsStatic =
true;
166 virtual void reset(
bool clear_bindings =
false) = 0;
171 NO_DISCARD virtual int columnAsInt(
int idx)
const = 0;
172 NO_DISCARD virtual bool columnAsBool(
int idx)
const = 0;
175 NO_DISCARD virtual double columnAsDouble(
int idx)
const = 0;
180 NO_DISCARD virtual const void *columnAsBlob(
int idx,
int &
size)
const = 0;
182 NO_DISCARD virtual null_tag_t columnAsNull(
int idx)
const = 0;
184 NO_DISCARD virtual int columnCount()
const = 0;
186 NO_DISCARD virtual int columnBytes(
int idx)
const = 0;
198 virtual const char* sql()
const = 0;
202 virtual bool bind(
int idx, null_tag_t) = 0;
204 virtual bool bind(
int idx,
const char *
value) = 0;
205 virtual bool bind(
int idx,
int value) = 0;
207 virtual bool bind(
int idx,
bool value) = 0;
208 virtual bool bind(
int idx,
double value) = 0;
220 bool is_static =
true)
232 virtual bool step() = 0;
233 virtual bool run() = 0;
235 virtual int changes()
const = 0;
237 virtual bool hasRow() = 0;
263 void reset(
bool clear_bindings =
false)
override final;
283 const char*
sql()
const override final;
289 bool bind(
int idx,
const char *value)
override final;
290 bool bind(
int idx,
int value)
override final;
291 bool bind(
int idx,
int64 value)
override final;
292 bool bind(
int idx,
bool value)
override final;
293 bool bind(
int idx,
double value)
override final;
300 bool bind(
int idx,
const void *value,
int size,
bool is_static =
true)
316 bool step()
override final;
317 bool run()
override final;
341 bool verifyIndex_(
int idx)
const;
342 bool verifyColumn_(
int idx)
const;
343 bool verifyHasStepped_()
const;
346 sqlite3_stmt *myCtx =
nullptr;
349 unsigned myHasStepped : 1, myHasRow : 1;
378 if (myResult !=
nullptr && rhs.myResult !=
nullptr)
379 return myResult->myStmt == rhs.myResult->
myStmt;
380 else if (myResult ==
nullptr && rhs.myResult ==
nullptr)
386 return !(*
this == rhs);
405 return myResult ==
nullptr || !myResult->hasResults();
451 template <
typename... Args>
453 template <
typename... Args>
455 template <
typename T>
457 template <
typename... Args>
487 void reset(
bool clear_bindings = false)
489 myImpl->
reset(clear_bindings);
494 return myImpl->columnAsInt(idx);
498 return myImpl->columnAsBool(idx);
502 return myImpl->columnAsInt64(idx);
506 return myImpl->columnAsStr(idx);
510 return myImpl->columnAsDouble(idx);
516 return myImpl->columnAsDate(idx);
521 return myImpl->columnAsBlob(idx, size);
525 return myImpl->columnAsBlob(idx);
529 return myImpl->columnAsNull(idx);
533 return myImpl->columnName(idx);
537 return myImpl->columnCount();
541 return myImpl->columnType(idx);
545 return myImpl->columnBytes(idx);
551 return myImpl->sql();
562 return myImpl->bind(idx, value);
566 return myImpl->bind(idx, value);
570 return myImpl->bind(idx, value);
574 return myImpl->bind(idx, value);
578 return myImpl->bind(idx, value);
582 return myImpl->bind(idx, value);
587 return myImpl->bind(idx, value);
591 return myImpl->bind(idx, value);
595 return myImpl->bind(idx, value);
601 return myImpl->bind(idx, value, size);
605 return myImpl->bind(idx, blob);
609 return myImpl->bind(idx, dt);
613 std::enable_if_t<UT::has_sql_bind_v<UT_SqlStatement, T>,
bool> =
true>
616 return bindCustom_(idx, v);
621 return myImpl->intTypeString();
625 return myImpl->bigIntTypeString();
629 return myImpl->stringTypeString();
633 return myImpl->nullTypeString();
637 return myImpl->realTypeString();
641 return myImpl->blobTypeString();
645 return myImpl->dateTimeTypeString();
649 return myImpl->boolTypeString();
652 template <
typename T>
655 if constexpr (UT::has_sql_get_v<UT_SqlStatement, T>)
664 !std::is_same_v<T, void> && std::is_same_v<T, void>,
665 "Type not handled.");
671 template <
typename... Args>
673 {
return bindHelper(1, std::forward<Args>(
args)...); }
680 return myImpl && myImpl->isValid();
685 return myImpl->hasRow();
691 return myImpl->run();
696 return myImpl->step();
702 {
return myImpl->getError(); }
711 template <
typename... Args>
715 if (!prepare(sql, ec))
720 bindAll(std::forward<Args>(
args)...);
727 template <
typename... Args>
734 if (!prepare(
id, sql, ec))
738 bindAll(std::forward<Args>(
args)...);
745 template <
typename... Args>
749 bindAll(std::forward<Args>(
args)...);
754 template <
typename... Args>
757 constexpr
int ColumnCount =
sizeof...(Args);
773 auto r = fetchRow_<Args...>(std::make_index_sequence<ColumnCount>{});
788 template <
typename... Args>
806 constexpr
int ColumnCount =
sizeof...(Args);
807 auto idx_sequence = std::make_index_sequence<ColumnCount>{};
810 rows.emplace_back(fetchRow_<Args...>(idx_sequence));
823 template <
typename T>
856 template <
typename... Args>
873 constexpr
int ColumnCount =
sizeof...(Args);
874 return fetchRow_<Args...>(std::make_index_sequence<ColumnCount>{});
880 return myImpl->tableExists(name, ec);
883 int changes()
const {
return myImpl->changes(); }
887 return myImpl == rhs.myImpl;
893 template <
typename T,
typename... Args>
896 if (!bind(idx, value))
898 return bindHelper(idx + 1, std::forward<Args>(
args)...);
901 template <
class... Args, std::size_t... Idxs>
905 return std::make_tuple(get<Args>(Idxs)...);
909 template <
typename T>
910 bool bindCustom_(
int idx,
const T&
v);
918 UT_SqlStatement::get<double>(
int idx)
const
920 return columnAsDouble(idx);
925 UT_SqlStatement::get<UT_SqlStatement::null_tag_t>(
int idx)
const
927 return columnAsNull(idx);
932 UT_SqlStatement::get<UT_StringHolder>(
int idx)
const
934 return columnAsStr(idx);
939 UT_SqlStatement::get<int>(
int idx)
const
941 return columnAsInt(idx);
946 UT_SqlStatement::get<int64>(
int idx)
const
948 return columnAsInt64(idx);
953 UT_SqlStatement::get<bool>(
int idx)
const
955 return columnAsBool(idx);
960 UT_SqlStatement::get<UT_DateTimeField>(
int idx)
const
962 return columnAsDate(idx);
967 UT_SqlStatement::get<const void *>(
int idx)
const
970 return columnAsBlob(idx, size);
975 UT_SqlStatement::get<UT_SqlStatement::Blob>(
int idx)
const
977 return columnAsBlob(idx);
1000 template <
typename... Args>
1001 inline std::tuple<Args...>
1007 template <
typename... Args>
1008 inline UT_Array<std::tuple<Args...>>
1014 template <
typename T>
1021 template <
typename... Args>
1022 inline std::tuple<Args...>
1057 const char *db =
"main",
1062 NO_DISCARD virtual void* nativeAPI()
const = 0;
1088 NO_DISCARD virtual int errorCode()
const = 0;
1089 NO_DISCARD virtual int extendedErrorCode()
const = 0;
1099 virtual void setAutoCommit(
bool autocommit,
UT_ErrorCode* ec =
nullptr) = 0;
1105 virtual bool startTransaction(
UT_ErrorCode *ec =
nullptr) = 0;
1135 template <
typename... Args>
1139 if (
sizeof...(Args) > 0)
1161 =
"SQLITE_TRANSACTION_MODE";
1184 myFilename = db_name;
1192 {
return myCtx !=
nullptr && myFilename.isstring(); }
1243 myBusyTimeout = timeout_ms;
1288 bool schemaItemExists(
1300 sqlite3 *myCtx =
nullptr;
1302 bool myShouldCommitTransaction;
1305 int myBusyTimeout = -1;
1306 ThreadingMode myThreadingMode = ThreadingMode::DEFAULT_MODE;
1308 bool myCreateDirs =
false;
1324 return myDriver.get();
1328 return myDriver.get();
1333 myDriver->setHostName(host);
1337 myDriver->setPort(port);
1341 myDriver->setUserName(user);
1345 myDriver->setPassword(password);
1349 myDriver->setDatabaseName(db_name);
1353 myDriver->setConnectOptions(options);
1361 return myDriver && myDriver->connect(ec);
1366 return myDriver && myDriver->isValid();
1369 const char *db =
"main",
1372 return myDriver->isReadOnly(db, ec);
1376 return myDriver->createStatementImpl();
1380 return myDriver->createStatementImpl();
1390 return myDriver->cachedStatement(
id, sql, ec);
1398 return myDriver->cachedStatement(
id, std::move(creator), ec);
1408 return myDriver->findCachedStatement(
id);
1411 template <
typename... Args>
1415 if (
sizeof...(Args) > 0)
1425 return myDriver->exec(sql, ec);
1432 return myDriver->tableExists(name, ec);
1437 return myDriver->indexExists(name, ec);
1442 return myDriver->viewExists(name, ec);
1449 return myDriver->columnExists(table_name, column_name, ec);
1453 return myDriver->errorMessage();
1457 return myDriver->errorCode();
1461 return myDriver->extendedErrorCode();
1470 return myDriver->startTransaction(ec);
1474 return myDriver->endTransaction(commit, ec);
1479 return myDriver->getSchema(ec);
1490 void setAutoCommit(
bool autocommit,
UT_ErrorCode* ec =
nullptr);
1498 bool myIsInAtomicBlock =
false;
1499 bool myCommitOnExit =
false;
1500 bool myNeedsRollback =
false;
1502 int mySavePointCounter = 0;
1503 bool myAutocommit =
true;
1544 bool savepoint =
true,
1545 bool durable =
false);
1551 return !myEnterError;
1564 void fail() { myErrorReported =
true; }
1568 return myEnterError;
1572 void exit_(
bool force_rollback);
1573 bool isCurrentError_()
const;
1577 bool mySavePoint =
true;
1578 bool myErrorReported =
false;
1579 commit_callback_t myCommitCallback;
1580 bool myHasCommitted =
false;
1581 bool myDurable =
false;
1589 template <
typename T>
1591 UT_SqlStatement::bindCustom_(
int idx,
const T &
v)
1596 #endif // __UT_SQL_H__
NO_DISCARD null_tag_t columnAsNull(int idx) const
virtual void setPassword(const UT_StringHolder &password)
UT_SqlResult & operator*()
GT_API const UT_StringHolder filename
UT_ErrorCode make_error_code(UT::SqlOrmError e)
virtual NO_DISCARD int extendedErrorCode() const =0
UT_SqlStatementHandleId(const char *source_file, exint source_line)
const UT_ErrorCode & getError() const
UT_SharedPtr< UT_SqlStatementImpl > findCachedStatement(const UT_SqlStatementHandleId &id) const
virtual NO_DISCARD int columnCount() const =0
const UT_SqlResult & operator*() const
virtual NO_DISCARD int64 columnAsInt64(int idx) const =0
UT_SqlResult executePrepared(Args &&...args)
virtual NO_DISCARD UT_IntArray columnAsIntArray(int idx) const =0
UT_SqlDatabase(driver_factory_t factory=UTsqliteFactory)
bool bind(int idx, const UT_StringArray &value)
virtual bool connect(UT_ErrorCode *ec=nullptr)=0
const UT_ErrorCode & entryFailure()
void setDatabaseName(const UT_StringHolder &db_name) override
virtual NO_DISCARD bool isReadOnly(const char *db="main", UT_ErrorCode *ec=nullptr) const =0
bool bind(int idx, const char *value)
std::forward_iterator_tag iterator_category
NO_DISCARD bool tableExists(const UT_StringRef &name, UT_ErrorCode *ec=nullptr) const
virtual NO_DISCARD UT_StringHolder columnName(int idx) const =0
constexpr bool has_sql_get_v
virtual void commit(UT_ErrorCode &ec)=0
NO_DISCARD int columnCount() const
const UT_StringHolder & bigIntTypeString() const
std::optional< std::tuple< std::tuple< Args...> > > as(UT_ErrorCode *ec=nullptr)
virtual NO_DISCARD bool indexExists(const UT_StringRef &name, UT_ErrorCode *ec=nullptr) const =0
GLsizei const GLfloat * value
bool bind(int idx, const UT_Int64Array &value)
virtual void rollbackSavePoint(const UT_StringHolder &sid, UT_ErrorCode &ec)=0
bool bind(int idx, null_tag_t)
UT_Array< T > fetchAllFlat(UT_ErrorCode *ec=nullptr)
NO_DISCARD int extendedErrorCode() const
void setBusyTimeout(int timeout_ms)
const UT_StringHolder & blobTypeString() const
NO_DISCARD bool tableExists(const UT_StringRef &name, UT_ErrorCode *ec=nullptr) const
Check if the specified table exists.
virtual void startSavePoint(const UT_StringHolder &sid, UT_ErrorCode &ec)=0
const UT_SqlBaseDriver * driver() const
UT_Array< T > fetchAllFlat(UT_ErrorCode *ec=nullptr)
SYS_FORCE_INLINE T * SYSconst_cast(const T *foo)
NO_DISCARD bool columnAsBool(int idx) const
const UT_StringHolder & boolTypeString() const
virtual const char * sql() const =0
virtual void commitSavePoint(const UT_StringHolder &sid, UT_ErrorCode &ec)=0
const UT_ErrorCode & getError() const
NO_DISCARD Blob columnAsBlob(int idx) const
constexpr bool is_sql_type_v
const UT_StringHolder & nullTypeString() const
bool bind(int idx, Blob blob)
virtual void prepare(const UT_StringRef &sql, UT_ErrorCode *ec=nullptr)=0
virtual void setPort(int port)
UT_SqlResult execute(const UT_StringRef &sql, Args &&...args)
Helper function to create a new statement to run a new sql statement.
virtual NO_DISCARD bool columnExists(const UT_StringRef &table_name, const UT_StringRef &column_name, UT_ErrorCode *ec=nullptr) const =0
**But if you need a result
std::error_category UT_ErrorCategory
const iterator begin() const
void setHostName(const UT_StringRef &host)
int changes() const overridefinal
virtual bool close(UT_ErrorCode *ec=nullptr)=0
NO_DISCARD UT_StringHolder columnAsStr(int idx) const
GLintptr GLsizeiptr GLboolean commit
virtual NO_DISCARD UT_DateTimeField columnAsDate(int idx) const =0
std::unique_ptr< T, Deleter > UT_UniquePtr
A smart pointer for unique ownership of dynamically allocated objects.
const iterator cend() const
NO_DISCARD bool isReadOnly(const char *db="main", UT_ErrorCode *ec=nullptr) const
bool run(UT_ErrorCode *ec, const UT_StringRef &sql, Args &&...args)
Helper function to run an sql statement with provided typed args.
const UT_StringHolder & stringTypeString() const
virtual NO_DISCARD bool viewExists(const UT_StringRef &name, UT_ErrorCode *ec=nullptr) const =0
NO_DISCARD UT_SharedPtr< UT_SqlStatementImpl > createStatementImpl()
std::tuple< Args...> as(UT_ErrorCode *ec=nullptr)
bool operator!=(const iterator &rhs) const
virtual UT_SharedPtr< UT_SqlStatementImpl > findCachedStatement(const UT_SqlStatementHandleId &id) const =0
virtual void setAutoCommit(bool autocommit, UT_ErrorCode *ec=nullptr)=0
GLint GLint GLsizei GLint GLenum GLenum type
UT_SqlStatementImpl(const UT_SqlBaseDriver &driver)
UT_API const UT_ErrorCategory & GetSqlErrorCategory()
virtual void rollback(UT_ErrorCode &ec)=0
virtual const UT_StringHolder & blobTypeString() const =0
exint emplace_back(S &&...s)
std::tuple< Args...> fetchOne(UT_ErrorCode *ec=nullptr)
virtual void reset(bool clear_bindings=false)=0
UT_StringArray mySavePoints
bool bind(int idx, bool value)
virtual void setDatabaseName(const UT_StringHolder &db_name)
virtual const UT_StringHolder & boolTypeString() const =0
UT_SqlResult(UT_SqlStatement *stmt)
bool operator<(const UT_SqlStatementHandleId &id) const
std::shared_ptr< T > UT_SharedPtr
Wrapper around std::shared_ptr.
bool startTransaction(UT_ErrorCode *ec=nullptr)
NO_DISCARD bool indexExists(const UT_StringRef &name, UT_ErrorCode *ec=nullptr) const
NO_DISCARD void * nativeAPI() const
virtual NO_DISCARD bool tableExists(const UT_StringRef &name, UT_ErrorCode *ec=nullptr) const =0
Check if the specified table exists.
bool bind(int idx, double value)
virtual NO_DISCARD UT_StringHolder errorMessage() const =0
NO_DISCARD void * nativeAPI()
virtual const UT_StringHolder & nullTypeString() const =0
NO_DISCARD UT_StringHolder errorMessage() const
const UT_SqlBaseDriver & driver() const
NO_DISCARD double columnAsDouble(int idx) const
virtual NO_DISCARD double columnAsDouble(int idx) const =0
virtual NO_DISCARD UT_StringHolder getSchema(UT_ErrorCode *ec=nullptr) const =0
bool run(UT_ErrorCode *ec, const UT_StringRef &sql, Args &&...args)
Helper function to run an sql statement with provided typed args.
bool bindAll(Args &&...args)
const UT_ErrorCode & getError() const
#define UT_NON_COPYABLE(CLASS)
Define deleted copy constructor and assignment operator inside a class.
NO_DISCARD UT_SharedPtr< UT_SqlStatementImpl > createStatementImpl() const
UT_API const UT_ErrorCategory & GetSqliteErrorCategory()
virtual NO_DISCARD int columnAsInt(int idx) const =0
const iterator cbegin() const
UT_Array< std::tuple< Args...> > fetchAll(UT_ErrorCode *ec=nullptr)
virtual bool endTransaction(bool commit, UT_ErrorCode *ec=nullptr)=0
NO_DISCARD int columnBytes(int idx) const
const UT_SqlResult * operator->() const
NO_DISCARD bool isValid() const
virtual NO_DISCARD bool tableExists(const UT_StringRef &name, UT_ErrorCode *ec=nullptr) const =0
int SYSstrcmp(const char *a, const char *b)
NO_DISCARD int columnAsInt(int idx) const
virtual NO_DISCARD UT_SharedPtr< UT_SqlStatementImpl > createStatementImpl()=0
bool bind(int idx, const UT_IntArray &value)
GLuint const GLchar * name
UT_API bool UTsqlBind(UT_SqlStatement &stmt, int idx, const UT_ArrayStringSet &aset)
NO_DISCARD UT_DateTimeField columnAsDate(int idx) const
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.
bool bind(int idx, const void *value, int size)
const UT_StringHolder & intTypeString() const
void setConnectOptions(const UT_Options &options)
std::function< T > UT_Function
virtual const UT_StringHolder & intTypeString() const =0
virtual const UT_StringHolder & realTypeString() const =0
NO_DISCARD SYS_FORCE_INLINE bool isValid() const override
NO_DISCARD bool viewExists(const UT_StringRef &name, UT_ErrorCode *ec=nullptr) const
constexpr bool has_sql_bind_v
virtual NO_DISCARD bool isValid() const =0
virtual const UT_StringHolder & dateTimeTypeString() const =0
NO_DISCARD UT_StringHolder columnName(int idx) const
bool bind(int idx, const T &v)
UT_API UT_UniquePtr< UT_SqlBaseDriver > UTsqliteFactory()
virtual NO_DISCARD int errorCode() const =0
bool bind(int idx, int64 value)
const iterator end() const
virtual NO_DISCARD DataType columnType(int idx) const =0
UT_SqlResult * operator->()
GT_API const UT_StringHolder version
std::error_code UT_ErrorCode
NO_DISCARD bool isValid() const
Check the underlying connection is valid and usable.
bool close(UT_ErrorCode *ec=nullptr)
Close the sql connection to the db backend.
void reset(bool clear_bindings=false)
bool hasRow() overridefinal
virtual void setHostName(const UT_StringHolder &host)
A map of string to various well defined value types.
bool endTransaction(bool commit, UT_ErrorCode *ec=nullptr)
const UT_StringHolder & realTypeString() const
typename pvt::make_void< Ts...>::type void_t
void setPassword(const UT_StringRef &password)
bool bind(int idx, int value)
virtual NO_DISCARD UT_Int64Array columnAsInt64Array(int idx) const =0
bool connect(UT_ErrorCode *ec=nullptr)
Create a db connection with a custom db backend.
virtual NO_DISCARD const void * columnAsBlob(int idx, int &size) const =0
const UT_SqlBaseDriver & myDriver
virtual void setUserName(const UT_StringHolder &user)
NO_DISCARD void * nativeAPI() const override
NO_DISCARD int errorCode() const
virtual NO_DISCARD int columnBytes(int idx) const =0
bool bind(int idx, Blob blob)
NO_DISCARD void * nativeAPI() override
virtual UT_SharedPtr< UT_SqlStatementImpl > cachedStatement(const UT_SqlStatementHandleId &id, const UT_StringRef &sql, UT_ErrorCode *ec=nullptr) const =0
UT_SharedPtr< UT_SqlStatementImpl > cachedStatement(const UT_SqlStatementHandleId &id, const UT_StringRef &sql, UT_ErrorCode *ec=nullptr) const
UT_NON_COPYABLE(UT_SqlBaseDriver)
bool bind(int idx, const UT_StringRef &value)
SqlError
Error codes to describe errors as a result of UT_SQL.
NO_DISCARD UT_StringHolder getSchema(UT_ErrorCode *ec=nullptr) const
**If you just want to fire and args
virtual const UT_StringHolder & bigIntTypeString() const =0
virtual NO_DISCARD UT_StringHolder columnAsStr(int idx) const =0
std::tuple< Args...> fetchRow_(std::index_sequence< Idxs...>)
virtual void setConnectOptions(const UT_Options &options)
virtual bool bind(int idx, null_tag_t)=0
NO_DISCARD const void * columnAsBlob(int idx, int &size) const
UT_NON_COPYABLE(UT_SqlStatementImpl)
bool operator==(const iterator &rhs) const
virtual NO_DISCARD null_tag_t columnAsNull(int idx) const =0
NO_DISCARD bool columnExists(const UT_StringRef &table_name, const UT_StringRef &column_name, UT_ErrorCode *ec=nullptr) const
UT_Array< std::tuple< Args...> > fetchAll(UT_ErrorCode *ec=nullptr)
UT_SqlBaseDriver * driver()
UT_Function< bool()> commit_callback_t
bool isImplEqual(const UT_SqlStatement &rhs) const
NO_DISCARD int64 columnAsInt64(int idx) const
bool bindHelper(int idx, T value, Args &&...args)
void clear()
Resets list to an empty list.
NO_DISCARD DataType columnType(int idx) const
virtual bool startTransaction(UT_ErrorCode *ec=nullptr)=0
virtual const UT_StringHolder & stringTypeString() const =0
const UT_StringHolder & dateTimeTypeString() const
UT_SharedPtr< UT_SqlStatementImpl > cachedStatement(const UT_SqlStatementHandleId &id, UT_Function< UT_StringHolder()> &&creator, UT_ErrorCode *ec=nullptr) const
UT_UniquePtr< UT_SqlBaseDriver > myDriver
void setUserName(const UT_StringRef &user)
void setDatabaseName(const UT_StringRef &db_name)
std::optional< std::tuple< Args...> > fetchOne(UT_ErrorCode *ec=nullptr)
int exec(const UT_StringRef &sql, UT_ErrorCode *ec=nullptr) const
Returns the number of rows modified, inserted or deleted.
virtual NO_DISCARD bool columnAsBool(int idx) const =0
virtual int exec(const UT_StringRef &sql, UT_ErrorCode *ec=nullptr) const =0
Returns the number of rows modified, inserted or deleted.
bool bind(int idx, const UT_DateTimeField &dt)
UT_API bool UTsqlGet(const UT_SqlStatement &stmt, int idx, UT_SGuid &sguid)
bool getAutoCommit() const
PcpNodeRef_ChildrenIterator begin(const PcpNodeRef::child_const_range &r)
Support for range-based for loops for PcpNodeRef children ranges.