Subject | Re: [firebird-support] Index for query |
---|---|
Author | Claudio Romero |
Post date | 2011-02-22T19:56:20Z |
You right
but I need this query with index
SELECT * FROM table where integer_field like '21095%'
because I use this in a function (Lazarus program) that support integer and
varchar fields.
Here the full function
function GeneraSentenciaSql(Tabla,FiltroFijo,filtro,valor:string):string;
var consulta:string;
begin
valor:=UpperCase(valor);
consulta:='select * from '+Tabla+' ';
if FiltroFijo<>'' then begin
consulta:=consulta+'where '+FiltroFijo+' ';
if (filtro<>'')and(valor<>'') then consulta:=consulta+'and
'+filtro+' like '+valor;
end
else if (filtro<>'')and(valor<>'') then consulta:=consulta+'where
'+filtro+' like '+valor;
if filtro<>'' then consulta:=consulta+' order by '+filtro;
//showmessage(consulta);
result:=consulta;
end;
Otherwise, I must include the data field as parameter of this funcion.
Regards
[Non-text portions of this message have been removed]
but I need this query with index
SELECT * FROM table where integer_field like '21095%'
because I use this in a function (Lazarus program) that support integer and
varchar fields.
Here the full function
function GeneraSentenciaSql(Tabla,FiltroFijo,filtro,valor:string):string;
var consulta:string;
begin
valor:=UpperCase(valor);
consulta:='select * from '+Tabla+' ';
if FiltroFijo<>'' then begin
consulta:=consulta+'where '+FiltroFijo+' ';
if (filtro<>'')and(valor<>'') then consulta:=consulta+'and
'+filtro+' like '+valor;
end
else if (filtro<>'')and(valor<>'') then consulta:=consulta+'where
'+filtro+' like '+valor;
if filtro<>'' then consulta:=consulta+' order by '+filtro;
//showmessage(consulta);
result:=consulta;
end;
Otherwise, I must include the data field as parameter of this funcion.
Regards
[Non-text portions of this message have been removed]