27 virtual int _GetSize()
const = 0;
28 virtual void const* _GetData()
const = 0;
31 int GetSize()
const {
return _GetSize(); }
34 void const*
GetData()
const {
return _GetData(); }
45 int _GetSize()
const override {
return IsEmpty() ? 0 : (int) m_ddl.
SizeInBytes(); }
46 void const* _GetData()
const override {
return m_ddl.c_str(); }
56 bool IsEmpty()
const {
return m_ddl.empty(); }
99 virtual OnCommitStatus _OnCommit(
bool isCommit,
Utf8CP operation) = 0;
150 void Restart() {EndTracking(); EnableTracking(
true);}
164 void* m_data =
nullptr;
165 mutable SqlChangesetIterP m_iter = 0;
167 void Finalize()
const;
181 Changes(Changes
const& other) : m_data(other.m_data), m_size(other.m_size), m_changeStream(other.m_changeStream), m_iter(0) {}
186 struct Change : std::iterator<std::input_iterator_tag, Change const>
190 SqlChangesetIterP m_iter;
193 Change(SqlChangesetIterP iter,
bool isValid) {m_iter=iter; m_isValid=isValid;}
218 enum class Stage : bool {Old=0, New=1};
219 DbValue GetValue(
int colNum,
Stage stage)
const {
return (stage==Stage::Old) ? GetOldValue(colNum) : GetNewValue(colNum);}
227 bool operator!=(
Change const& rhs)
const {
return (m_iter != rhs.m_iter) || (m_isValid != rhs.m_isValid);}
228 bool operator==(
Change const& rhs)
const {
return (m_iter == rhs.m_iter) && (m_isValid == rhs.m_isValid);}
231 BE_SQLITE_EXPORT void Dump(
Db const&,
bool isPatchSet, bset<Utf8String>& tablesSeen,
int detailLevel)
const;
233 void Dump(
Db const& db,
bool isPatchSet,
int detailLevel)
const {bset<Utf8String> tablesSeen;
Dump(db, isPatchSet, tablesSeen, detailLevel);}
284 virtual ConflictResolution _OnConflict(ConflictCause clause,
Changes::Change iter) = 0;
288 virtual Changes _GetChanges() = 0;
340 int _GetSize()
const override {
return m_size; }
341 void const* _GetData()
const override {
return m_changeset; }
387 return ChangeSet::ConflictResolution::Abort;
401 static int OutputCallback(
void *pOut,
const void *pData,
int nData);
402 static int InputCallback(
void *pIn,
void *pData,
int *pnData);
403 static int ConflictCallback(
void *pCtx,
int cause, SqlChangesetIterP iter);
404 static int FilterTableCallback(
void *pCtx,
Utf8CP tableName);
408 void Reset() { _Reset(); }
Contains a UTF-8 encoded string.
Definition: WString.h:275
Definition: ChangeSet.h:24
virtual ApplyChangesForTable _FilterTable(Utf8CP tableName)
Definition: ChangeSet.h:283
A "value" from a BeSQLite function.
Definition: BeSQLite.h:960
ConflictResolution
Definition: ChangeSet.h:279
Changes(Changes const &other)
Copy constructor.
Definition: ChangeSet.h:181
SchemaChangeSet(Utf8CP ddl=nullptr)
Create a new schema change set.
Definition: ChangeSet.h:50
ApplyChangesForTable
Definition: ChangeSet.h:277
#define END_BENTLEY_SQLITE_NAMESPACE
Definition: BeSQLite.h:139
virtual Changes _GetChanges() override
Definition: ChangeSet.h:347
struct Bentley::BeFileName const & BeFileNameCR
Definition: Bentley.h:242
Stage
Definition: ChangeSet.h:218
Changes(ChangeStream &changeStream)
Construct an iterator for a ChangeStream.
Definition: ChangeSet.h:175
bool IsEmpty() const
Returns true if the schema change set is empty.
Definition: ChangeSet.h:56
Mode
All changes are marked as either direct or indirect according to the mode in which the ChangeTracker ...
Definition: ChangeSet.h:127
ChangeSet()
construct a blank, empty ChangeSet
Definition: ChangeSet.h:350
Successful result.
Definition: BeSQLite.h:365
OnCommitStatus
Definition: ChangeSet.h:95
DbResult ApplyChanges(DbR db)
Apply all of the changes in this IChangeSet to the supplied database.
Definition: ChangeSet.h:315
Utf8CP GetName() const
Definition: ChangeSet.h:102
iterator begin()
Definition: stdcxx/bstdmap.h:178
A base class for a streaming version of the ChangeSet.
Definition: ChangeSet.h:397
bool operator!=(Change const &rhs) const
Definition: ChangeSet.h:227
ApplyChangesForTable FilterTable(Utf8CP tableName)
Implement to handle conflicts when applying changes.
Definition: ChangeSet.h:292
Utf8StringCR ToString() const
Return the contents of the schema change set.
Definition: ChangeSet.h:62
DbOpcode
Definition: BeSQLite.h:473
ConflictCause
Definition: ChangeSet.h:278
Change(SqlChangesetIterP iter, bool isValid)
Definition: ChangeSet.h:193
SchemaChangeSet const & SchemaChangeSetCR
Definition: ChangeSet.h:17
struct Bentley::Utf8String const & Utf8StringCR
Definition: Bentley.h:241
bool IsValid() const
Definition: ChangeSet.h:224
bool IsValid()
Determine whether this ChangeSet holds valid data or not.
Definition: ChangeSet.h:369
#define NULL
Definition: Bentley.h:157
void Restart()
Clear the contents of this ChangeTracker and re-start it.
Definition: ChangeSet.h:150
void Clear()
Clear the schema change set.
Definition: ChangeSet.h:59
A single change to a database row.
Definition: ChangeSet.h:186
virtual Changes _GetChanges() override
Definition: ChangeSet.h:415
Change const_iterator
Definition: ChangeSet.h:244
Changes(void *data, int size)
Construct an iterator for a page of changes in a ChangeStream.
Definition: ChangeSet.h:178
virtual ~IChangeSet()
Definition: ChangeSet.h:281
virtual DbResult _OutputPage(const void *pData, int nData)
Application implements this to receive data from the system.
Definition: ChangeSet.h:428
ChangeGroup const & ChangeGroupCR
Definition: ChangeSet.h:13
size_type SizeInBytes() const
Computes the size, in bytes, of this string's data, including its NULL-terminator.
Definition: WString.h:297
virtual TrackChangesForTable _FilterTable(Utf8CP tableName)
Definition: ChangeSet.h:109
DbResult FromChangeGroup(ChangeGroupCR changeGroup)
Create a ChangeSet/ChangeStream by merging the contents of a ChangeGroup.
Definition: ChangeSet.h:309
void Dump(Db const &db, bool isPatchSet, int detailLevel) const
Definition: ChangeSet.h:233
ConflictResolution OnConflict(ConflictCause cause, Changes::Change iter)
Implement to filter out specific tables when applying changes.
Definition: ChangeSet.h:296
ChangeTracker(Utf8CP name=0)
Definition: ChangeSet.h:107
virtual ~ChangeTracker()
Definition: ChangeSet.h:108
A set of changes to database rows.
Definition: ChangeSet.h:334
bool IsTracking() const
Definition: ChangeSet.h:151
SqlSessionP GetSqlSession()
Definition: ChangeSet.h:110
#define BEGIN_BENTLEY_SQLITE_NAMESPACE
Definition: BeSQLite.h:138
Base class to make a class non-copyable.
Definition: NonCopyableClass.h:23
#define BE_SQLITE_EXPORT
Definition: BeSQLite.h:124
Db const & DbCR
Definition: BeSQLite.h:159
bool HasSchemaChanges() const
Determine whether any schema changes have beeen tracked by this ChangeTracker.
Definition: ChangeSet.h:147
Utf8String m_name
Definition: ChangeSet.h:93
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...
Concrete class that can be used to implement the reference-counting pattern.
Definition: RefCounted.h:109
!! N.B.
Definition: mscons.h:421
Definition: ChangeSet.h:273
Utf8Char const * Utf8CP
Definition: Bentley.h:229
SetType
Definition: ChangeSet.h:276
bool m_isTracking
Definition: ChangeSet.h:90
Db * m_db
Definition: ChangeSet.h:91
bool operator==(Change const &rhs) const
Definition: ChangeSet.h:228
Db * GetDb()
Definition: ChangeSet.h:101
#define BeAssert(_Expression)
BeAssert performs the same function as the standard assert, plus it prevents the most common cases of...
Definition: BeAssert.h:56
A BeSQLite database file.
Definition: BeSQLite.h:2020
unsigned char Byte
Definition: Bentley.r.h:143
#define BESQLITE_TYPEDEFS(_name_)
Definition: BeSQLite.h:156
Definition: ChangeSet.h:40
ConflictResolution _OnConflict(ConflictCause cause, BeSQLite::Changes::Change iter) override
Definition: ChangeSet.h:384
virtual DbResult _InputPage(void *pData, int *pnData)
Application implements this to supply input to the system.
Definition: ChangeSet.h:422
Change end() const
Get the last entry in the ChangeSet.
Definition: ChangeSet.h:250
DbValue GetValue(int colNum, Stage stage) const
Definition: ChangeSet.h:219
TrackChangesForTable
Definition: ChangeSet.h:96
An Iterator for a ChangeSet or a ChangeStream.
Definition: ChangeSet.h:159
SqlSessionP m_session
Definition: ChangeSet.h:92
DbResult FromChangeTrack(ChangeTracker &tracker, SetType setType=SetType::Full)
Create a ChangeSet/ChangeStream from a ChangeTracker.
Definition: ChangeSet.h:303
size_type size() const
Definition: stdcxx/bstdmap.h:214
A ChangeSet implementation for where conflicts are just not expected.
Definition: ChangeSet.h:382
virtual void _Reset()
Override to reset any state of the change stream.
Definition: ChangeSet.h:433
int GetSize() const
Get the number of bytes.
Definition: ChangeSet.h:31
Definition: ChangeSet.h:257
ChangeStream()
Constructor.
Definition: ChangeSet.h:437
void SetDb(Db *db)
Definition: ChangeSet.h:100
A physical Db file.
Definition: BeSQLite.h:1948
void const * GetData() const
Get a pointer to the data.
Definition: ChangeSet.h:34
SchemaChangeSetCR GetSchemaChanges() const
Definition: ChangeSet.h:104
~ChangeSet()
Definition: ChangeSet.h:351
Changes GetChanges()
Returns a Changes object for iterating over the changes contained within this IChangeSet.
Definition: ChangeSet.h:319
DbResult
Definition: BeSQLite.h:363