Ir al contenido principal.
Enlaces relacionados:  Prensa  Compañía  Clientes  Contáctenos
Solsoft

Foros

how can I fetch All records?


Autor Mensaje
Escrito en: 02. 06. 2004 [13:27]
ncesar@lunix.com.ar
Nicolas D. Cesar
Autor del tema
registrado desde: 31.12.1969
Entradas: 0
how can I fecth all records?

I've tried $db->query('$') [equivalent OLD isis_query('$') worked just fin=
e]

but in malete log says:
=2D--------
unexpected operator '$': No such file or directory
error in query '$' near pos 0: No such file or directory
got 0 in recv
=2D--------

is there a way to make this?=20
or I'll have to go from $db->read(0) to $db->read($last) ?
=2D-=20
Nicol=E1s D. C=E9sar <ncesar@lunix.com.ar>
Lunix [ Soluciones en GNU/Linux ] http://www.lunix.com.ar

------------------------------------------
Posted to Phorum via PhorumMail
Escrito en: 03. 06. 2004 [05:57]
paul@malete.org
Klaus Ripke
registrado desde: 31.12.1969
Entradas: 0
On Wednesday 02 June 2004 19:27, Nicolas D. Cesar wrote:
> how can I fecth all records?
>
> I've tried $db->query('$') [equivalent OLD isis_query('$') worked just
> fine]
this is kind of brute since (unless the special case is recognized)
it requires a vast amount of calculation.
Moreover it will (due to hitting internal limits)
not work correct on large indexes.

> is there a way to make this?
An empty query should do.
(Actually, with the optional recs parameter of function query
set to it's default true, this is '?').
Repeatedly call query with no parameter until it returns
no more records.

> or I'll have to go from $db->read(0) to $db->read($last) ?
This of course should also work.
To be as efficient as using an empty query,
you should pass an array of MFNs,
so you get a bunch of records per request.


cheers

------------------------------------------
Posted to Phorum via PhorumMail
Escrito en: 03. 06. 2004 [10:48]
ncesar@lunix.com.ar
Nicolas D. Cesar
Autor del tema
registrado desde: 31.12.1969
Entradas: 0
El Jueves 03 Junio 2004 06:57, Klaus Ripke escribi=F3:
> On Wednesday 02 June 2004 19:27, Nicolas D. Cesar wrote:
> > how can I fecth all records?
(..) query('$') discarded!
> > is there a way to make this?
>
> An empty query should do.
> (Actually, with the optional recs parameter of function query
> set to it's default true, this is '?').
> Repeatedly call query with no parameter until it returns
> no more records.

icon_frown.gif $recs =3D $db->query() returns an empty array...=20

malete server debugging:
=2D----------------
got 9 bytes
got tag -1
oStruct 'cepal.Q'
oDBo 'Q'
20 of 1 results off 1
got 0 in recv
=2D---------------

also tried $recs =3D $db->req("R",""); to do a 'long read'... with same res=
ult=20

returned value:
=2D--------------
isis_rec Object
(
[db] =3D> 0
[mfn] =3D> 0
[head] =3D> W
[tag] =3D> Array
(
)

[val] =3D> Array
(
)

[v] =3D>=20
)
=2D-------------

> > or I'll have to go from $db->read(0) to $db->read($last) ?
>
> This of course should also work.
> To be as efficient as using an empty query,

How can get the last MFN??

> you should pass an array of MFNs,
> so you get a bunch of records per request.
thanks for the tip.



=2D-=20
Nicol=E1s D. C=E9sar <ncesar@lunix.com.ar>
Lunix [ Soluciones en GNU/Linux ] http://www.lunix.com.ar
=20
Every name server needs to talk to a root name server ocassionally
It's a bit like a therapy: the name server needs to contact the root,
to regain its perspective on the world.
-- Paul Albitz & Cricket Liu
DNS and BIND, the O'Reilly book

------------------------------------------
Posted to Phorum via PhorumMail
Escrito en: 03. 06. 2004 [11:40]
paul@malete.org
Klaus Ripke
registrado desde: 31.12.1969
Entradas: 0
On Thursday 03 June 2004 16:48, Nicolas D. Cesar wrote:
> icon_frown.gif $recs =3D $db->query() returns an empty array...
right, this is a null query as opposed to an empty one.
see the note at function query in Isis/Db.php:
with $expr =3D null, fetch more results from previous query
so there better be a previous query with some results left.

However, I noticed there may be a bug that you may need
to use a blank query (' ') instead of an empty one ('').

> also tried $recs =3D $db->req("R",""); to do a 'long read'.
see the implementation of $db->read in Db.php

> How can get the last MFN??
hmmm ... good question icon_smile.gif

There is not yet a method for this;
maybe it will become a db option that can be
checked using the '=3D' operator ...

However, every query, including an empty or blank one,
will return a comment header including (an estimate of)
the number of records, which for a blank query,
is exactly the max mfn.


cheers

------------------------------------------
Posted to Phorum via PhorumMail



Iniciar sesión de usuario

Introduzca su nombre de usuario y contraseña para iniciar su sesión en el sitio web:
Iniciar sesión

¿Ha olvidado su contraseña?


Copyright © 2003-2009, Solsoft de Costa Rica S.A.
Declaración de privacidad