Hola Hector.
No puedo hacer pruebas como para darte una respuesta mas precisa. busqué el documento al que haces referencia y encontré un texto pero entiendo que 'el truco' de llamar a .last es solo para poder utilizar la propiedad RecordCount.
en el ejemplo que enviaste no veo que estés usando esa propiedad, ¿tenés dudas sobre el funcionamiento del select?
Creo que si tenés necesidad de ejecutar el método last deberías hacerlo así
fdm.SQLQuery1.Last();
si yo tuviese que la necesidad de saber la cantidad de registros de un query setearía la propiedad .PacketRecords' en -1 tal como se indica en el documento.
Lamento disponer de un lazarus para hacer pruebas.
saludos cordiales, es un gusto leerte otra vez.
http://wiki.freepascal.org/SqlDBHowto
Why does TSQLQuery.RecordCount always return 10?
To count the records in a dataset, use '.RecordCount'. However, notice that '.RecordCount' shows the number of records that is already loaded from the server. For performance reasons, SqlDB does not read all records when opening TSQLQuery by default, only the first 10. Only when the eleventh record is accessed will the next set of 10 records be loaded, etc. Using '.Last', all records will be loaded.
When you want to know the real number of records on the server you can first call '.Last' and then call '.RecordCount'.
An alternative is available. The number of records returned by the server is set by the '.PacketRecords' property. The default value is 10; if you make it -1 then all records will be current stable FPC, '.RecordCount' does not take filters into account, i.e. it shows the unfiltered total.
If you need the exact number of records, it often is a better idea to directly query the number of records in a query using another SQL query, but you would have to do that in the same transaction, as other transactions may have changed the number of records in the meanwhile.
El 4 de noviembre de 2016, 7:20, hfiandor via Lazarus-es <
lazarus-es en lists.lazarus-ide.org> wrote 77 lines
Amigos listeros:
En el documento SQLdb How to do se explica por qué solamente se leen los
primeros 10 registros al ejecutar una consulta y brinda una solución para
que lea todos los registros.
Tengo una aplicación donde hago lo siguiente:
begin
fdm.SQLQuery1.Active := False;
fdm.dsSQLQuery1.DataSet:=fdm.tTemp2;
fdm.SQLite3Connection1.DatabaseName:=camino_BD + '\temp.db';
fdm.SQLQuery1.SQL.Text := 'SELECT * FROM Temp2 WHERE codNegSerAct =
:SelCodigoNegSerAct ORDER BY codNegSerAct';
fdm.SQLQuery1.Params.ParamByName('SelCodigoNegSerAct').AsString :=
SelNSA;
fdm.SQLQuery1.ExecSQL;
fdm.tTemp2.Last; //para que lea completo
if fdm.SQLQuery1.Active = False then fdm.SQLQuery1.Active := True
else begin end;
fEstadoCuenta_2.frDBDataSet2.DataSet := fdm.SQLQuery1;
fEstadoCuenta_2.frReport2.LoadFromFile(camino_actual+'\
plantillas\Extendida_2.lrf');
fEstadoCuenta_2.frReport2.ShowReport;
fdm.SQLQuery1.Close;
fdm.SQLTransaction1.Active := False;
fdm.SQLite3Connection1.Connected := False;
No tengo la certeza de haber escrito la instrucción fdm.tTemp2.Last;
//para que lea completo en el lugar correcto.
Agradecería que alguien me comentara al respecto y cualquier otra
sugerencia que deseen.
Saludos
Ing. Héctor F. Fiandor Rosario
_______________________________________________
Lazarus-es mailing list
Lazarus-es en lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus-es