181 |
|
FCharacterSetSize: integer; |
182 |
|
FAutoFieldSize: boolean; |
183 |
|
FCodePage: TSystemCodePage; |
184 |
+ |
FDataSize: integer; |
185 |
|
protected |
186 |
|
procedure Bind(Binding: Boolean); override; |
187 |
|
function GetDataSize: Integer; override; |
791 |
|
FCharacterSetSize: integer; |
792 |
|
FCodePage: TSystemCodePage; |
793 |
|
FRelationName: string; |
794 |
+ |
FDataSize: integer; |
795 |
|
published |
796 |
|
property CharacterSetName: RawByteString read FCharacterSetName write FCharacterSetName; |
797 |
|
property CharacterSetSize: integer read FCharacterSetSize write FCharacterSetSize; |
798 |
|
property CodePage: TSystemCodePage read FCodePage write FCodePage; |
799 |
+ |
property DataSize: integer read FDataSize write FDataSize; |
800 |
|
property RelationName: string read FRelationName write FRelationName; |
801 |
|
property ArrayDimensions: integer read FArrayDimensions write FArrayDimensions; |
802 |
|
property ArrayBounds: TArrayBounds read FArrayBounds write FArrayBounds; |
1144 |
|
IBFieldDef := FieldDef as TIBFieldDef; |
1145 |
|
CharacterSetSize := IBFieldDef.CharacterSetSize; |
1146 |
|
CharacterSetName := IBFieldDef.CharacterSetName; |
1147 |
+ |
FDataSize := IBFieldDef.DataSize + 1; |
1148 |
|
if AutoFieldSize then |
1149 |
|
Size := IBFieldDef.Size; |
1150 |
|
CodePage := IBFieldDef.CodePage; |
1153 |
|
|
1154 |
|
function TIBStringField.GetDataSize: Integer; |
1155 |
|
begin |
1156 |
< |
Result := Size * CharacterSetSize + 1; |
1156 |
> |
Result := FDataSize; |
1157 |
|
end; |
1158 |
|
|
1159 |
|
constructor TIBStringField.Create(aOwner: TComponent); |
1212 |
|
s: RawByteString; |
1213 |
|
begin |
1214 |
|
Buffer := nil; |
1215 |
< |
IBAlloc(Buffer, 0, Size + 1); |
1215 |
> |
IBAlloc(Buffer, 0, DataSize); |
1216 |
|
try |
1217 |
|
s := Value; |
1218 |
|
if StringCodePage(s) <> CodePage then |
1219 |
|
SetCodePage(s,CodePage,CodePage<>CP_NONE); |
1220 |
< |
StrLCopy(Buffer, PChar(s), Size); |
1220 |
> |
StrLCopy(Buffer, PChar(s), DataSize-1); |
1221 |
|
if Transliterate then |
1222 |
|
DataSet.Translate(Buffer, Buffer, True); |
1223 |
|
SetData(Buffer); |
3675 |
|
var |
3676 |
|
FieldType: TFieldType; |
3677 |
|
FieldSize: Word; |
3678 |
+ |
FieldDataSize: integer; |
3679 |
|
charSetID: short; |
3680 |
|
CharSetSize: integer; |
3681 |
|
CharSetName: RawByteString; |
3812 |
|
FieldName := getSQLName; |
3813 |
|
FAliasNameList[i] := DBAliasName; |
3814 |
|
FieldSize := 0; |
3815 |
+ |
FieldDataSize := GetSize; |
3816 |
|
FieldPrecision := 0; |
3817 |
|
FieldNullable := IsNullable; |
3818 |
|
CharSetSize := 0; |
3825 |
|
their values } |
3826 |
|
SQL_VARYING, SQL_TEXT: |
3827 |
|
begin |
3828 |
< |
FirebirdAPI.CharSetWidth(getCharSetID,CharSetSize); |
3829 |
< |
CharSetName := FirebirdAPI.GetCharsetName(getCharSetID); |
3830 |
< |
FirebirdAPI.CharSetID2CodePage(getCharSetID,FieldCodePage); |
3831 |
< |
FieldSize := GetSize div CharSetSize; |
3828 |
> |
if not Database.Attachment.CharSetWidth(getCharSetID,CharSetSize) then |
3829 |
> |
CharSetSize := 1; |
3830 |
> |
CharSetName := Database.Attachment.GetCharsetName(getCharSetID); |
3831 |
> |
Database.Attachment.CharSetID2CodePage(getCharSetID,FieldCodePage); |
3832 |
> |
FieldSize := FieldDataSize div CharSetSize; |
3833 |
|
FieldType := ftString; |
3834 |
|
end; |
3835 |
|
{ All Doubles/Floats should be cast to doubles } |
3880 |
|
FieldSize := -getScale; |
3881 |
|
end |
3882 |
|
else |
3883 |
< |
FieldType := ftFloat |
3883 |
> |
FieldType := ftFloat; |
3884 |
|
end; |
3885 |
|
SQL_TIMESTAMP: FieldType := ftDateTime; |
3886 |
|
SQL_TYPE_TIME: FieldType := ftTime; |
3890 |
|
FieldSize := sizeof (TISC_QUAD); |
3891 |
|
if (getSubtype = 1) then |
3892 |
|
begin |
3893 |
< |
FirebirdAPI.CharSetWidth(getCharSetID,CharSetSize); |
3894 |
< |
CharSetName := FirebirdAPI.GetCharsetName(getCharSetID); |
3895 |
< |
FirebirdAPI.CharSetID2CodePage(getCharSetID,FieldCodePage); |
3893 |
> |
if not Database.Attachment.CharSetWidth(getCharSetID,CharSetSize) then |
3894 |
> |
CharSetSize := 1; |
3895 |
> |
CharSetName := Database.Attachment.GetCharsetName(getCharSetID); |
3896 |
> |
Database.Attachment.CharSetID2CodePage(getCharSetID,FieldCodePage); |
3897 |
|
FieldType := ftMemo; |
3898 |
|
end |
3899 |
|
else |
3925 |
|
Name := FieldAliasName; |
3926 |
|
FAliasNameMap[FieldNo-1] := DBAliasName; |
3927 |
|
Size := FieldSize; |
3928 |
+ |
DataSize := FieldDataSize; |
3929 |
|
Precision := FieldPrecision; |
3930 |
|
Required := not FieldNullable; |
3931 |
|
RelationName := aRelationName; |