I'm working on a method to provide remote upgrades to databases, i.e I send them a new version and a 'utility' does the upgrading for them. I am using a methodology that has worked successfully in the past, where by all data is uploaded from the previous version to the new one and then the old version is over written by the new one, this means that we can test that the upgrade was successful before the old version is replaced.
For each table in the database I temporally attach them to the utility database using the FILE_ADD_TO_DB() and FILE_DROP_FROM_DB() commands, I am then using
to transfer all the records from the old version to the new version, this work great but I was surprised what it does with the auto increment ID field I have on each of the tables.
If the current database had four records, these would have ID's of
00000 - Red Car
00001 - Blue Car
00002 - Yellow Car
00003 - Pink Car
It I deleted one of these records such as 00002, then it would leave
00000 - Red Car
00001 - Blue Car
00003 - Pink Car
I had expected that when records were added to the upgrade version the tbl_source.copy_records_to() command would create new ID is for each record:-
00000 - Red Car
00001 - Blue Car
00002 - Pink Car
and that I would have to do some fancy footwork to resolve these differences, however what I found was that the old ID's were preserved.
Is this correct and would it always happen (if so it makes life much more easy.) ?
Thanks
John
For each table in the database I temporally attach them to the utility database using the FILE_ADD_TO_DB() and FILE_DROP_FROM_DB() commands, I am then using
Code:
tbl_source = table.open(file_path) query.filter = ".T." indx = tbl_source.query_create() result = tbl_source.copy_records_to(file_path_up)
If the current database had four records, these would have ID's of
00000 - Red Car
00001 - Blue Car
00002 - Yellow Car
00003 - Pink Car
It I deleted one of these records such as 00002, then it would leave
00000 - Red Car
00001 - Blue Car
00003 - Pink Car
I had expected that when records were added to the upgrade version the tbl_source.copy_records_to() command would create new ID is for each record:-
00000 - Red Car
00001 - Blue Car
00002 - Pink Car
and that I would have to do some fancy footwork to resolve these differences, however what I found was that the old ID's were preserved.
Is this correct and would it always happen (if so it makes life much more easy.) ?
Thanks
John
Comment