|
@@ -1018,7 +1018,7 @@ begin
|
|
|
// A size of 0 is allowed, since for example Firebird allows
|
|
|
// a query like: 'select '' as fieldname from table' which
|
|
|
// results in a string with size 0.
|
|
|
- If (AValue<0) or (AValue>dsMaxStringSize) Then
|
|
|
+ If (AValue<0) Then
|
|
|
databaseErrorFmt(SInvalidFieldSize,[AValue])
|
|
|
end;
|
|
|
|
|
@@ -1092,19 +1092,39 @@ end;
|
|
|
function TStringField.GetValue(var AValue: string): Boolean;
|
|
|
|
|
|
Var Buf, TBuf : TStringFieldBuffer;
|
|
|
+ DynBuf, TDynBuf : Array of char;
|
|
|
|
|
|
begin
|
|
|
- Result:=GetData(@Buf);
|
|
|
- If Result then
|
|
|
+ if DataSize <= dsMaxStringSize then
|
|
|
begin
|
|
|
- if transliterate then
|
|
|
+ Result:=GetData(@Buf);
|
|
|
+ If Result then
|
|
|
begin
|
|
|
- DataSet.Translate(Buf,TBuf,False);
|
|
|
- AValue:=TBuf;
|
|
|
+ if transliterate then
|
|
|
+ begin
|
|
|
+ DataSet.Translate(Buf,TBuf,False);
|
|
|
+ AValue:=TBuf;
|
|
|
+ end
|
|
|
+ else
|
|
|
+ AValue:=Buf
|
|
|
end
|
|
|
- else
|
|
|
- AValue:=Buf
|
|
|
end
|
|
|
+ else
|
|
|
+ begin
|
|
|
+ SetLength(DynBuf,DataSize);
|
|
|
+ Result:=GetData(@DynBuf[0]);
|
|
|
+ If Result then
|
|
|
+ begin
|
|
|
+ if transliterate then
|
|
|
+ begin
|
|
|
+ SetLength(TDynBuf,DataSize);
|
|
|
+ DataSet.Translate(@DynBuf[0],@TDynBuf[0],False);
|
|
|
+ AValue:=pchar(TDynBuf);
|
|
|
+ end
|
|
|
+ else
|
|
|
+ AValue:=pchar(DynBuf);
|
|
|
+ end
|
|
|
+ end;
|
|
|
end;
|
|
|
|
|
|
procedure TStringField.SetAsBoolean(AValue: Boolean);
|
|
@@ -1175,7 +1195,7 @@ begin
|
|
|
// A size of 0 is allowed, since for example Firebird allows
|
|
|
// a query like: 'select '' as fieldname from table' which
|
|
|
// results in a string with size 0.
|
|
|
- If (AValue<0) or (AValue>(dsMaxStringSize div 2)) Then
|
|
|
+ If (AValue<0) Then
|
|
|
databaseErrorFmt(SInvalidFieldSize,[AValue]);
|
|
|
end;
|
|
|
|