Re: RE : [fpc-pascal] sqldb how to find a record fast with primary key

2011-10-21 Thread Michael Van Canneyt
On Fri, 21 Oct 2011, Felipe Monteiro de Carvalho wrote: On Fri, Oct 21, 2011 at 5:22 PM, Ludo Brands wrote: You can use indices and locate with TSQLQuery as follows:  SQLQuery1.AddIndex('idx_no_art','no_art',[]);  SQLQuery1.IndexName:='idx_no_art';  SQLQuery1.Open;  ...  SQLQuery1.Locate('no

RE : [fpc-pascal] sqldb how to find a record fast with primary key

2011-10-21 Thread Ludo Brands
> Can't you do the lookup in the DB server by a SQL join for example? > Or, if you need do some processing in between, use 2 queries and build the "where" clause for the 2nd from the results of the 1st. If you don't need the full table, don't use select *. Ludo

Re: [fpc-pascal] sqldb how to find a record fast with primary key

2011-10-21 Thread Martin Schreiber
On Friday 21 October 2011 17.41:56 Felipe Monteiro de Carvalho wrote: > I get the value of the primary key of the table from the request, so I > though that because it is the primary key I would be able to quickly > jump to it. But it seams that not? From what I understood the > solutions are first

Re: RE : [fpc-pascal] sqldb how to find a record fast with primary key

2011-10-21 Thread Felipe Monteiro de Carvalho
On Fri, Oct 21, 2011 at 5:22 PM, Ludo Brands wrote: > You can use indices and locate with TSQLQuery as follows: >  SQLQuery1.AddIndex('idx_no_art','no_art',[]); >  SQLQuery1.IndexName:='idx_no_art'; >  SQLQuery1.Open; >  ... >  SQLQuery1.Locate('no_art','200295',[]); Thanks, that's really interre

RE : [fpc-pascal] sqldb how to find a record fast with primary key

2011-10-21 Thread Ludo Brands
> > > > No sqldb specific answers on this one? I did some googling and also > > searched for TPrimaryKey or LocalIndex in sqldb without > results ... =( > > To my knowledge there is no fast search/locate in sqldb. > Maybe we should have a look at Martin Schreibers' implementation. > > Michael.

Re: [fpc-pascal] sqldb how to find a record fast with primary key

2011-10-21 Thread Martin Schreiber
On Friday 21 October 2011 16.50:32 Felipe Monteiro de Carvalho wrote: > On Fri, Oct 21, 2011 at 4:50 PM, Martin Schreiber wrote: > > Most code is in lib/common/db/msebufdataset.pas. Lookup buffers are in > > lib/common/db/mselookupbuffer.pas. Heavy stuff. ;-) > > How much from the other stuff wo

Re: [fpc-pascal] sqldb how to find a record fast with primary key

2011-10-21 Thread michael . vancanneyt
On Fri, 21 Oct 2011, Martin Schreiber wrote: On Friday 21 October 2011 16.30:18 michael.vancann...@wisa.be wrote: On Fri, 21 Oct 2011, Felipe Monteiro de Carvalho wrote: Ping, No sqldb specific answers on this one? I did some googling and also searched for TPrimaryKey or LocalIndex in sqldb

Re: [fpc-pascal] sqldb how to find a record fast with primary key

2011-10-21 Thread Felipe Monteiro de Carvalho
On Fri, Oct 21, 2011 at 4:50 PM, Martin Schreiber wrote: > Most code is in lib/common/db/msebufdataset.pas. Lookup buffers are in > lib/common/db/mselookupbuffer.pas. Heavy stuff. ;-) How much from the other stuff would I need to compile your DB modules? Any beginner guides to stablish a connect

Re: [fpc-pascal] sqldb how to find a record fast with primary key

2011-10-21 Thread Martin Schreiber
On Friday 21 October 2011 16.30:18 michael.vancann...@wisa.be wrote: > On Fri, 21 Oct 2011, Felipe Monteiro de Carvalho wrote: > > Ping, > > > > No sqldb specific answers on this one? I did some googling and also > > searched for TPrimaryKey or LocalIndex in sqldb without results ... =( > > To my

Re: [fpc-pascal] sqldb how to find a record fast with primary key

2011-10-21 Thread michael . vancanneyt
On Fri, 21 Oct 2011, Felipe Monteiro de Carvalho wrote: Ping, No sqldb specific answers on this one? I did some googling and also searched for TPrimaryKey or LocalIndex in sqldb without results ... =( To my knowledge there is no fast search/locate in sqldb. Maybe we should have a look at Ma

Re: [fpc-pascal] sqldb how to find a record fast with primary key

2011-10-21 Thread Felipe Monteiro de Carvalho
Ping, No sqldb specific answers on this one? I did some googling and also searched for TPrimaryKey or LocalIndex in sqldb without results ... =( thanks, -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://l

Re: [fpc-pascal] sqldb how to find a record fast with primary key

2011-10-19 Thread Martin Schreiber
On Wednesday 19 October 2011 16.53:00 Felipe Monteiro de Carvalho wrote: > Hello, > > I am using sqldb to connect to a postgres database. Using wiki > instructions, my final object is a TSQLQuery for each table. So, this > basically is a TDataset and to read fields I know that I can use > First(),

[fpc-pascal] sqldb how to find a record fast with primary key

2011-10-19 Thread Felipe Monteiro de Carvalho
Hello, I am using sqldb to connect to a postgres database. Using wiki instructions, my final object is a TSQLQuery for each table. So, this basically is a TDataset and to read fields I know that I can use First(), Next(), EOF() and RecNo But these are rather slow. Many fields in the tables refer