Delphi dbExpress and Interbase: UTF8 migration steps and risks?

前端 未结 8 1918
鱼传尺愫
鱼传尺愫 2020-12-17 04:09

Currently, our database uses Win1252 as the only character encoding. We will have to support Unicode in the database tables soon, which means we have to perform this migrati

相关标签:
8条回答
  • 2020-12-17 04:38

    Both Database Workbench and IBExpert can do the data migration for you.

    I'll get back to you on the other questions when I'm at the Entwickler Tage.

    --jeroen

    0 讨论(0)
  • 2020-12-17 04:41

    Problem: UDF (user defined functions) with string parameters can break because of sizes limits.

    Symptom:

    Dynamic SQL Error.
    SQL error code = -204.
    Data type unknown.
    Implementation limit exceeded.
    COLUMN DSQL internal.
    

    for this UDF:

    DECLARE EXTERNAL FUNCTION STRLEN
        CSTRING(32767)
        RETURNS INTEGER BY VALUE
        ENTRY_POINT 'IB_UDF_strlen' MODULE_NAME 'ib_udf';
    

    Solution: fix UDF parameters in the declaration.

    0 讨论(0)
  • 2020-12-17 04:44

    Problem: dbExpress uses WideString as data type internally, so all existing .AsString calls for reading / setting field and parameter will no longer work

    Symptom: special characters will not be stored / read correctly

    Solution: replace all occurences of .AsString with .AsWideString but be careful to not change where the AsString method is not called on a field or parameter.

    0 讨论(0)
  • 2020-12-17 04:45

    Problem: UPDATE on a empty string field no longer finds a record. If a UTF8 character field is empty, the DataSetProvider generates a wrong SELECT for the update action.

    Symptom: Message 'record not found or edited by another user'

    Solution: upgrade to Delphi 2010 Update 4 or use the workaround described in QC

    0 讨论(0)
  • 2020-12-17 04:48

    Problem: dbExpress needs TStringField objects for WIN1252 fields. For UTF8 database fields, dbExpress needs TWideStringField objects.

    Symptom: error message 'expected: WideString found: string'

    Solution: replace all occurences of TStringField with TWideStringField. This requires that all form files (dfm) are text, not binary. The modified forms and datamodules will not be backwards compatible.

    0 讨论(0)
  • 2020-12-17 04:58

    Problem: persistent string fields require a Size property which is the logical size of the field multiplied by four (see also: Is it possible to tweak TStringField to work like TWideStringField in Delphi?)

    Symptom: Access violations

    Solution: delete the persistent field and add it again to update the Size property. (side effect: the DisplayWidth will also increase size, leading to problems with UI)

    0 讨论(0)
提交回复
热议问题