|
@@ -179,6 +179,7 @@ const
|
|
|
ParamAllocStepSize = 8;
|
|
|
|
|
|
var
|
|
|
+ IgnorePart:boolean;
|
|
|
p,ParamNameStart,BufStart:PChar;
|
|
|
ParamName:string;
|
|
|
QuestionMarkParamCount,ParameterIndex,NewLength:integer;
|
|
@@ -251,21 +252,22 @@ begin
|
|
|
end;
|
|
|
':','?': // parameter
|
|
|
begin
|
|
|
- Inc(ParamCount);
|
|
|
- if ParamCount>Length(ParamPart) then
|
|
|
- begin
|
|
|
- NewLength:=Length(ParamPart)+ParamAllocStepSize;
|
|
|
- SetLength(ParamPart,NewLength);
|
|
|
- SetLength(ParamBinding,NewLength);
|
|
|
- end;
|
|
|
-
|
|
|
+ IgnorePart := False;
|
|
|
if p^=':' then
|
|
|
begin // find parameter name
|
|
|
Inc(p);
|
|
|
- ParamNameStart:=p;
|
|
|
- while not (p^ in (SQLDelimiterCharacters+[#0])) do
|
|
|
+ if p^=':' then // ignore ::, since some databases uses this as a cast (wb 4813)
|
|
|
+ begin
|
|
|
+ IgnorePart := True;
|
|
|
Inc(p);
|
|
|
- ParamName:=Copy(ParamNameStart,1,p-ParamNameStart);
|
|
|
+ end
|
|
|
+ else
|
|
|
+ begin
|
|
|
+ ParamNameStart:=p;
|
|
|
+ while not (p^ in (SQLDelimiterCharacters+[#0])) do
|
|
|
+ Inc(p);
|
|
|
+ ParamName:=Copy(ParamNameStart,1,p-ParamNameStart);
|
|
|
+ end;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
@@ -274,28 +276,39 @@ begin
|
|
|
ParamName:='';
|
|
|
end;
|
|
|
|
|
|
- // create Parameter and assign ParameterIndex
|
|
|
- if DoCreate then
|
|
|
- ParameterIndex := CreateParam(ftUnknown, ParamName, ptInput).Index
|
|
|
- // else find ParameterIndex
|
|
|
- else
|
|
|
+ if not IgnorePart then
|
|
|
+ begin
|
|
|
+ Inc(ParamCount);
|
|
|
+ if ParamCount>Length(ParamPart) then
|
|
|
begin
|
|
|
- if ParamName<>'' then
|
|
|
- ParameterIndex:=ParamByName(ParamName).Index
|
|
|
- else
|
|
|
+ NewLength:=Length(ParamPart)+ParamAllocStepSize;
|
|
|
+ SetLength(ParamPart,NewLength);
|
|
|
+ SetLength(ParamBinding,NewLength);
|
|
|
+ end;
|
|
|
+
|
|
|
+ // create Parameter and assign ParameterIndex
|
|
|
+ if DoCreate then
|
|
|
+ ParameterIndex := CreateParam(ftUnknown, ParamName, ptInput).Index
|
|
|
+ // else find ParameterIndex
|
|
|
+ else
|
|
|
begin
|
|
|
- ParameterIndex:=QuestionMarkParamCount;
|
|
|
- Inc(QuestionMarkParamCount);
|
|
|
+ if ParamName<>'' then
|
|
|
+ ParameterIndex:=ParamByName(ParamName).Index
|
|
|
+ else
|
|
|
+ begin
|
|
|
+ ParameterIndex:=QuestionMarkParamCount;
|
|
|
+ Inc(QuestionMarkParamCount);
|
|
|
+ end;
|
|
|
end;
|
|
|
- end;
|
|
|
|
|
|
- // store ParameterIndex in FParamIndex, ParamPart data
|
|
|
- ParamBinding[ParamCount-1]:=ParameterIndex;
|
|
|
- ParamPart[ParamCount-1].Start:=ParamNameStart-BufStart;
|
|
|
- ParamPart[ParamCount-1].Stop:=p-BufStart+1;
|
|
|
+ // store ParameterIndex in FParamIndex, ParamPart data
|
|
|
+ ParamBinding[ParamCount-1]:=ParameterIndex;
|
|
|
+ ParamPart[ParamCount-1].Start:=ParamNameStart-BufStart;
|
|
|
+ ParamPart[ParamCount-1].Stop:=p-BufStart+1;
|
|
|
|
|
|
- // update NewQueryLength
|
|
|
- Dec(NewQueryLength,p-ParamNameStart);
|
|
|
+ // update NewQueryLength
|
|
|
+ Dec(NewQueryLength,p-ParamNameStart);
|
|
|
+ end;
|
|
|
end;
|
|
|
#0:Break;
|
|
|
else
|