Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions geodiff/src/changesetutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,14 @@ nlohmann::json changesetEntryToJSON( const ChangesetEntry &entry )
else if ( entry.op == ChangesetEntry::OpDelete )
status = "delete";

// Check that the table column count matches the vector sizes to prevent
// out-of-bounds errors.
if ( ( ( entry.op == ChangesetEntry::OpUpdate || entry.op == ChangesetEntry::OpInsert )
&& entry.table->columnCount() != entry.newValues.size() )
|| ( ( entry.op == ChangesetEntry::OpUpdate || entry.op == ChangesetEntry::OpDelete )
&& entry.table->columnCount() != entry.oldValues.size() ) )
throw GeoDiffException( "Table column count doesn't match value list size" );

nlohmann::json res;
res[ "table" ] = entry.table->name;
res[ "type" ] = status;
Expand Down
9 changes: 0 additions & 9 deletions geodiff/src/driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,15 +126,6 @@ class Driver
*/
virtual void dumpData( ChangesetWriter &writer, bool useModified = false ) = 0;

/**
* Tests whether the table schemas are compatible with our rebase algorithm, i.e. no unsupported
* database features are used. Currently, for example, geodiff rebase does not deal with foreign
* keys or with user-defined triggers.
*
* If the check fails, GeoDiffException is thrown.
*/
virtual void checkCompatibleForRebase( bool useModified = false ) = 0;

static const std::string SQLITEDRIVERNAME;
static const std::string POSTGRESDRIVERNAME;

Expand Down
5 changes: 0 additions & 5 deletions geodiff/src/drivers/postgresdriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1046,8 +1046,3 @@ void PostgresDriver::dumpData( ChangesetWriter &writer, bool useModified )
}
}
}

void PostgresDriver::checkCompatibleForRebase( bool )
{
throw GeoDiffException( "Rebase with postgres not supported yet" );
}
1 change: 0 additions & 1 deletion geodiff/src/drivers/postgresdriver.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ class PostgresDriver : public Driver
void applyChangeset( ChangesetReader &reader ) override;
void createTables( const std::vector<TableSchema> &tables ) override;
void dumpData( ChangesetWriter &writer, bool useModified = false ) override;
void checkCompatibleForRebase( bool useModified = false ) override;

private:
void logApplyConflict( const std::string &type, const ChangesetEntry &entry ) const;
Expand Down
Loading
Loading