* Fixed fixed-width char-parameters + test

git-svn-id: trunk@11629 -
This commit is contained in:
joost 2008-08-22 12:49:29 +00:00
parent 243a724dac
commit 171193a675
3 changed files with 22 additions and 1 deletions

View File

@ -796,7 +796,14 @@ begin
inc(CurrBuff,2);
end
else
begin
// The buffer-length is always VSQLVar^.sqllen, nothing more, nothing less
// so fill the complete buffer with valid data. Adding #0 will lead
// to problems, because the #0 will be seen as a part of the (binary) string
CurrBuff := VSQLVar^.SQLData;
w := VSQLVar^.sqllen;
s := PadRight(s,w);
end;
Move(s[1], CurrBuff^, w);
end;
SQL_TYPE_DATE, SQL_TYPE_TIME, SQL_TIMESTAMP :

View File

@ -28,6 +28,7 @@ type
procedure RunTest; override;
published
procedure TestClearUpdateableStatus;
procedure TestFixedStringParamQuery;
procedure TestReadOnlyParseSQL; // bug 9254
procedure TestParseJoins; // bug 10148
procedure TestDoubleFieldNames; // bug 8457
@ -700,6 +701,11 @@ begin
TestXXParamQuery(ftString,'VARCHAR(10)',testValuesCount);
end;
procedure TTestFieldTypes.TestFixedStringParamQuery;
begin
TestXXParamQuery(ftFixedChar,'CHAR(10)',testValuesCount);
end;
procedure TTestFieldTypes.TestDateParamQuery;
begin
@ -731,6 +737,7 @@ begin
case ADataType of
ftInteger: Params.ParamByName('field1').asinteger := testIntValues[i];
ftFloat : Params.ParamByName('field1').AsFloat := testFloatValues[i];
ftFixedChar,
ftString : Params.ParamByName('field1').AsString := testStringValues[i];
ftDate : if cross then
Params.ParamByName('field1').AsString:= testDateValues[i]
@ -753,7 +760,13 @@ begin
case ADataType of
ftInteger: AssertEquals(testIntValues[i],FieldByName('FIELD1').AsInteger);
ftFloat : AssertEquals(testFloatValues[i],FieldByName('FIELD1').AsFloat);
ftString : AssertEquals(testStringValues[i],FieldByName('FIELD1').AsString);
ftFixedChar,
ftString : begin
if FieldByName('FIELD1').isnull then
AssertEquals(testStringValues[i],FieldByName('FIELD1').AsString)
else
AssertEquals(PadRight(testStringValues[i],10),FieldByName('FIELD1').AsString);
end;
ftdate : AssertEquals(testDateValues[i],FormatDateTime('yyyy/mm/dd',FieldByName('FIELD1').AsDateTime));
else
AssertTrue('no test for paramtype available',False);

View File

@ -231,6 +231,7 @@ var DBConnectorClass : TPersistentClass;
i : integer;
begin
testValues[ftString] := testStringValues;
testValues[ftFixedChar] := testStringValues;
testValues[ftDate] := testDateValues;
for i := 0 to testValuesCount-1 do
begin