[FAQ] Clone.....

Ruslan Zasukhin ruslan_zasukhin at valentina-db.com
Mon Jul 5 01:08:50 CDT 2010


On 7/5/10 12:38 AM, "Thomas Flemming" <tf at ttqv.com> wrote:

Hi Thomas,

> afters hours of debugging I realized, that database.clone is changing the
> values of fields with the EVFlag.fIdentity set!

Yes, because in docs pointed that in Valentina fIDentity field,
In fact is virtual method field, pointing RecID.

Clone can chang RecID
So fIdentity field also.

 
> For example I have some records in a table, so the values of the column with
> the fIdentity-flag are  1,2,3,4,5....
> Now I delete the first three records, so only the records with fIdentity
> 4,5,6... are remaining.
> 
> Now I clone this database with vdb.clone("newdb.vdb", true)
> 
> Now all records are renumbered, fIdentity is starting again at 1,2,3....
> 
> Is this a bug or a feature?

feature
 
> My problem is, I have other tables, where records are referring to this
> fIdentity, and this relation is totally messed up after cloning...


Then you need make own implementation of seria of values 1 .. N
You can try to use for this SP.


*******************
About relations ...

In fact you can much more easy to use RecID + ObjectPtr.

On left side you already use RecID indirectly via fIndentity
But on right side I think you have made own field of the same type.

If you will use ObjectPtr, pointing RecID,
Then algs ofClone() change both  RecID and ObjectPtrs.
So links will stay correct.

-- 
Best regards,

Ruslan Zasukhin
VP Engineering and New Technology
Paradigma Software, Inc

Valentina - Joining Worlds of Information
http://www.paradigmasoft.com

[I feel the need: the need for speed]




More information about the Valentina mailing list