1 |
< |
unit Test12; |
1 |
> |
unit Test12; |
2 |
> |
{$IFDEF MSWINDOWS} |
3 |
> |
{$DEFINE WINDOWS} |
4 |
> |
{$ENDIF} |
5 |
|
|
6 |
< |
{$mode objfpc}{$H+} |
6 |
> |
{$IFDEF FPC} |
7 |
> |
{$mode delphi} |
8 |
|
|
9 |
|
{$codepage UTF8} |
10 |
+ |
{$ENDIF} |
11 |
|
|
12 |
|
interface |
13 |
|
|
31 |
|
procedure UpdateDatabase(Attachment: IAttachment); |
32 |
|
procedure QueryDatabase(Attachment: IAttachment); |
33 |
|
public |
34 |
< |
function TestTitle: string; override; |
35 |
< |
procedure RunTest(CharSet: string; SQLDialect: integer); override; |
34 |
> |
function TestTitle: AnsiString; override; |
35 |
> |
procedure RunTest(CharSet: AnsiString; SQLDialect: integer); override; |
36 |
|
end; |
37 |
|
|
38 |
|
implementation |
42 |
|
'Create Table TestData ('+ |
43 |
|
'RowID Integer not null,'+ |
44 |
|
'Title VarChar(32) Character Set UTF8,'+ |
45 |
< |
'Notes VarChar(64) Character Set ISO8859_1,'+ |
45 |
> |
'Notes VarChar(64) Character Set ISO8859_1 collate FR_FR,'+ |
46 |
|
'BlobData Blob sub_type 1 Character Set WIN1252, '+ |
47 |
|
'BlobData2 Blob sub_type 1 Character Set UTF8, '+ |
48 |
|
'InClear VarChar(16) Character Set OCTETS, '+ |
49 |
+ |
'FixedWidth Char(4) Character set UTF8, '+ |
50 |
|
'Primary Key(RowID)'+ |
51 |
|
')'; |
52 |
|
|
53 |
|
sqlGetCharSets = 'Select RDB$CHARACTER_SET_NAME,RDB$CHARACTER_SET_ID from RDB$CHARACTER_SETS order by 2'; |
54 |
|
|
55 |
< |
sqlInsert = 'Insert into TestData(RowID,Title,Notes, BlobData,BlobData2,InClear) Values(:RowID,:Title,:Notes,:BlobData,:BlobData2,:InClear)'; |
55 |
> |
sqlInsert = 'Insert into TestData(RowID,Title,Notes, BlobData,BlobData2,InClear,FixedWidth) '+ |
56 |
> |
'Values(:RowID,:Title,:Notes,:BlobData,:BlobData2,:InClear,:FixedWidth)'; |
57 |
|
|
58 |
|
|
59 |
|
{ TTest12 } |
69 |
|
with Statement.GetSQLParams do |
70 |
|
begin |
71 |
|
ByName('rowid').AsInteger := 1; |
72 |
+ |
{$IFDEF DCC} |
73 |
+ |
ByName('title').AsString := UTF8Encode('Blob Test ©€'); |
74 |
+ |
ByName('Notes').AsString := UTF8Encode('Écoute moi'); |
75 |
+ |
{$ELSE} |
76 |
|
ByName('title').AsString := 'Blob Test ©€'; |
77 |
|
ByName('Notes').AsString := 'Écoute moi'; |
78 |
+ |
{$ENDIF} |
79 |
|
ByName('BlobData').AsString := 'Some German Special Characters like ÖÄÜöäüß'; |
80 |
|
ByName('BlobData2').AsBlob := Attachment.CreateBlob(Transaction,'TestData','BlobData').SetString('Some German Special Characters like ÖÄÜöäüß'); |
81 |
|
ByName('InClear').AsString := #$01'Test'#$0D#$C3; |
82 |
+ |
ByName('FixedWidth').AsString := 'É'; |
83 |
|
end; |
84 |
|
Statement.Execute; |
85 |
|
end; |
94 |
|
ReportResults(Statement); |
95 |
|
end; |
96 |
|
|
97 |
< |
function TTest12.TestTitle: string; |
97 |
> |
function TTest12.TestTitle: AnsiString; |
98 |
|
begin |
99 |
|
Result := 'Test 12: Character Sets'; |
100 |
|
end; |
101 |
|
|
102 |
< |
procedure TTest12.RunTest(CharSet: string; SQLDialect: integer); |
102 |
> |
procedure TTest12.RunTest(CharSet: AnsiString; SQLDialect: integer); |
103 |
|
var DPB: IDPB; |
104 |
|
Attachment: IAttachment; |
105 |
|
begin |