Note that there are some explanatory texts on larger screens.

plurals
  1. POTClientDataSet: How to keep local data save and available when a database structure has been changed
    primarykey
    data
    text
    <p>Hello code enthusiasts!</p> <p>I have a question, which is no doubt due to some inexperience of my Delphi XE2 knowledge. I'll try to explain it here.</p> <p><em><strong>Introduction:</em></strong></p> <p>I have an Interbase database with data. This database is located on a remote machine. The client application I am developing, uses this database. Due to the fact that the application must be used when there is no network connection available, I must use the briefcase model. That is why I make use of a ClientDataSet which retrieves the data and stores it locally in an XML format. In my opinion it would be easier to use a local database in stead of XML files, but I am not allowed to change that yet. Thus I am still bound to XML :(</p> <p>Due to the importance of the data, I would like to keep it as safe as possible. Even when other developers are changing the internal structure of the database (e.g. fields in tables are added, renamed or even removed) the data stored locally still must be available.</p> <p>What I do now, is that I use a ClientDataSet to retrieve the metadata from the database. This is stored seperately on disk. The next thing I am planning to do, is to compare the metadata from the database with the metadata stored in the local dataset. When I find differences in the fields, I create a new dataset in code where I build up the field definitions and add the data afterwards. In other words, I just create a new local dataset which is conform the structure of a table from the remote database.</p> <p>This is easy when I find column (field) removals or additions, however it becomes a bit more difficult when there is a change in name or in the datatype of a field.</p> <p>I do not yet take primary, foreign and unique keys into consideration, however I can feel this has to be done as well. </p> <p><em><strong>Question:</em></strong></p> <p>My question primarily is, is that I am wondering if this is the correct way. It is quite some work to achieve this, and before I am starting to implement this all, I would like to know if there are other (more convenient and easier) ways to achieve the things I described above.</p> <p>In the way I see it, the data available locally has a higher priority than the data stored within the remote database. Just because the user is working with the local data and not directly on the remote data.</p> <p>Any thoughts on this? I hope I could clarify my question enough, if not, please ask and I'll provide more details. I am working with Interbase XE (SP5) and Delphi XE 2.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload