* Merging revisions 42831,42832 from trunk:

------------------------------------------------------------------------
    r42831 | michael | 2019-08-26 20:32:59 +0200 (Mon, 26 Aug 2019) | 1 line
    
    * Fix bug ID #35887
    ------------------------------------------------------------------------
    r42832 | michael | 2019-08-26 20:50:03 +0200 (Mon, 26 Aug 2019) | 1 line
    
    * Add support for citext field
    ------------------------------------------------------------------------

git-svn-id: branches/fixes_3_2@42850 -
This commit is contained in:
michael 2019-08-27 07:03:44 +00:00
parent 6ef897798e
commit 590c23c6bb
2 changed files with 23 additions and 24 deletions

View File

@ -33,7 +33,7 @@ type
// TField and TFieldDef only support a limited amount of fields.
// TFieldBinding and TExtendedFieldType can be used to map PQ types
// on standard fields and retain mapping info.
TExtendedFieldType = (eftNone,eftEnum);
TExtendedFieldType = (eftNone,eftEnum,eftCitext);
TFieldBinding = record
FieldDef : TSQLDBFieldDef; // FieldDef this is associated with
@ -366,15 +366,16 @@ begin
tt:=pqgetvalue(Res,i,2);
tc:=pqgetvalue(Res,i,3);
J:=length(Bindings)-1;
while (J>=0) and (Bindings[j].TypeOID<>toid) do
Dec(J);
if (J>=0) then
while (J>= 0) do
begin
Bindings[j].TypeName:=TN;
Case tt of
'e': // Enum
if (Bindings[j].TypeOID=toid) then
Case tt of
'e':
Bindings[j].ExtendedFieldType:=eftEnum;
end;
'citext':
Bindings[j].ExtendedFieldType:=eftCitext;
end;
Dec(J);
end;
end;
finally
@ -1152,6 +1153,10 @@ begin
FD.DataType:=ftString;
FD.Size:=64;
//FD.Attributes:=FD.Attributes+[faReadonly];
end;
eftCitext:
begin
FD.DataType:=ftMemo;
end
else
if ErrorOnUnknownType then

View File

@ -508,7 +508,6 @@ type
procedure SetUpdateMode(AValue : TUpdateMode);
procedure OnChangeModifySQL(Sender : TObject);
procedure Execute;
procedure ApplyFilter;
Function AddFilter(SQLstr : string) : string;
protected
function CreateSQLStatement(aOwner: TComponent): TCustomSQLStatement; virtual;
@ -2696,19 +2695,6 @@ begin
end;
end;
procedure TCustomSQLQuery.ApplyFilter;
begin
FreeFldBuffers;
FStatement.Unprepare;
FIsEOF := False;
inherited InternalClose;
FStatement.DoPrepare;
FStatement.DoExecute;
inherited InternalOpen;
First;
end;
procedure TCustomSQLQuery.SetActive(Value: Boolean);
begin
@ -2727,7 +2713,11 @@ begin
if (ServerFiltered <> Value) then
begin
FServerFiltered := Value;
if Active then ApplyFilter;
if Active then
begin
Close;
Open;
end;
end;
end;
@ -2736,7 +2726,11 @@ begin
if Value <> ServerFilter then
begin
FServerFilterText := Value;
if Active then ApplyFilter;
if Active then
begin
Close;
Open;
end;
end;
end;