[FAQ] Clone.....

Thomas Flemming tf at ttqv.com
Mon Jul 5 04:55:41 CDT 2010


Morning Ruslan,


 > Yes, because in docs pointed that in Valentina fIDentity field,
Yes, its written, that RecID can change, but I didnt find any hint, that 
fIdentity can also change.

I need a unique, never changing Id if my records, not only because of 
reletaion between tables, but also because of external references from outside.

Ok, I can make my own implementation, I just thought, that fIDentity would do 
the job.

Regards,
Tom


Am 05.07.2010 07:08, schrieb Ruslan Zasukhin:
> 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.
>

-- 
/****************************************
**   Dipl.-Ing. Thomas Flemming
**   Software Development
**
**   Touratech AG
**   Auf dem Zimmermann 7-9
**   D-78078 Niedereschach
**
**   mail  tf at ttqv.com
**   fon   +49 (0) 7728 9279-206
**   fax   +49 (0) 7728 9279-29
**
**   http://www.ttqv.com
**   http://www.touratech.de
**
**   ... und immer dem Pfeil nach!
***************************************/


More information about the Valentina mailing list