[Interest] version control on MySQL-Qt
Konrad Rosenbaum
konrad at silmor.de
Thu Jun 7 19:26:22 CEST 2012
Hi,
On Thursday 07 June 2012 15:01:11 Sujan Dasmahapatra wrote:
> I have a mysql database which I am accessing using my tool developed in
> QT. Tables are created. Can we create the same table with the same name
> but with different revision. Is this facility available in MySQL and
> Qt........I want to update the table with the same name but new dataset
> will be there only the values will be updated. Can we do that ? Please
> help.
No, this is not available in MySQL or any other standard SQL database. It
might be possible to do something like this using inheritance in Postgres, but
the DB may be pushed towards its limits with this.
Depending on what you want to accomplish with this you may want to consider
different mechanisms:
If you simply want the ability to return to a known working dataset if you
realize in the middle of an operation that something is wrong: read up on
transactions, make sure you use InnoDB (or another transaction-enabled table-
type), use "BEGIN TRANSACTION", "COMMIT", and "ROLLBACK" in your SQL code.
If you are simply looking for the ability to return to a specific revision of
your data for purposes of testing your software: this is what backups are for
(see mysql_dump).
If you actually want to store versioned data: analyse the data carefully.
Depending on the data at hand it may be preferable to either use a version
control system (like SVN or GIT) or to design a more complex DB-schema that
contains version numbers for your datasets.
Hint: if the data is inherently hierarchical it may make more sense to
generate XML files and store those in SVN or GIT. If it is inherently
relational it makes more sense to invest significant time into a new DB-design
that can store versions (Warning: this is tricky to do right).
Konrad
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20120607/641b1723/attachment.sig>
More information about the Interest
mailing list