11 #if defined (SUPPORT_BRIEFCASE)
12 #include <Bentley/BeId.h>
15 #include <type_traits>
18 #include <Logging/bentleylogging.h>
124 #define BE_SQLITE_EXPORT IMPORT_ATTRIBUTE
126 #define TEMP_TABLE_Prefix "temp."
127 #define TEMP_TABLE(name) TEMP_TABLE_Prefix name
130 #define TEMP_TABLE_UniquePrefix TEMP_TABLE_Prefix "t_"
131 #define TEMP_TABLE_UNIQUE(name) TEMP_TABLE_UniquePrefix name
133 #define BEDB_TABLE_Local "be_Local"
134 #define BEDB_TABLE_Property "be_Prop"
135 #define BEDB_TABLE_EmbeddedFile "be_EmbedFile"
136 #define BEDB_MemoryDb ":memory:"
138 #define BEGIN_BENTLEY_SQLITE_NAMESPACE BEGIN_BENTLEY_NAMESPACE namespace BeSQLite {
139 #define END_BENTLEY_SQLITE_NAMESPACE } END_BENTLEY_NAMESPACE
140 #define USING_NAMESPACE_BENTLEY_SQLITE using namespace Bentley::BeSQLite;
154 #define UNUSED_VARIABLE(x) (void)(x)
156 #define BESQLITE_TYPEDEFS(_name_) BEGIN_BENTLEY_SQLITE_NAMESPACE DEFINE_POINTER_SUFFIX_TYPEDEFS(_name_) END_BENTLEY_SQLITE_NAMESPACE
164 #if !defined (DOCUMENTATION_GENERATOR)
170 unsigned short Data2;
171 unsigned short Data3;
172 unsigned char Data4[8];
176 typedef struct sqlite3_blob* SqlDbBlobP;
177 typedef struct sqlite3* SqlDbP;
178 typedef struct sqlite3& SqlDbR;
179 typedef struct sqlite3_stmt* SqlStatementP;
180 typedef struct sqlite3_session* SqlSessionP;
181 typedef struct sqlite3_changeset_iter* SqlChangesetIterP;
182 typedef struct Mem* SqlValueP;
184 #endif // DOCUMENTATION_GENERATOR
199 explicit BeGuid(
bool createValue=
false) {
if (createValue) Create();
else Invalidate();}
220 bool IsValid()
const {
return 0!=m_guid.u[0] && 0!=m_guid.u[1];}
258 bool IsValid()
const {
return Illegal() != m_id;}
266 #if defined (SUPPORT_BRIEFCASE)
272 struct BeBriefcaseBasedId : BeInt64Id
274 BEINT64_ID_DECLARE_MEMBERS(BeBriefcaseBasedId,BeInt64Id)
277 static
uint64_t const MaxLocal() {
return 1LL<<40;}
280 BeBriefcaseBasedId(BeBriefcaseId briefcaseId,
uint64_t id) {
BeAssert(
id<MaxLocal()); m_id = ((briefcaseId.GetValue() * MaxLocal()) +
id);}
282 BeBriefcaseId GetBriefcaseId()
const {
return BeBriefcaseId((
uint32_t) (m_id / MaxLocal()));}
297 #define BEBRIEFCASEBASED_ID_SUBCLASS(classname,superclass) struct classname : superclass { \
298 classname(BeSQLite::BeBriefcaseId briefcaseId, uint64_t id) : superclass(briefcaseId,id){} \
299 classname(BeSQLite::Db& db, Utf8CP tableName, Utf8CP columnName) : superclass(db,tableName,columnName){} \
300 BEINT64_ID_DECLARE_MEMBERS(classname,superclass) };
302 #define BEBRIEFCASEBASED_ID_CLASS(classname) BEBRIEFCASEBASED_ID_SUBCLASS(classname,BeSQLite::BeBriefcaseBasedId)
308 struct BeServerIssuedId : BeInt64Id
310 BEINT64_ID_DECLARE_MEMBERS(BeServerIssuedId,BeInt64Id)
313 #define BESERVER_ISSUED_ID_SUBCLASS(classname,superclass) struct classname : superclass {BEINT64_ID_DECLARE_MEMBERS(classname,superclass)};
314 #define BESERVER_ISSUED_ID_CLASS(classname) BESERVER_ISSUED_ID_SUBCLASS(classname,BeSQLite::BeServerIssuedId)
507 typedef void(*CollationUserDataFreeFunc)(
void*);
519 virtual void _Lower(
Utf16CP source,
int sourceLen,
Utf16CP result,
int resultLen) = 0;
523 virtual void _Upper(
Utf16CP source,
int sourceLen,
Utf16CP result,
int resultLen) = 0;
527 virtual void _InitCollation(bvector<CollationEntry>& collations, CollationUserDataFreeFunc& collatorFreeFunc) = 0;
531 virtual int _Collate(
Utf16CP lhs,
int lhsLen,
Utf16CP rhs,
int rhsLen,
void* collator) = 0;
555 static void* MallocMem(
int sz);
558 static void* ReallocMem(
void* p,
int sz);
561 static void FreeMem(
void* p);
589 SqlStatementP m_stmt;
606 bool IsPrepared()
const {
return nullptr != m_stmt;}
658 #if defined (SUPPORT_BRIEFCASE)
659 DbResult BindId(
int paramNum, BeInt64Id value) {
return value.IsValid() ? BindUInt64(paramNum,value.GetValue()) : BindNull(paramNum);}
741 bool IsColumnNull(
int col) {
return DbValueType::NullVal == GetColumnType(col);}
797 template <
class T_Id> T_Id
GetValueId(
int col) {
if (!IsColumnNull(col)) {
return T_Id(GetValueUInt64(col));}
return T_Id();}
830 operator SqlStatementP(){
return m_stmt;}
833 #define DIAGNOSTICS_PREPARE_LOGGER_NAME L"Diagnostics.BeSQLite.Prepare"
834 #define DIAGNOSTICS_QUERYPLAN_LOGGER_NAME L"Diagnostics.BeSQLite.QueryPlan"
835 #define DIAGNOSTICS_QUERYPLANWITHTABLESCANS_LOGGER_NAME L"Diagnostics.BeSQLite.QueryPlanWithTableScans"
838 #define STATEMENT_DIAGNOSTICS_ON
839 #define STATEMENT_DIAGNOSTICS_OFF
840 #define STATEMENT_DIAGNOSTICS_LOGCOMMENT(comment)
842 #define STATEMENT_DIAGNOSTICS_ON StatementDiagnostics::SetIsEnabled(true);
843 #define STATEMENT_DIAGNOSTICS_OFF StatementDiagnostics::SetIsEnabled(false);
844 #define STATEMENT_DIAGNOSTICS_LOGCOMMENT(comment) StatementDiagnostics::LogComment(comment)
953 bool IsValid()
const {
return nullptr != m_blob;}
968 bool IsValid()
const {
return nullptr != m_val;}
969 bool IsNull()
const {
return DbValueType::NullVal == GetValueType();}
982 template <
class T_Id> T_Id
GetValueId()
const {
return T_Id(GetValueUInt64());}
1016 BE_SQLITE_EXPORT void SetResultBlob(
void const* value,
int length, CopyData copy=CopyData::Yes);
1061 virtual void _ComputeScalar(
Context&,
int nArgs,
DbValue* args) = 0;
1077 virtual void _StepAggregate(Context&,
int nArgs,
DbValue* args) = 0;
1078 virtual void _FinishAggregate(Context&) = 0;
1111 void (*m_xDelUser)(
void*);
1127 virtual int _TestRange(
QueryInfo const&) = 0;
1148 virtual bool _IsInSet(
int nVals,
DbValue const* vals)
const = 0;
1151 #if defined (SUPPORT_BRIEFCASE)
1155 struct BeIdSet : bset<BeInt64Id>
1162 enum class StringFormat {Compact=0, Readable=1};
1172 template<
typename IdType>
struct IdSet : VirtualSet
1177 virtual bool _IsInSet(
int nVals, DbValue
const* vals)
const override
1180 return Contains(IdType(vals[0].GetValueUInt64()));
1183 IdSet() {static_assert(std::is_base_of<BeInt64Id, IdType>::value &&
sizeof(BeInt64Id) ==
sizeof(IdType),
"IdSet may only contain BeInt64Ids or subclasses of it of the same size.");}
1186 typedef IdSet<IdType> T_Self;
1187 typedef bset<IdType> T_SetType;
1188 typedef typename T_SetType::const_iterator const_iterator;
1189 typedef typename T_SetType::iterator iterator;
1191 const_iterator
begin()
const {
return ((T_SetType&)m_set).begin();}
1192 const_iterator
end()
const {
return ((T_SetType&)m_set).end();}
1193 const_iterator
find(IdType
id)
const {
return ((T_SetType&)m_set).find(
id);}
1194 bool operator==(T_Self
const& other)
const {
return m_set==other.m_set;}
1195 bool operator!=(T_Self
const& other)
const {
return m_set!=other.m_set;}
1196 bool empty()
const {
return m_set.empty();}
1197 void clear() {m_set.clear();}
1198 size_t size()
const {
return m_set.size();}
1200 void insert(const_iterator first, const_iterator last) {((T_SetType&)m_set).insert(first,last);}
1201 size_t erase(IdType
const& val) {
return ((T_SetType&)m_set).erase(val);}
1202 iterator
erase(iterator it) {
return ((T_SetType&)m_set).erase(it);}
1203 bool Contains(IdType
id)
const {
return end() !=
find(
id);}
1204 void FromString(
Utf8StringCR in) {m_set.FromString(in);}
1205 Utf8String ToString()
const {
return m_set.ToString();}
1207 BeIdSet
const& GetBeIdSet()
const {
return m_set;}
1294 typedef std::list<CachedStatementPtr> Entries;
1296 mutable Entries m_entries;
1298 Entries::iterator FindEntry(
Utf8CP)
const;
1342 bvector<SqlParameterPtr> m_params;
1430 bool IsValid()
const {
return m_isValid && (
nullptr!=m_sql->GetSqlStatementP());}
1460 #if defined (SUPPORT_EMBEDDED_FILE)
1472 struct DbEmbeddedFileTable
1477 DbEmbeddedFileTable(
DbR db) : m_db(db) {}
1479 BeBriefcaseBasedId GetNextEmbedFileId()
const;
1486 struct Iterator : DbTableIterator
1489 explicit Iterator(
DbCR db) : DbTableIterator(db) {}
1491 struct Entry : DbTableIterator::Entry, std::iterator<std::input_iterator_tag, Entry const>
1494 friend struct Iterator;
1495 Entry(
StatementP sql,
bool isValid) : DbTableIterator::Entry(sql,isValid) {}
1504 Entry
const&
operator* ()
const {
return *
this;}
1507 typedef Entry const_iterator;
1508 typedef const_iterator iterator;
1510 const_iterator
end()
const {
return Entry(
nullptr,
false);}
1514 Iterator MakeIterator()
const {
return Iterator(m_db);}
1592 Import(&stat, name, localFileName, typeStr, description,
nullptr, chunkSize, supportRandomAccess);
1678 No = (int) BeSQLiteTxnMode::None,
1680 Yes = (
int) BeSQLiteTxnMode::Deferred,
1683 Immediate = (int) BeSQLiteTxnMode::Immediate,
1688 Exclusive = (
int) BeSQLiteTxnMode::Exclusive
1707 #if !defined (DOCUMENTATION_GENERATOR)
1716 virtual void _OnDeactivate(
bool isCommit) {m_depth=-1;}
1815 Compress m_compress;
1829 PropertySpec(
Utf8CP name,
Utf8CP nameSpace,
Mode mode=Mode::Normal,
Compress compress=Compress::Yes,
bool saveIfNull=
false) : m_name(name), m_namespace(nameSpace), m_compress(compress), m_mode(mode), m_saveIfNull(saveIfNull){}
1855 virtual int _OnBusy(
int count)
const {
if (count>4)
return 0; BeThreadUtilities::BeSleep(1000);
return 1;}
1868 mutable bool m_dirty;
1872 explicit CachedBLV(
Utf8CP name);
1873 Utf8CP GetName()
const {
return m_name.c_str();}
1875 void ChangeValue(
uint64_t value,
bool initializing =
false);
1877 bool IsUnset()
const {
return m_isUnset;}
1878 bool IsDirty()
const {
BeAssert(!m_isUnset);
return m_dirty;}
1879 void SetIsNotDirty()
const;
1890 struct BriefcaseLocalValueCache : NonCopyableClass
1893 friend struct DbFile;
1897 mutable BeMutex m_mutex;
1900 bool TryQuery(CachedBLV*&,
size_t rlvIndex);
1903 BriefcaseLocalValueCache(DbFile& dbFile) : m_dbFile(dbFile) {}
1983 struct CachedProperyMap& GetCachedPropMap()
const;
1984 struct CachedPropertyValue& GetCachedProperty(PropertySpecCR spec,
uint64_t id,
uint64_t subId)
const;
1985 struct CachedPropertyValue* FindCachedProperty(PropertySpecCR spec,
uint64_t id,
uint64_t subId)
const;
1987 void DeleteCachedProperty(PropertySpecCR spec,
uint64_t id,
uint64_t subId);
1988 void DeleteCachedPropertyMap();
1989 void SaveCachedProperties(
bool isCommit);
1991 void SaveCachedBlvs(
bool isCommit);
2006 Utf8String ExplainQuery(
Utf8CP sql,
bool explainPlan,
bool suppressDiagnostics)
const;
2008 bool UseSettingsTable(PropertySpecCR spec)
const;
2028 PAGESIZE_512 = PAGESIZE_1K / 2,
2029 PAGESIZE_2K = PAGESIZE_1K * 2,
2030 PAGESIZE_4K = PAGESIZE_1K * 4,
2031 PAGESIZE_8K = PAGESIZE_1K * 8,
2032 PAGESIZE_16K = PAGESIZE_1K * 16,
2033 PAGESIZE_32K = PAGESIZE_1K * 32,
2034 PAGESIZE_64K = PAGESIZE_1K * 64
2093 enum CompressedDb {CompressDb_None=0,CompressDb_Zlib=1,CompressDb_Snappy=2,} m_compressedDb;
2108 DefaultTxn defaultTxn=DefaultTxn::Yes,
BusyRetry* retry=
nullptr,
bool createStandalone=
false)
2109 :
OpenParams(
OpenMode::Create, defaultTxn, retry), m_encoding(encoding), m_pagesize(pagesize), m_compressedDb(CompressDb_None),
2110 m_failIfDbExists(failIfDbExists), m_applicationId(APPLICATION_ID_BeSQLiteDb), m_createStandalone(createStandalone) {;}
2140 #if defined (SUPPORT_EMBEDDED_FILE)
2141 DbEmbeddedFileTable m_embeddedFiles;
2143 mutable bmap<AppData::Key const*, RefCountedPtr<AppData>, std::less<AppData::Key const*>, 8>
m_appData;
2214 friend struct BeSQLiteProfileManager;
2223 DbResult ClearBriefcaseLocalValues();
2335 {
return CreateNewDb(dbName.GetNameUtf8().c_str(), dbGuid, params);}
2435 DbResult SaveProperty(PropertySpecCR spec,
Utf8StringCR strData,
void const* value,
uint32_t propsize,
uint64_t majorId=0,
uint64_t subId=0) {
return m_dbFile->SaveProperty(spec, strData.c_str(), value, propsize, majorId, subId);}
2523 BriefcaseLocalValueCache&
GetBLVCache() {
return m_dbFile->GetBLVCache();}
2576 #if defined (SUPPORT_BRIEFCASE)
2588 #if defined (SUPPORT_EMBEDDED_FILE)
2600 BE_SQLITE_EXPORT void AddAppData(AppData::Key
const& key, AppData* appData)
const;
2723 uint16_t GetChunkSize() {
return m_data[0];}
2724 ~SnappyChunk() {BeSQLiteLib::FreeMem(m_data);}
2727 bvector<SnappyChunk*> m_chunks;
2784 static const uint32_t SNAPPY_UNCOMPRESSED_BUFFER_SIZE = (34*1024);
2799 Byte* m_uncompressed;
2800 Byte* m_uncompressCurr;
2823 Byte* m_uncompressed;
2824 Byte* m_uncompressCurr;
2843 #define SQLITE_FORMAT_SIGNATURE "SQLite format 3"
2844 #define DOWNLOAD_FORMAT_SIGNATURE "Download SQLite"
2845 #define SQLZLIB_FORMAT_SIGNATURE "ZV-zlib"
2846 #define SQLSNAPPY_FORMAT_SIGNATURE "ZV-snappy"
2848 #define BEDB_PROPSPEC_NAMESPACE "be_Db"
2849 #define BEDB_PROPSPEC_EMBEDBLOB_NAME "EmbdBlob"
DefaultTxn
Determines whether and how the default transaction should be started when a Db is created or opened...
Definition: BeSQLite.h:1674
The schemas found in the database are too old, and the DgnDb needs to be recreated after extensive da...
Definition: BeSQLite.h:437
AggregateFunction(Utf8CP name, int nArgs, DbValueType returnType=DbValueType::NullVal)
Initializes a new AggregateFunction instance.
Definition: BeSQLite.h:1084
Contains a UTF-8 encoded string.
Definition: WString.h:275
Definition: BeSQLite.h:416
bmap< AppData::Key const *, RefCountedPtr< AppData >, std::less< AppData::Key const * >, 8 > m_appData
Definition: BeSQLite.h:2143
bool operator<(BeGuid const &rhs) const
Compare two BeGuids.
Definition: BeSQLite.h:214
void SetCreateStandalone(bool val)
Set whether to create a standalone or master database.
Definition: BeSQLite.h:2125
void SetEncoding(Encoding encoding)
Set the text encoding for the newly created database.
Definition: BeSQLite.h:2115
iterator find(const key_type &__x)
Definition: stdcxx/bstdmap.h:269
bool empty() const
Definition: stdcxx/bstdmap.h:210
BeGuid(uint64_t u0, uint64_t u1)
Construct and initialize a BeGuid from two 64 bit values. Caller must ensure these values constitute ...
Definition: BeSQLite.h:202
A "value" from a BeSQLite function.
Definition: BeSQLite.h:960
Definition: BeSQLite.h:2703
The database disk image is malformed.
Definition: BeSQLite.h:376
~StatementCache()
Definition: BeSQLite.h:1304
Definition: BeSQLite.h:2706
virtual void _OnSaveSettings()
Definition: BeSQLite.h:2154
Definition: BeSQLite.h:336
StatementCache m_statements
Definition: BeSQLite.h:1974
DbResult SavePropertyString(PropertySpecCR spec, Utf8StringCR value, uint64_t majorId=0, uint64_t subId=0)
Save a Utf8String as a property value in this Db.
Definition: BeSQLite.h:2460
virtual void _OnRemoveFunction(DbFunction &func) const
Definition: BeSQLite.h:2210
#define END_BENTLEY_SQLITE_NAMESPACE
Definition: BeSQLite.h:139
Utility to compress and write data to a blob using "Snappy" compression.
Definition: BeSQLite.h:2716
DbResult BindText(int paramNum, Utf8StringCR stringValue, MakeCopy makeCopy)
Bind the value of a Utf8String to a parameter of this (previously prepared) Statement.
Definition: BeSQLite.h:676
static bool IsConstraintDbResult(DbResult val1)
Definition: BeSQLite.h:578
StatementCache(uint32_t size)
Definition: BeSQLite.h:1303
This is a copy of sqlite3_rtree_query_info.
Definition: BeSQLite.h:1105
CompressedDb
Definition: BeSQLite.h:2093
PageSize
Definition: BeSQLite.h:2025
uint64_t m_dataVersion
Definition: BeSQLite.h:1965
struct Bentley::BeFileName const & BeFileNameCR
Definition: Bentley.h:242
A wrapper for a SQLite Prepared Statement.
Definition: BeSQLite.h:586
attempt to commit with active changetrack
Definition: BeSQLite.h:431
DbFile * GetDbFile()
Definition: BeSQLite.h:2231
#define BEDB_PROPSPEC_EMBEDBLOB_NAME
Definition: BeSQLite.h:2849
the "user" version of SQLite databases created by this version of the BeSQLite library ...
Definition: BeSQLite.h:323
bool IsActive() const
Determine whether this Savepoint is active or not.
Definition: BeSQLite.h:1736
Data type mismatch.
Definition: BeSQLite.h:385
#define DEFINE_BENTLEY_NEW_DELETE_OPERATORS
Convenience to declare Bentley overrides of new and delete to allow the operations to be inlined in h...
Definition: BentleyAllocator.h:16
Definition: BeSQLite.h:337
Values that can be bound to named parameters of an SQL statement.
Definition: BeSQLite.h:1329
void SetExpirationDate(DateTime xdate)
Set expiration date for the newly created database.
Definition: BeSQLite.h:2123
Definition: BeSQLite.h:415
Upgrade of profile (aka application level BeSQLite schema) of file failed.
Definition: BeSQLite.h:426
DbValue(SqlValueP val)
Definition: BeSQLite.h:966
Construct a Utf8String by creating a formatted string.
Definition: WString.h:414
Definition: BeSQLite.h:2704
static PropSpec ProjectGuid()
Definition: BeSQLite.h:2870
Insertion failed because database is full or write operation failed because disk is full...
Definition: BeSQLite.h:378
Definition: BeSQLite.h:2782
Definition: BeSQLite.h:2696
NamedParams m_params
Definition: BeSQLite.h:1411
do not compress data
Definition: BeSQLite.h:324
BeGuid(bool createValue=false)
Construct a new BeGuid.
Definition: BeSQLite.h:199
static uint32_t GetUncompressedBufferSize()
Definition: BeSQLite.h:2789
Database is empty.
Definition: BeSQLite.h:381
The default file attribute.
OpenMode
Whether to open an BeSQLite::Db readonly or readwrite.
Definition: BeSQLite.h:2038
The schemas found in the database are too new, and the application needs to be upgraded.
Definition: BeSQLite.h:436
A string class that has many of the same capabilities as std::string, plus additional functions such ...
Definition: WString.h:30
Definition: BeSQLite.h:411
long long int64_t
Definition: Bentley.r.h:94
Callback routine requested an abort.
Definition: BeSQLite.h:369
Provides Bentley specific date/time functions (Bentley/BeAssert.h).
DbResult DeleteProperty(PropertySpecCR spec, uint64_t majorId=0, uint64_t subId=0)
Delete a property from the Db.
Definition: BeSQLite.h:2503
MutexType
Definition: BeSQLite.h:1236
A table in the database is locked.
Definition: BeSQLite.h:371
~BlobIO()
Definition: BeSQLite.h:907
Definition: BeSQLite.h:400
Together with the BeCriticalSection.h file provides Bentley specific thread handling functions (Bentl...
Provides Bentley specific set implementation (Bentley/bset.h).
bool IsReadonly() const
Determine whether the open mode is readonly or not.
Definition: BeSQLite.h:2074
Utf8CP GetName() const
Get the name of this function.
Definition: BeSQLite.h:1046
DbFunction(Utf8CP name, int nArgs, DbValueType returnType)
Initializes a new DbFunction instance.
Definition: BeSQLite.h:1041
void Verify() const
Definition: BeSQLite.h:1427
bvector< Savepoint * > DbTxns
Definition: BeSQLite.h:1957
bool IsValid() const
Test to see whether this BeGuid is non-zero.
Definition: BeSQLite.h:220
Definition: BeSQLite.h:461
Definition: BeSQLite.h:406
Definition: BeSQLite.h:463
Authorization denied.
Definition: BeSQLite.h:388
Attempt to write a readonly database.
Definition: BeSQLite.h:373
Successful result.
Definition: BeSQLite.h:365
DbTxns m_txns
Definition: BeSQLite.h:1975
bool m_settingsDirty
Definition: BeSQLite.h:1961
bool CheckImplicitTxn() const
Definition: BeSQLite.h:2010
Every BeSQLite::Db has a table for storing "Properties".
Definition: BeSQLite.h:1797
bool m_allowImplicitTxns
Definition: BeSQLite.h:1962
the database name is not a file.
Definition: BeSQLite.h:422
Definition: BeSQLite.h:404
wrong BeSQLite profile version
Definition: BeSQLite.h:424
unsigned int * m_nQueue
Definition: BeSQLite.h:1113
iterator begin()
Definition: stdcxx/bstdmap.h:178
Utility to read Snappy-compressed data from memory, typically from an image of a blob.
Definition: BeSQLite.h:2796
DbResult CreateNewDb(BeFileNameCR dbName, BeGuid dbGuid=BeGuid(), CreateParams const ¶ms=CreateParams())
Definition: BeSQLite.h:2334
SqlParameter(Utf8CP name)
Definition: BeSQLite.h:1335
Statement * GetStatement()
Get the prepared statement for this iterator. This can be used to bind parameters before calling /c b...
Definition: BeSQLite.h:1440
BeGuid m_dbGuid
Definition: BeSQLite.h:1971
SqlDbP GetSqlDb() const
Definition: BeSQLite.h:2011
bool _IsAggregate() override
Definition: BeSQLite.h:1076
DbResult DeleteProperties(PropertySpecCR spec, uint64_t *majorId)
Delete one or more properties from the Db.
Definition: BeSQLite.h:2509
attempt to open a BeSQLite::Db that is already in use somewhere.
Definition: BeSQLite.h:420
void SetRawSQLite()
Use the BeSQLite::Db api on a "raw" SQLite file.
Definition: BeSQLite.h:2068
DbResult Save(Utf8CP operation)
Commit this transaction and then restart it.
Definition: BeSQLite.h:1768
Utility to compress/decompress Db-s.
Definition: BeSQLite.h:2883
Error acquiring schema lock.
Definition: BeSQLite.h:439
Utf16Char const * Utf16CP
Definition: Bentley.h:231
virtual DbResult _OnBriefcaseIdChanged(BeBriefcaseId newBriefcaseId)
Definition: BeSQLite.h:2180
BeBriefcaseId()
Construct an invalid BeBriefcaseId.
Definition: BeSQLite.h:255
A property specification for the "be_Db" namespace.
Definition: BeSQLite.h:2855
Statement()
construct a new blank Statement.
Definition: BeSQLite.h:598
static uint32_t const Standalone()
Definition: BeSQLite.h:251
Abort due to constraint violation. See extended error values.
Definition: BeSQLite.h:384
static PropSpec ExpirationDate()
Definition: BeSQLite.h:2873
Definition: BeSQLite.h:412
PropertySpec(PropertySpec const &other, Mode mode)
Copy a PropertySpec, changing only the setting flag.
Definition: BeSQLite.h:1832
virtual DbResult _OnDbOpening()
override to perform additional processing when Db is opened
Definition: BeSQLite.h:2159
Definition: BeSQLite.h:451
double m_parentScore
Definition: BeSQLite.h:1118
DbFile * m_dbFile
Definition: BeSQLite.h:2138
Definition: BeSQLite.h:343
DbOpcode
Definition: BeSQLite.h:473
Definition: BeSQLite.h:2698
BeDbMutex & m_mutex
Definition: BeSQLite.h:1252
Definition: BeSQLite.h:342
void SetPageSize(PageSize pagesize)
Set the page size for the newly created database.
Definition: BeSQLite.h:2113
uint32_t GetValue() const
Get the briefcase id as a uint32_t.
Definition: BeSQLite.h:261
iterator end()
Definition: stdcxx/bstdmap.h:186
Library used incorrectly.
Definition: BeSQLite.h:386
double m_score
Definition: BeSQLite.h:1121
SqlDbP m_sqlDb
Definition: BeSQLite.h:1966
bool m_createStandalone
Definition: BeSQLite.h:2097
Definition: BeSQLite.h:408
Error reading schemas.
Definition: BeSQLite.h:434
bool operator!=(BeBriefcaseId const &rhs) const
Definition: BeSQLite.h:263
DefaultTxn m_startDefaultTxn
Definition: BeSQLite.h:2047
ZipErrors ReadAndFinish(Byte *data, uint32_t bufSize, uint32_t &bytesActuallyRead)
Definition: BeSQLite.h:2840
Compress
Determine whether a property's data may be compressed.
Definition: BeSQLite.h:1801
Applications subclass from this class to store in-memory data on a Db via AddAppData.
Definition: BeSQLite.h:2132
Profile (aka application level BeSQLite schema) of file could not be determined.
Definition: BeSQLite.h:425
virtual int _OnAddFunction(DbFunction &func) const
Definition: BeSQLite.h:2209
A user-defined function that can be added to a Db connection and then used in SQL.
Definition: BeSQLite.h:1006
Byte * GetChunkData(int i)
Definition: BeSQLite.h:2739
~BeDbMutexHolder()
Definition: BeSQLite.h:1254
size_type count(const key_type &__x) const
Definition: stdcxx/bstdmap.h:277
attempt to open a BeSQLite::Db that doesn't have a property table.
Definition: BeSQLite.h:421
The database schema changed.
Definition: BeSQLite.h:382
Describes a custom collator to register.
Definition: BeSQLite.h:511
CachedStatementPtr GetCachedStatement(Utf8CP sql) const
Definition: BeSQLite.h:2253
The specified position is relative to the beginning of the file.
RefCountedPtr< BusyRetry > BusyRetryPtr
Definition: BeSQLite.h:1956
struct Bentley::Utf8String const & Utf8StringCR
Definition: Bentley.h:241
Definition: BeSQLite.h:399
int int32_t
Definition: Bentley.r.h:92
RefCountedPtr< struct ChangeTracker > ChangeTrackerPtr
Definition: BeSQLite.h:1955
Encoding m_encoding
Definition: BeSQLite.h:2091
int64_t m_rowid
Definition: BeSQLite.h:1117
virtual DbResult _OnDbOpened()
override to perform additional processing when Db is opened
Definition: BeSQLite.h:2164
BusyRetry * m_busyRetry
Definition: BeSQLite.h:2050
MakeCopy
Definition: BeSQLite.h:594
use the fastest compression level (see Zlib documentation for explanation).
Definition: BeSQLite.h:325
Parameters for controlling aspects of the opening of a Db.
Definition: BeSQLite.h:2044
Definition: BeSQLite.h:2702
bool operator!=(Entry const &rhs) const
Definition: BeSQLite.h:1435
Class to turn on/off diagnostics for BeSQLite::Statement.
Definition: BeSQLite.h:878
Auxiliary database format error.
Definition: BeSQLite.h:389
Wraps sqlite3_mprintf. Adds convenience that destructor frees memory.
Definition: BeSQLite.h:1215
bool IsNull() const
return true if this value is null
Definition: BeSQLite.h:969
Savepoint m_defaultTxn
Definition: BeSQLite.h:1972
iterator erase(iterator __it)
Definition: stdcxx/bstdmap.h:242
Definition: BeSQLite.h:2707
~Statement()
Definition: BeSQLite.h:600
SqlStatementP GetSqlStatementP() const
Definition: BeSQLite.h:829
Represents an instant in time, typically expressed as a date and time of day.
Definition: DateTime.h:28
Mode
Definition: BeSQLite.h:1811
uint32_t m_id
Definition: BeSQLite.h:246
The database file is locked.
Definition: BeSQLite.h:370
Statement(SqlStatementP stmt)
Definition: BeSQLite.h:595
int m_nParam
Definition: BeSQLite.h:1108
void * m_context
Definition: BeSQLite.h:1107
PropSpec(Utf8CP name, PropertySpec::Compress compress=PropertySpec::Compress::Yes)
Definition: BeSQLite.h:2857
Unable to open the database file.
Definition: BeSQLite.h:379
Definition: BeSQLite.h:398
DbResult QueryProperty(Utf8StringR value, PropertySpecCR spec, uint64_t majorId=0, uint64_t subId=0) const
Query the value of the string part of a property from the Db.
Definition: BeSQLite.h:2496
Definition: BeSQLite.h:445
bstdmap & operator=(const bstdmap &__rhs)
Definition: stdcxx/bstdmap.h:170
Supply a BusyRetry handler to BeSQLite (see https://www.sqlite.org/c3ref/busy_handler.html).
Definition: BeSQLite.h:1849
A duplicated "value" from a BeSQLite function.
Definition: BeSQLite.h:993
Utf8String m_name
Definition: BeSQLite.h:1334
Definition: BeSQLite.h:409
static PropSpec BeSQLiteBuild()
Build version of BeSqlite (e.g. 06.10.00.00) used to create this database; useful for diagnostics...
Definition: BeSQLite.h:2876
virtual bool _IsAggregate()
Definition: BeSQLite.h:1044
Utf8Char * Utf8P
Definition: Bentley.h:228
LogErrors
Definition: BeSQLite.h:538
DbValue * m_args
Definition: BeSQLite.h:1122
DbResult BindBoolean(int paramNum, bool value)
Bind a Boolean value to a parameter of this (previously prepared) Statement.
Definition: BeSQLite.h:656
static uint32_t const Illegal()
Definition: BeSQLite.h:252
Utf8CP GetName() const
Definition: BeSQLite.h:1834
Definition: BeSQLite.h:2701
void SetOpenMode(OpenMode openMode)
set the open mode
Definition: BeSQLite.h:2077
BeGuid const & BeGuidCR
Definition: BeSQLite.h:158
void SetFailIfDbExist(bool val)
Determine whether the create should fail if a file exists with the specified name.
Definition: BeSQLite.h:2117
The "context" supplied to DbFunctions that can be used to set result values.
Definition: BeSQLite.h:1013
bool IsValid() const
return true if this value is valid
Definition: BeSQLite.h:968
DbResult SaveChanges(Utf8StringCR changesetName)
Definition: BeSQLite.h:2561
bool m_forSchemaUpgrade
Definition: BeSQLite.h:2048
int m_nCoord
Definition: BeSQLite.h:1114
Declares the NonCopyableClass.
DbP m_db
Definition: BeSQLite.h:1409
void * m_user
Definition: BeSQLite.h:1110
invalid version of the revision file is being imported
Definition: BeSQLite.h:432
attempt to create a new file when a file by that name already exists
Definition: BeSQLite.h:419
A reference-counted Statement. Statement is freed when last reference is Released.
Definition: BeSQLite.h:1261
RefCountedPtr< CachedStatement > CachedStatementPtr
Definition: BeSQLite.h:1281
virtual DbResult _OnDbCreated(CreateParams const ¶ms)
Called after a new Db had been created.
Definition: BeSQLite.h:2150
A 16-byte Globally Unique Id. A value of all zeros means "Invalid Id".
Definition: BeSQLite.h:192
DbResult QueryPropertySize(uint32_t &propsize, PropertySpecCR spec, uint64_t majorId=0, uint64_t subId=0) const
Determine the size in bytes of the blob part of a property in the Db.
Definition: BeSQLite.h:2476
BriefcaseLocalValueCache & GetBLVCache()
Get a reference to the BriefcaseLocalValueCache for this Db.
Definition: BeSQLite.h:2523
This is an interface class that allows applications to provide custom language processing for SQL cas...
Definition: BeSQLite.h:504
Definition: BeSQLite.h:454
Definition: BeSQLite.h:2695
bool IsRawSQLite() const
Determine whether the "raw sqlite" flag is on or not.
Definition: BeSQLite.h:2071
PageSize m_pagesize
Definition: BeSQLite.h:2092
The names of properties in the "be_Db" namespace.
Definition: BeSQLite.h:2866
T_Id GetValueId(int col)
Get a BeBriefcaseBasedId value from a column returned from Step.
Definition: BeSQLite.h:797
bool IsSetting() const
Determine whether this PropertySpec refers to a setting or not.
Definition: BeSQLite.h:1837
DbResult OpenBeSQLiteDb(BeFileNameCR dbName, OpenParams const &openParams)
Open an existing BeSQLite::Db file.
Definition: BeSQLite.h:2318
BlobIO()
Definition: BeSQLite.h:906
Definition: BeSQLite.h:443
Step() has finished executing.
Definition: BeSQLite.h:393
DbValueType
Definition: BeSQLite.h:483
StatementCache m_statements
Definition: BeSQLite.h:2139
struct Bentley::Utf8String * Utf8StringP
Definition: Bentley.h:241
Statement * StatementP
Definition: BeSQLite.h:161
Savepoint encapsulates SQLite transactions against a BeSQLite::Db.
Definition: BeSQLite.h:1705
Definition: BeSQLite.h:396
there is no transaction active and the database was opened with AllowImplicitTransactions=false ...
Definition: BeSQLite.h:423
BeGuid(uint32_t i0, uint32_t i1, uint32_t i2, uint32_t i3)
Construct and initialize a BeGuid from four 32 bit values. Caller must ensure these values constitute...
Definition: BeSQLite.h:205
DbResult Begin()
Begin a transaction against the database with the default transaction mode.
Definition: BeSQLite.h:1756
unsigned long long uint64_t
Definition: Bentley.r.h:95
A convenience class for acquiring and releasing a mutex lock. Lock is acquired on construction and re...
Definition: BeSQLite.h:1250
void DoSnappy(Byte const *data, uint32_t size)
Definition: BeSQLite.h:2758
Definition: BeSQLite.h:455
Definition: BeSQLite.h:2697
DbDupValue(DbDupValue &&other)
Definition: BeSQLite.h:996
Within m_within
Definition: BeSQLite.h:1120
BriefcaseLocalValueCache m_blvCache
Definition: BeSQLite.h:1970
The schemas can and must be imported.
Definition: BeSQLite.h:438
BentleyStatus
Definition: Bentley.h:208
A template that has many of the capabilities of std::pair.
Definition: bpair.h:73
Open for both read and write.
double * m_coords
Definition: BeSQLite.h:1112
virtual ~DbFunction()
Definition: BeSQLite.h:1045
SqlValueP m_val
Definition: BeSQLite.h:963
Definition: BeSQLite.h:2134
Definition: BeSQLite.h:496
int m_maxLevel
Definition: BeSQLite.h:1116
SqlDbBlobP GetBlobP()
Definition: BeSQLite.h:905
DbFile const & DbFileCR
Definition: BeSQLite.h:160
Definition: BeSQLite.h:413
StatementCache & GetStatementCache() const
Get the StatementCache for this Db.
Definition: BeSQLite.h:2242
A user-defined aggregate function.
Definition: BeSQLite.h:1074
void SetApplicationId(ApplicationId applicationId)
Set Application Id to be stored at offset 68 of the SQLite file.
Definition: BeSQLite.h:2121
uint32_t GetUnCompressedSize() const
Get the number of bytes in the raw (uncompressed) stream.
Definition: BeSQLite.h:2742
bool m_readonly
Definition: BeSQLite.h:1964
Some kind of disk I/O error occurred.
Definition: BeSQLite.h:375
NamedParams(Utf8CP where=nullptr)
ctor for NamedParams
Definition: BeSQLite.h:1374
Access permission denied.
Definition: BeSQLite.h:368
PropertySpec(Utf8CP name, Utf8CP nameSpace, Mode mode=Mode::Normal, Compress compress=Compress::Yes, bool saveIfNull=false)
Construct an instance of a PropertySpec with values for name and namespace.
Definition: BeSQLite.h:1829
A user-defined scalar function.
Definition: BeSQLite.h:1059
Definition: BeSQLite.h:341
A Blob handle for incremental I/O. See sqlite3_blob_open for details.
Definition: BeSQLite.h:899
Definition: BeSQLite.h:447
Definition: BeSQLite.h:339
void SetResultError(Utf8CP, int len=-1)
see sqlite3_result_error
Definition: BeSQLite.h:2705
void Invalidate()
Set this BeGuid to the invalid id value (all zeros).
Definition: BeSQLite.h:217
ChangeTrackerPtr m_tracker
Definition: BeSQLite.h:1968
T_Id GetValueId() const
Definition: BeSQLite.h:982
AString m_name
Name that query strings will use to use this collation.
Definition: BeSQLite.h:513
Encoding
Definition: BeSQLite.h:2024
virtual DbResult _VerifyProfileVersion(OpenParams const ¶ms)
Gets called when a Db is opened and checks whether the file can be opened, i.e whether the file versi...
Definition: BeSQLite.h:2207
CachedStatementPtr m_stmt
Definition: BeSQLite.h:1410
Defines typedefs and constants that can be used across other namespaces. All Bentley-authored C++ sou...
DbProfileValues
Definition: BeSQLite.h:334
void * m_cachedProps
Definition: BeSQLite.h:1969
#define BEGIN_BENTLEY_SQLITE_NAMESPACE
Definition: BeSQLite.h:138
A Bentley supplied implementation std::vector.
Definition: stdcxx/bvector.h:77
Base class to make a class non-copyable.
Definition: NonCopyableClass.h:23
Within
Definition: BeSQLite.h:1094
#define BE_SQLITE_EXPORT
Definition: BeSQLite.h:124
bool IsCompress() const
Determine whether this PropertySpec requests to compress or not.
Definition: BeSQLite.h:1840
A 4-digit number that specifies the version of the "profile" (schema) of a Db.
Definition: BeSQLite.h:351
the maximum compression level. Can be very slow but results in smallest size.
Definition: BeSQLite.h:327
static uint32_t const Master()
Definition: BeSQLite.h:250
BeBriefcaseId(uint32_t u)
Construct a BeBriefcaseId from a 32 bit value.
Definition: BeSQLite.h:256
Statement(DbCR db, Utf8CP sql)
Definition: BeSQLite.h:599
void Invalidate()
Set this BeBriefcaseId to the invalid id value.
Definition: BeSQLite.h:257
bool m_failIfDbExists
Definition: BeSQLite.h:2095
Definition: BeSQLite.h:465
CreateParams(PageSize pagesize=PageSize::PAGESIZE_4K, Encoding encoding=Encoding::Utf8, bool failIfDbExists=true, DefaultTxn defaultTxn=DefaultTxn::Yes, BusyRetry *retry=nullptr, bool createStandalone=false)
Definition: BeSQLite.h:2107
Defines a callback for providing information on the progress of a compress or decompress operation...
Definition: BeSQLite.h:1452
Savepoint * GetDefaultTransaction() const
Definition: BeSQLite.h:2640
Profile (aka application level BeSQLite schema) of file is too old. Therefore file cannot be opened...
Definition: BeSQLite.h:428
#define BEDB_PROPSPEC_NAMESPACE
Definition: BeSQLite.h:2848
virtual int _OnBusy(int count) const
Called when SQLite is blocked by another connection to a database.
Definition: BeSQLite.h:1855
Db const & DbCR
Definition: BeSQLite.h:159
bool IsValid() const
Definition: BeSQLite.h:1430
Holds a mutex to synchronize multi-thread access to data.
Definition: BeSQLite.h:1231
static uint32_t const MaxRepo()
Definition: BeSQLite.h:249
uint32_t AddRef() const
Definition: BeSQLite.h:1275
DbTableIterator(DbCR db)
Definition: BeSQLite.h:1413
bool m_isValid
Definition: BeSQLite.h:1424
Utf8CP GetSQL() const
Definition: BeSQLite.h:1278
bool operator==(BeGuid const &rhs) const
Compare two BeGuids for equality.
Definition: BeSQLite.h:208
A synchronization primitive that can be used to protect shared data from being simultaneously accesse...
Definition: BeThread.h:57
bool m_settingsTableCreated
Definition: BeSQLite.h:1960
String or BLOB exceeds size limit.
Definition: BeSQLite.h:383
static int GetBaseDbResult(DbResult val)
Definition: BeSQLite.h:576
static PropSpec DbGuid()
Definition: BeSQLite.h:2868
When enabled, this class maintains a list of "changed rows" (inserts, updates and deletes) for a BeSQ...
Definition: ChangeSet.h:80
DVec3d operator*(Transform const &transform, DVec3d const &vector)
operator overload for multiplication of a transform and a vector li>The vector appears on the left as...
BeDbMutexHolder(BeDbMutex &mutex)
Definition: BeSQLite.h:1253
uint32_t GetCurrChunk()
Definition: BeSQLite.h:2738
void SetInputError(Context &ctx)
Set the result of this function to: error due to illegal input.
Definition: BeSQLite.h:1051
bool operator!=(const BentleyAllocator< _Ty > &, const BentleyAllocator< _Other > &)
Definition: BentleyAllocator.h:152
OpenMode m_openMode
Definition: BeSQLite.h:2046
2nd parameter to Bind out of range
Definition: BeSQLite.h:390
DbValueType GetReturnType() const
Gets the return type of the function.
Definition: BeSQLite.h:1048
Definition: BeSQLite.h:2694
DbConstants
Definition: BeSQLite.h:321
int StatusInt
Definition: Bentley.h:222
Concrete class that can be used to implement the reference-counting pattern.
Definition: RefCounted.h:109
static PropSpec CreationDate()
Definition: BeSQLite.h:2872
StatementP m_sql
Definition: BeSQLite.h:1425
Utf8StringCR GetWhere() const
Get the Where clause for this NamedParam.
Definition: BeSQLite.h:1384
bool IsValid() const
Determine whether this BlobIO was successfully opened.
Definition: BeSQLite.h:953
A unique Id for a BeBriefcase (a particular copy of a BeSQLite::Db is referred to as a BeBriefcase...
Definition: BeSQLite.h:243
int m_level
Definition: BeSQLite.h:1115
void AddSqlParameter(SqlParameter *param)
Add a parameter value to this set of NamedParams.
Definition: BeSQLite.h:1348
uint64_t GetValueUInt64(int col)
Get a UInt64 value from a column returned from Step.
Definition: BeSQLite.h:781
Profile (aka application level schema) of file is too new for read-write access. Therefore file can o...
Definition: BeSQLite.h:429
unsigned short uint16_t
Definition: Bentley.r.h:91
BeBriefcaseId m_briefcaseId
Definition: BeSQLite.h:1973
Base class for an Iterator of a BeSQLite::Db table.
Definition: BeSQLite.h:1406
bool m_rawSQLite
Definition: BeSQLite.h:2049
Definition: BeSQLite.h:405
Definition: BeSQLite.h:2699
Utf8Char const * Utf8CP
Definition: Bentley.h:229
bool IsEmpty() const
Definition: BeSQLite.h:1309
void Invalidate()
Definition: BeSQLite.h:1431
bool operator!=(BeGuid const &rhs) const
Compare two BeGuids for inequality.
Definition: BeSQLite.h:211
Definition: BeSQLite.h:449
Definition: BeSQLite.h:402
bool IsValid() const
Test to see whether this BriefcaseId is valid.
Definition: BeSQLite.h:258
The name of the schema doesn't match the name of the domain.
Definition: BeSQLite.h:441
Definition: BeSQLite.h:338
Definition: BeSQLite.h:453
A 4-digit number that specifies version number.
Definition: BeVersion.h:25
Profile (aka application level SQLite schema) of file is too new. Therefore file cannot be opened...
Definition: BeSQLite.h:430
virtual ~Savepoint()
dtor for Savepoint. If the Savepoint is still active, it is committed.
Definition: BeSQLite.h:1733
DbResult BindUInt64(int paramNum, uint64_t value)
Bind a UInt64 value to a parameter of this (previously prepared) Statement.
Definition: BeSQLite.h:651
RTreeMatchFunction(Utf8CP name, int nArgs)
Definition: BeSQLite.h:1129
bool operator==(Entry const &rhs) const
Definition: BeSQLite.h:1436
ProfileVersion(Utf8CP json)
Definition: BeSQLite.h:355
ProfileVersion(uint16_t major, uint16_t minor, uint16_t sub1, uint16_t sub2)
Definition: BeSQLite.h:354
File opened that is not a database file.
Definition: BeSQLite.h:391
bool m_inCommit
Definition: BeSQLite.h:1963
Definition: BeSQLite.h:462
Definition: BeSQLite.h:403
void clear()
Definition: stdcxx/bstdmap.h:257
CopyData
Definition: BeSQLite.h:1015
#define BeAssert(_Expression)
BeAssert performs the same function as the standard assert, plus it prevents the most common cases of...
Definition: BeAssert.h:56
NamedParams & Params()
Get a reference to the NamedParams for this iterator.
Definition: BeSQLite.h:1444
SQL error or missing database.
Definition: BeSQLite.h:366
ScalarFunction(Utf8CP name, int nArgs, DbValueType returnType=DbValueType::NullVal)
Initializes a new ScalarFunction instance.
Definition: BeSQLite.h:1067
A BeSQLite database file.
Definition: BeSQLite.h:2020
uint64_t GetValueUInt64() const
Definition: BeSQLite.h:979
Utf8CP GetName() const
Get the name of this Savepoint.
Definition: BeSQLite.h:1742
DbTableIterator(DbTableIterator &&rhs)
Move ctor. DbTableIterator are not copyable, but they are movable.
Definition: BeSQLite.h:1416
unsigned char Byte
Definition: Bentley.r.h:143
#define BESQLITE_TYPEDEFS(_name_)
Definition: BeSQLite.h:156
DbResult SaveProperty(PropertySpecCR spec, void const *value, uint32_t propsize, uint64_t majorId=0, uint64_t subId=0)
Save a property value in this Db.
Definition: BeSQLite.h:2444
Definition: BeSQLite.h:467
void SetCompressMode(CompressedDb val)
Set the compression mode for the new Db. Default is CompressDb_None.
Definition: BeSQLite.h:2119
Entry & operator++()
Definition: BeSQLite.h:1433
Definition: BeSQLite.h:1332
This interface should be implemented to supply the first argument to the BeSQLite function "InVirtual...
Definition: BeSQLite.h:1140
Error importing schemas.
Definition: BeSQLite.h:440
unsigned int uint32_t
Definition: Bentley.r.h:93
bool HasProperty(PropertySpecCR spec, uint64_t majorId=0, uint64_t subId=0) const
Determine whether a property exists in the Db.
Definition: BeSQLite.h:2467
Operation terminated by interrupt.
Definition: BeSQLite.h:374
Provides Bentley implemented file management functions (Bentley/BeFile.h).
A cache of SharedStatements that can be reused without re-Preparing.
Definition: BeSQLite.h:1290
Utility to read Snappy-compressed data from a blob in a database.
Definition: BeSQLite.h:2820
Definition: BeSQLite.h:410
double * m_param
Definition: BeSQLite.h:1109
bool IsMasterId() const
Determine whether this is the id of the master briefcase (special id==0).
Definition: BeSQLite.h:259
#define EXPORT_VTABLE_ATTRIBUTE
Definition: Bentley.h:67
A malloc() failed.
Definition: BeSQLite.h:372
int GetNumArgs() const
Get the number of arguments to this function.
Definition: BeSQLite.h:1047
bool IsTransactionActive() const
Determine whether there is an active transaction against this Db.
Definition: BeSQLite.h:2264
static PropSpec EmbeddedFileBlob()
Definition: BeSQLite.h:2871
BeSQLiteTxnMode
SQLite Transaction modes corresponding to https://www.sqlite.org/lang_transaction.html.
Definition: BeSQLite.h:1671
void OnSettingsDirtied()
Definition: BeSQLite.h:2009
Upgrade of profile (aka application level SQLite schema) of file failed because the file could not be...
Definition: BeSQLite.h:427
Definition: BeSQLite.h:466
bool operator==(BeBriefcaseId const &rhs) const
Definition: BeSQLite.h:262
DbResult SavePropertyString(PropertySpecCR spec, Utf8CP value, uint64_t majorId=0, uint64_t subId=0)
Save a (Utf8) text string as a property value in this Db.
Definition: BeSQLite.h:2452
use the default compression level. This is pretty good tradeoff for size vs. speed.
Definition: BeSQLite.h:326
bool IsColumnNull(int col)
Determine whether the column value is NULL.
Definition: BeSQLite.h:741
Definition: BeSQLite.h:397
BeSQLiteTxnMode GetTxnMode() const
Get the default transaction mode for this SavePoint.
Definition: BeSQLite.h:1745
Parameters for controlling aspects of creating and then opening a Db.
Definition: BeSQLite.h:2089
uint32_t GetRefCount() const
Definition: BeSQLite.h:1276
DateTime m_expirationDate
Definition: BeSQLite.h:2096
Database lock protocol error.
Definition: BeSQLite.h:380
size_type size() const
Definition: stdcxx/bstdmap.h:214
bool GetValueBoolean(int col)
Get a Boolean value from a column returned from Step.
Definition: BeSQLite.h:788
Definition: BeSQLite.h:2700
static PropSpec ProfileVersion()
Definition: BeSQLite.h:2869
The schema was not found in the database.
Definition: BeSQLite.h:435
Write little-endian UTF-16 encoded output file.
DbResult QueryProperty(void *value, uint32_t propsize, PropertySpecCR spec, uint64_t majorId=0, uint64_t subId=0) const
Query the value of the blob part a property from the Db.
Definition: BeSQLite.h:2487
Definition: BeSQLite.h:414
bpair< iterator, bool > insert(const value_type &__x)
Definition: stdcxx/bstdmap.h:228
union Bentley::BeSQLite::BeGuid::@4 m_guid
void * m_collator
User data object provided in the collation callback.
Definition: BeSQLite.h:514
Definition: BeSQLite.h:417
A user-defined implementation of the SQLite sqlite3_rtree_query_callback function for using the MATCH...
Definition: BeSQLite.h:1092
void SetTxnMode(BeSQLiteTxnMode mode)
Sets the default transaction mode for this Savepoint.
Definition: BeSQLite.h:1748
Definition: BeSQLite.h:407
Definition: BeSQLite.h:395
virtual void _OnDbClose()
override to perform processing when Db is closed
Definition: BeSQLite.h:2168
Definition: BeSQLite.h:457
bool IsCached() const
Determine whether this PropertySpec is cached or not.
Definition: BeSQLite.h:1838
Definition: BeSQLite.h:459
NOT USED. Table or record not found.
Definition: BeSQLite.h:377
BusyRetryPtr m_retry
Definition: BeSQLite.h:1967
PropertySpec const & PropertySpecCR
Definition: BeSQLite.h:1843
uint64_t u[2]
Definition: BeSQLite.h:194
Definition: BeSQLite.h:464
SqlStatementP & GetStmtR()
Definition: BeSQLite.h:602
ZipErrors
Error values returned from the ZLib functions. See ZLib documentation for details.
Definition: BeSQLite.h:2692
int32_t GetDepth() const
Get the savepoint depth for this Savepoint. This will always be a number >= 0 if the savepoint is act...
Definition: BeSQLite.h:1739
Uses OS features not supported on host.
Definition: BeSQLite.h:387
A physical Db file.
Definition: BeSQLite.h:1948
virtual ~SnappyReader()
Definition: BeSQLite.h:2786
Definition: BeSQLite.h:1421
Definition: BeSQLite.h:344
BeBriefcaseId GetNextBriefcaseId() const
Definition: BeSQLite.h:254
SqlValueP GetSqlValueP() const
for direct use of sqlite3 api
Definition: BeSQLite.h:970
unsigned char uint8_t
Definition: Bentley.r.h:89
Definition: BeSQLite.h:448
Step() has another row ready.
Definition: BeSQLite.h:392
Entry(StatementP sql, bool isValid)
Definition: BeSQLite.h:1426
ApplicationId
Definition: BeSQLite.h:2094
bool IsStandaloneId() const
Determine whether this is the id of a standalone briefcase not associated with any master briefcase (...
Definition: BeSQLite.h:260
Within m_parentWithin
Definition: BeSQLite.h:1119
Utf8CP GetUtf8CP()
Definition: BeSQLite.h:1224
bool SaveIfNull() const
Determine whether this PropertySpec saves NULL values or not.
Definition: BeSQLite.h:1839
Definition: BeSQLite.h:460
Definition: BeSQLite.h:401
Internal logic error.
Definition: BeSQLite.h:367
static bool TestBaseDbResult(DbResult val1, DbResult val2)
Definition: BeSQLite.h:577
bool operator==(const BentleyAllocator< _Ty > &, const BentleyAllocator< _Other > &)
Definition: BentleyAllocator.h:146
DbTxns::iterator DbTxnIter
Definition: BeSQLite.h:1958
void SetStartDefaultTxn(DefaultTxn val)
Determine whether the default transaction should be started on the Db.
Definition: BeSQLite.h:2082
DbResult
Definition: BeSQLite.h:363
Utf8CP GetNamespace() const
Definition: BeSQLite.h:1835