Tuesday, December 28, 2010

Object IDs

There are times when we get into situtations with ID conflicts in these cases rather than changing the IDs directly in the SQL Dictionary we could use the helper methods in the ReleaseUpdateDB class:

changeFieldByAOTName
changeFieldByName
changeFieldId
changeNameByFieldId
changeTableByAOTName
changeTableByName
changeTableId


We get into ID conflicts when the layers are used as deployment vehicles. Lets take up a a few examples

Case 1

1. Error Message

TableName: EmplTable
Illegal data conversion from original field EMPLTABLE.CITACTUALTITLE to EMPLTABLE.SendMail: Unable to convert data types to anything but character field type (0 to 4). Synchronize database Cannot execute the required database operation. The SQL database has issued an error.

when the error message for table synchronize is displayed it has two parts from orginal details and to details. The from part displays the details existing in the SQLDictionary whereas the "to" part displays the current details as existing in the AOT.

Thus from the above message we can infer that currently there is a field named SendMail in the EmplTable in AOT and the same field id exists with a name CITActualTitle in the database and maybe the data types are also not compatible. So if we change the existing defination in the SQL Dictionary and move the field to a different id so that it does not clash with SendMail field we should be able to resolve the issue.

2. Care a job to renumber the field
ReleaseUpdateDB::changeFieldId(103, 30001, 30002, "EmplTable", "CITACTUALTITLE");


Case 2

1. Error Message
TableName:PYLEmplAccrualCarryFwd
Illegal data conversion from original field CITEMPLMEDICALCUREDATA.RESIDENCENO to PYLEMPLACCRUALCARRYFWD.accrualStartDate: Unable to convert data types to anything but character field type (0 to 3).
Illegal data conversion from original field CITEMPLMEDICALCUREDATA.CURETYPE to PYLEMPLACCRUALCARRYFWD.AccrualEndDate: Unable to convert data types to anything but character field type (0 to 3).
Illegal data conversion from original field CITEMPLMEDICALCUREDATA.ANNUALCURE to PYLEMPLACCRUALCARRYFWD.CarryFwdAccrualEndDate: Unable to convert data types to anything but character field type (0 to 3).
Illegal data conversion from original field CITEMPLMEDICALCUREDATA.TELNO to PYLEMPLACCRUALCARRYFWD.PostingDate: Unable to convert data types to anything but character field type (0 to 3).
Illegal data conversion from original field CITEMPLMEDICALCUREDATA.ADDRESS to PYLEMPLACCRUALCARRYFWD.ActualCalcDate: Unable to convert data types to anything but character field type (0 to 3).
Illegal data conversion from original field CITEMPLMEDICALCUREDATA.EMPLNAME to PYLEMPLACCRUALCARRYFWD.Completed: Unable to convert data types to anything but character field type (0 to 4).
Synchronize database Cannot execute the required database operation. The SQL database has issued an error.

This seems like a bigger issue however thatz not the case the hint in in the fist message if we notice we can see that in this message between the original and new part the table name is also changed. What this means is that the with the id of the current object PYLEMPLACCRUALCARRYFWD there is already a table existing in the database CITEMPLMEDICALCUREDATA now from this point onwards all the field ids in the table would also differ hence all the balance messages.

If we change the table id in the SQLDictionary for CITEMPLMEDICALCUREDATA then the new table PYLEMPLACCRUALCARRYFWD would be created fresh without any conflict with the fields

2. Renumber the table id
ReleaseUpdateDB::changeTableId( 30001, 30016, "CITEMPLMEDICALCUREDATA");

No comments: