TZAbstractRODataset.InternalLocate problem
Posted: 30.10.2009, 03:27
Hi,
Could this a bug or limitation or compatible issue between 6.6x and 6.1x.
Here the table structure
---------------------------------------------
CREATE TABLE `ctsstkotmst` (
`somRnID` BIGINT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`somDtTm` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
`somPsID` VARCHAR(32) NOT NULL DEFAULT '',
`somPsON` VARCHAR(32) NOT NULL DEFAULT '',
`prdDsgn` VARCHAR(32) NOT NULL DEFAULT '',
`somFlag` VARCHAR(4) NULL DEFAULT 'NO',
`somRems` TEXT NULL,
PRIMARY KEY (`somRnID`),
UNIQUE INDEX `somRnID` (`somRnID`),
INDEX `somRnID_2` (`somRnID`),
INDEX `somDtTm` (`somDtTm`),
INDEX `somPsID` (`somPsID`),
INDEX `somPsON` (`somPsON`),
INDEX `prdDsgn` (`prdDsgn`)
)
COLLATE=latin1_swedish_ci
ENGINE=MyISAM
ROW_FORMAT=DYNAMIC
AUTO_INCREMENT=3081
AVG_ROW_LENGTH=53
---------------------------------------------
dtsMast->DataSet->Locate( 'somPsID','0000003710',TLocateOptions( ) << loCaseInsensitive << loPartialKey );
under version 6.1x this work fine, for 6.6x the '0000003710' cannot be locate but '3710' was OK.
I have checked the CompareFieldsFromResultSet, because of the 'loPartialKey', the result become false.
It is better to chcek again, if the field is integer or decimal first?
---------------------------------------------
Changes
if CaseInsensitive then
Value2 := AnsiUpperCase(Value2);
Result := AnsiStrLComp(PChar(Value2), PChar(Value1), Length(Value1)) = 0;
if ( false = Result ) then
case CurrentType of
stByte,
stShort,
stInteger,
stLong:
begin
Result := StrToIntDef( KeyValues[I].VString,-91929394 ) =
ResultSet.GetLong(ColumnIndex);
end;
end;
---------------------------------------------
Regards,
KL Chin
Could this a bug or limitation or compatible issue between 6.6x and 6.1x.
Here the table structure
---------------------------------------------
CREATE TABLE `ctsstkotmst` (
`somRnID` BIGINT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`somDtTm` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
`somPsID` VARCHAR(32) NOT NULL DEFAULT '',
`somPsON` VARCHAR(32) NOT NULL DEFAULT '',
`prdDsgn` VARCHAR(32) NOT NULL DEFAULT '',
`somFlag` VARCHAR(4) NULL DEFAULT 'NO',
`somRems` TEXT NULL,
PRIMARY KEY (`somRnID`),
UNIQUE INDEX `somRnID` (`somRnID`),
INDEX `somRnID_2` (`somRnID`),
INDEX `somDtTm` (`somDtTm`),
INDEX `somPsID` (`somPsID`),
INDEX `somPsON` (`somPsON`),
INDEX `prdDsgn` (`prdDsgn`)
)
COLLATE=latin1_swedish_ci
ENGINE=MyISAM
ROW_FORMAT=DYNAMIC
AUTO_INCREMENT=3081
AVG_ROW_LENGTH=53
---------------------------------------------
dtsMast->DataSet->Locate( 'somPsID','0000003710',TLocateOptions( ) << loCaseInsensitive << loPartialKey );
under version 6.1x this work fine, for 6.6x the '0000003710' cannot be locate but '3710' was OK.
I have checked the CompareFieldsFromResultSet, because of the 'loPartialKey', the result become false.
It is better to chcek again, if the field is integer or decimal first?
---------------------------------------------
Changes
if CaseInsensitive then
Value2 := AnsiUpperCase(Value2);
Result := AnsiStrLComp(PChar(Value2), PChar(Value1), Length(Value1)) = 0;
if ( false = Result ) then
case CurrentType of
stByte,
stShort,
stInteger,
stLong:
begin
Result := StrToIntDef( KeyValues[I].VString,-91929394 ) =
ResultSet.GetLong(ColumnIndex);
end;
end;
---------------------------------------------
Regards,
KL Chin