The TurboDB Engine supports Unicode in WideString columns and in WideMemos. Working with those data types in a VCL/CLX application however contains some pitfalls. The VCL almost everywhere uses AnsiStrings in its functions and components and converts Unidcode strings automatically and without warning to this type. CLX is principally based on Unicode but the database access comonents have the same interfaces as their VCL counterparts. As a consequence the database controls also only receive and pass AnsiStrings. This means there is no way to enter and/or view Unicode data from your database in VCL/CLX data controls.
This is what you can do with the Unicode data in your TurboDB database within a VCL/CLX application:
- Show and edit strings in normal controls, e.g. TEdit. Those controls work with Unicode correctly but you will have to write your own updating and posting logic, since normal controls have no DataSource link.
- Work with the Unicode data internally. You can read and write WideStrings from and to a data set component.
When accessing Unicode data from a TdbDataSet be careful not to use the TField.AsString property but the Value or the AsWideString property.
Query parameters (i.e. items of the TTdbQuery.Params collection) can only be set via the TParam.Value property.
If you are working with Unicode memos you will notice quickly that VCL/CLX does not offer a data type for this kind of columns. Unicode memos are represented by the ftBlob field type and the custom field class TTdbBlobField, which offers a AsWideString property.
The Filter property in VCL/CLX components as well as the SQL property are both of type AnsiString. Therefore you cannot use them for searching for Unicode strings. The TurboDB database components therefore have additional FilterW and SQLW properties which are of type WideString.