Commit 8c82944b authored by Jucelino Fonseca's avatar Jucelino Fonseca

Teste e ajustes

parent 15cac967
......@@ -172,7 +172,7 @@ type
function ContemPalavrasEspeciais (piTextoEntrada: string): boolean;
procedure AddAliasListas(piLinhas: string;piAlias : TStrings);
function LoadAliasBlocoFROMOQLEdit(piTexto: string; piAlias: TStrings): string;
function GetClassTicketByNameRelation(piNameObjeto : string; out piNameAntObjeto : string) : acClassTicket;
function GetClassTicketByNameRelation(piNameObjeto : string; out piNameAntObjeto : string;piRetonarClassAnterior : boolean = false) : acClassTicket;
function GetClassTicketByNameANDAlias(piNameObjeto : string) : acClassTicket;
//
function GetTextoAfterWord(piSynEdit: TSynEdit): string;
......@@ -493,7 +493,7 @@ end;
procedure TExplorerV2.SynEditOQLCommandProcessed(Sender: TObject;
var Command: TSynEditorCommand; var AChar: TUTF8Char; Data: pointer);
begin
fhlt1.CloseCompletionWindow;
//fhlt1.CloseCompletionWindow;
end;
procedure TExplorerV2.SynEditOQLKeyUp(Sender: TObject; var Key: Word;
......@@ -807,7 +807,7 @@ begin
else
begin
lClassTicketCurrent := self.GetClassTicketByNameRelation(piLinha,ls_ant_objeto);
lClassTicketCurrent := self.GetClassTicketByNameRelation(piLinha,ls_ant_objeto,true);
if Assigned(lClassTicketCurrent) then
begin
//ShowMessage(ls_ant_objeto);
......@@ -992,6 +992,7 @@ var ls_texto,
ls_Alias : string;
ls_classe : string;
lClassTicketCurrent: acClassTicket;
liIndex : Integer;
begin
ls_Alias := '';
if (piLinhas <> '') and (not ContemPalavrasEspeciais(piLinhas)) then
......@@ -1023,9 +1024,14 @@ begin
lClassTicketCurrent := self.GetClassTicketByNameRelation(ls_classe,ls_name_ant_objeto);
if Assigned(lClassTicketCurrent) then
begin
if piAlias.IndexOf(ls_Alias) < 0 then
liIndex := piAlias.IndexOf(ls_Alias);
if liIndex < 0 then
begin
piAlias.AddObject(UpperCase(ls_Alias),lClassTicketCurrent);
end
else
begin
piAlias.Objects[liIndex] := lClassTicketCurrent;
end;
end;
end;
......@@ -1116,8 +1122,9 @@ begin
end;
function TExplorerV2.GetClassTicketByNameRelation(piNameObjeto: string; out piNameAntObjeto : string): acClassTicket;
function TExplorerV2.GetClassTicketByNameRelation(piNameObjeto: string; out piNameAntObjeto : string;piRetonarClassAnterior : boolean = false): acClassTicket;
var lClassTicketCurrent,
lCassTicketAnterior,
lClassTicketAux: acClassTicket;
lEnumerator : acEnumerator;
li,
......@@ -1136,6 +1143,7 @@ begin
lClassTicketCurrent := Self.GetClassTicketByNameANDAlias(ls_Objeto);
while li_Pos > 0 do
begin
lCassTicketAnterior := lClassTicketCurrent;
lClassTicketAux := nil;
ls_aux := trim(Copy(ls_aux,li_Pos +1,Length(ls_aux)));
ls_ant_objeto := ls_aux;
......@@ -1175,10 +1183,19 @@ begin
end;
end;
end;
lClassTicketCurrent := lClassTicketAux;
end;
end;
result := lClassTicketCurrent;
if (trim(ls_ant_objeto) <> '') and (not Assigned(result)) then;
begin
if piRetonarClassAnterior then
begin
result := lCassTicketAnterior;
end;
end;
end
else
begin
......@@ -1227,15 +1244,14 @@ begin
if trim(result) <> '' then
begin
piSynEdit.CaretX := Length(result);
piSynEdit.CaretY := p1.Y;
p2.Y := p1.Y;
p2.X := Length(result);
piSynEdit.CaretXY := p2;
p1 := piSynEdit.PrevWordPos;
lWord := piSynEdit.GetWordAtRowCol(p1);
p1.X := p1.X + Length(lWord);
p2 := piSynEdit.CaretXY;
p2.X := Length(result);
result := piSynEdit.TextBetweenPoints[p1,p2];
piSynEdit.CaretXY := PointAtual;;
......@@ -1424,6 +1440,10 @@ begin
else
begin
result := lTextAfterWord;
if Trim(lTextAfterWord) = Trim(result) then
begin
lTemPalavra := false;
end;
if IsExepressaoValida(OpEve,trim(lTextAfterWord),lTemPalavra) then
begin
result := '';
......@@ -1431,9 +1451,16 @@ begin
end;
end
else if trim(lTextAfterWord) = '' then
begin
if IsExepressaoValida(opEve,trim(Result)) then
begin
result := '';
end
else
begin
result := result + lTextAfterWord;
end;
end;
end
else if (lTextAfterWord <> '') then
begin
......@@ -1689,16 +1716,16 @@ begin
lFromSec := fhlt1.AddSection(__FROM);
lWhereSec := fhlt1.AddSection(__WHERE);
fopEvenSearchSelect := fhlt1.AddOpenEvent('identifier','',fil_None);
fopEvenSearchSelect.Action := pac_Rep_LastTok;
fopEvenSearchSelect := fhlt1.AddOpenEvent('identifier','',fil_LastIdentPart);
//fopEvenSearchSelect.Action := pac_Rep_LastTok;
fopEvenSearchSelect.block := lSelectSec;
fopEvenSearchFrom := fhlt1.AddOpenEvent('identifier','',fil_None);
fopEvenSearchFrom.Action := pac_Rep_LastTok;
fopEvenSearchFrom := fhlt1.AddOpenEvent('identifier','',fil_LastIdentPart);
//fopEvenSearchFrom.Action := pac_Rep_LastTok;
fopEvenSearchFrom.block := lFromSec;
fopEvenSearchWhere := fhlt1.AddOpenEvent('identifier','',fil_None);
fopEvenSearchWhere.Action := pac_Rep_LastTok;
fopEvenSearchWhere := fhlt1.AddOpenEvent('identifier','',fil_LastIdentPart);
//fopEvenSearchWhere.Action := pac_Rep_LastTok;
fopEvenSearchWhere.block := lWhereSec;
fopEvenSelectAposPonto := fhlt1.AddOpenEvent('identifier,''.''','',fil_None);
......@@ -1714,15 +1741,15 @@ begin
fopEvenWhereAposPonto.block := lWhereSec;
fopEvenSelectCompleto := fhlt1.AddOpenEvent('','',fil_None);
fopEvenselectCompleto.Action := pac_Insert;
fopEvenselectCompleto.Action := pac_Insert;;
fopEvenSelectCompleto.block := lSelectSec;
fopEvenFromCompleto := fhlt1.AddOpenEvent('','',fil_None);
fopEvenFromCompleto.Action := pac_Insert;
fopEvenFromCompleto.Action := pac_Insert;;
fopEvenFromCompleto.block := lFromSec;
fopEvenWhereCompleto := fhlt1.AddOpenEvent('','',fil_None);
fopEvenWhereCompleto.Action := pac_Insert ;
fopEvenWhereCompleto.Action := pac_Insert;;
fopEvenWhereCompleto.block := lWhereSec;
fopEvenFromAposPonto.OnLoadItems :=opEveLoadItems;
......@@ -1731,6 +1758,7 @@ begin
fopEvenselectCompleto.OnLoadItems :=opEveLoadItems;
fopEvenFromCompleto.OnLoadItems :=opEveLoadItems;
fopEvenWhereCompleto.OnLoadItems :=opEveLoadItems;
fopEvenSearchSelect.OnLoadItems :=opEveLoadItems;
fopEvenSearchFrom.OnLoadItems :=opEveLoadItems;
fopEvenSearchWhere.OnLoadItems :=opEveLoadItems;
......@@ -1763,15 +1791,25 @@ begin
begin
if (opEve = fopEvenSelectAposPonto) or
(opEve = fopEvenWhereAposPonto) or
(opEve = fopEvenFromAposPonto)
(opEve = fopEvenFromAposPonto) or
(opEve = fopEvenWhereCompleto) or
(opEve = fopEvenSearchWhere) or
(opEve = fopEvenSearchSelect) or
(opEve = fopEvenselectCompleto)
then
begin
LoadAliasOQLEdit(SynEditOQL.Text,fAlias);
if opEve = fopEvenWhereAposPonto then
if (opEve = fopEvenWhereCompleto) or
(opEve = fopEvenSearchWhere) or
(opEve = fopEvenWhereAposPonto)
then
begin
lAceitaAtributo := true;
end
else if opEve = fopEvenSelectAposPonto then
else if (opEve = fopEvenSelectAposPonto) or
(opEve = fopEvenSearchSelect) or
(opEve = fopEvenselectCompleto)
then
begin
if XMLQuery.Checked then
begin
......@@ -1783,6 +1821,10 @@ begin
try
lLinha := RetirarPalavraChaveOLQ(SynEditOQL,opEve);
LoadListCompletion(lLinha,lAceitaAtributo,lLista);
if lLista.Count > 0 then
begin
opEve.AddAvail('');
end;
for li := 0 to lLista.Count - 1 do
begin
opEve.AddAvail(lLista.Strings[li]);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment