Have an amazing solution built in RAD Studio? Let us know. Looking for discounts? Visit our Special Offers page!

.NET Apps and Interbase Change Views – How to track data changes automatically

trackingchangesblog 7194421

This is a bonus post from the series about the integrating Interbase with .NET apps, and today we’ll talk about the incredible Interbase feature called Change Views™.

Just in case this is your first visit here, I have a recap for you in the chronological order the previous posts were published:

  1. Introducing InterBase for .NET – A Super-Secure Embedded Data Warehouse For .NET Users
  2. Getting Started With InterBase For .NET – Install, Configure And Secure Your Data in Minutes
  3. Your first .NET/Interbase App – How to connect .NET and the Interbase secure data store
  4. .NET Apps using Embedded Interbase Database – How to deploy a secure database app with zero installation/administration

Interbase Change Views™

This is the official Change Views definition:

The Change Views feature uses InterBase multigenerational architecture to capture changes to data. This feature allows you to quickly answer the question, “What data has changed since I last viewed it?”

Previously it involved triggers, logging, and/or transaction write-ahead log scraping. This was time-consuming for the developer and affected the database performance for a certain transaction load or change volume. Now with Change Views, there is no performance overhead on existing transactions because it maintains a consistent view of changed data observable by other transactions.

The Change Views mechanism is not dependent on its own underlying data, but is based on data already stored for existing base tables or views derived from base tables. This implicit view mechanism is temporal based and returns data that have changed since the prior transaction in which the implicit view was observed.

Sounds complicated? Not at all! Let’s review the main Change Views concepts:

  • What Change Views are?

    • Change Views are a new “subscription based” model allowing you to “subscribe” to data; once subscribed you are able to ask the database at a later time, spanning connections, for what has changed. This is an especially cool, low cost way to reduce network traffic, mobile data costs and development time when tasked with keeping multiple remote database caches up to date. (especially if you have large tables to keep updated). Change Views are simple to use and reduce the upfront planning needed for building in data tracking that history has shown to be inherently complex and error prone. Best of all change views has zero impact on database performance regardless of the number of subscribers.
  • Subscription & Subscribers

    • A core concept to change views is that of Subscriptions and Subscribers. InterBase Change view allows multiple subscribers to a subscription. A subscription is defined once and then can be connected to by multiple users. Once defined, you can control who can subscribe thanks to the InterBase inbuilt user security. Subscriptions work at field level and can be defined to track either an entire table or multiple tables. Subscriptions can also be defined to track Inserts, Updates or Deletes.
  • Multiple devices per subscriber

    • In addition to allowing specific users to subscribe to data, you can use a single user to have multiple destinations that are subscribing. This allows a user to subscribe for different devices such as their Phone, Tablet, Laptop or for a single user to be used programmatically to distinguish multiple sites – e.g. Office 1, Office 2 etc.
    • This is done using the “at” verb when connecting to the subscription.
  • What Change Views are NOT!

    • Change Views are not an auditing system. While you can track deleted records, Change View are about identifying what has changed without keeping every value that it has been. If you want to do that, then continue to use Triggers and logging tables for the values you need to audit.

Intro to Interbase Change Views

This video presents the Change Views concepts using a very didact demo that is available for you in the IB.NET DataProvider GitHub repository: https://github.com/Embarcadero/IB.NETDataProvider.

Additionally, for more technical details and other possibilities, I invite you to visit the product documentation located here: https://docwiki.embarcadero.com/InterBase/2020/en/Change_Views


Reduce development time and get to market faster with RAD Studio, Delphi, or C++Builder.
Design. Code. Compile. Deploy.
Start Free Trial   Upgrade Today

   Free Delphi Community Edition   Free C++Builder Community Edition

About author

Lead Software Consultant, LatAm

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.