Re: [PHP] I need do paging in php, I use ODBC Access

2005-04-24 Thread Jochem Maas
Richard Lynch wrote:
On Fri, April 22, 2005 7:31 am, Matthew Weier O'Phinney said:
Actually, LIMIT is in ANSI SQL.

Either the ANSI standard changed, or Rasmus needs to update his Bio...
http://lerdorf.com/bio.php
"...he can be blamed for the ANSI92 SQL-defying LIMIT clause in mSQL 1.x
which has now, at least conceptually, crept into both MySQL and
PostgreSQL."
I stand corrected (twice), apologies to Rasmus.
But, hey, I'm not gonna actually READ the ANSI standard to find out -- I'd
rather worry about what actually *WORKS* than what the SQL standard is,
which, sadly, is seldom easily reconciled with Real-Life (tm).
with you there :-)

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] I need do paging in php, I use ODBC Access

2005-04-22 Thread Richard Lynch
On Fri, April 22, 2005 7:31 am, Matthew Weier O'Phinney said:
> Actually, LIMIT is in ANSI SQL.

Either the ANSI standard changed, or Rasmus needs to update his Bio...

http://lerdorf.com/bio.php

"...he can be blamed for the ANSI92 SQL-defying LIMIT clause in mSQL 1.x
which has now, at least conceptually, crept into both MySQL and
PostgreSQL."

But, hey, I'm not gonna actually READ the ANSI standard to find out -- I'd
rather worry about what actually *WORKS* than what the SQL standard is,
which, sadly, is seldom easily reconciled with Real-Life (tm).

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] I need do paging in php, I use ODBC Access

2005-04-22 Thread Matthew Weier O'Phinney
* Jochem Maas <[EMAIL PROTECTED]> :
> Richard Lynch wrote:
> > On Thu, April 21, 2005 12:23 pm, Warren Vail said:
> > 
> > > The only approach left that I could come up with is to transfer the
> > > entire sequence set to your application, and count the rows, perhaps
> > > only displaying the rows you want to show.  This is obviously not very
> > > efficient (in fact, with enough rows it may prove impossible because of
> > > memory limitations), but it will produce what appears to be a paged
> > > result.
> > 
> > If this is the best answer your database software will let you come up
> > with, it's time to switch databases :-)
> > 
> > Fortunately, the databases that don't do "LIMIT" have this nifty thing
>
> I was under the impression that LIMIT was mySQL specific (although its
> quite likely that their use of the keyword and the ubiqitous nature of mySQL
> that other vendors have also adopted it.

Actually, LIMIT is in ANSI SQL.

-- 
Matthew Weier O'Phinney   | WEBSITES:
Webmaster and IT Specialist   | http://www.garden.org
National Gardening Association| http://www.kidsgardening.com
802-863-5251 x156 | http://nationalgardenmonth.org
mailto:[EMAIL PROTECTED] | http://vermontbotanical.org

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] I need do paging in php, I use ODBC Access

2005-04-22 Thread Jochem Maas
Richard Lynch wrote:
On Thu, April 21, 2005 12:23 pm, Warren Vail said:
The only approach left that I could come up with is to transfer the
entire sequence set to your application, and count the rows, perhaps
only displaying the rows you want to show.  This is obviously not very
efficient (in fact, with enough rows it may prove impossible because of
memory limitations), but it will produce what appears to be a paged
result.

If this is the best answer your database software will let you come up
with, it's time to switch databases :-)
Fortunately, the databases that don't do "LIMIT" have this nifty thing
I was under the impression that LIMIT was mySQL specific (although its
quite likely that their use of the keyword and the ubiqitous nature of mySQL
that other vendors have also adopted it.
anyway, many other DBs do implement an alternative in the form of FIRST, SKIP
keywords which effectively does the same as the LIMIT clause. (AFAICR
FIRST/SKIP is part of the SQL std)
called "CURSOR" which lets you kind of do the same thing.
At least, all the databases I know of.
Maybe something really stupid and broken like MS Access or something that
doesn't even claim to do SQL like, e, FileMaker???
Even there, I'll bet there's some better answer than pulling all the rows
down just to display a tiny fraction of them.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] I need do paging in php, I use ODBC Access

2005-04-22 Thread Richard Lynch
On Thu, April 21, 2005 12:23 pm, Warren Vail said:
> The only approach left that I could come up with is to transfer the
> entire sequence set to your application, and count the rows, perhaps
> only displaying the rows you want to show.  This is obviously not very
> efficient (in fact, with enough rows it may prove impossible because of
> memory limitations), but it will produce what appears to be a paged
> result.

If this is the best answer your database software will let you come up
with, it's time to switch databases :-)

Fortunately, the databases that don't do "LIMIT" have this nifty thing
called "CURSOR" which lets you kind of do the same thing.

At least, all the databases I know of.

Maybe something really stupid and broken like MS Access or something that
doesn't even claim to do SQL like, e, FileMaker???

Even there, I'll bet there's some better answer than pulling all the rows
down just to display a tiny fraction of them.

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] I need do paging in php, I use ODBC Access

2005-04-22 Thread Richard Lynch
On Thu, April 21, 2005 2:02 pm, chris said:
> You are right about MSSQL not having a limit, but here is an article that
> shows a work around
> http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=850&lngWId=5

Just use a cursor.

It's not that tricky.

Honest.

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] I need do paging in php, I use ODBC Access

2005-04-21 Thread chris
You are right about MSSQL not having a limit, but here is an article that 
shows a work around
http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=850&lngWId=5


"Warren Vail" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
>> Somebody did paging in php for data origin in ODBC Access?
>>
>> I need an algorithm for doing this, please Help me!
>
> I assume by "paging" you are referring to a scrolling algorithm that
> allows you to view only a small portion of your query result set.  The
> algorithm that comes to mind is dependent on the database that ODBC is
> connected to.
>
> If the database is MySQL, the query that would allow do this is the SQL
> LIMIT clause, where executing and re-executing the query will return
> only a portion of the sequence set produced by the query;
>
> $query = "SELECT ".$columnlist
>." from my_table where col1 = \"sold\" order by order_date "
>."LIMIT ".sprintf("%01d",$rowno).", 10 ";
>
> If $rowno = 0 the query will return the first 10 rows
> If you add 10 to $rowno and re-execute the query, it will return the
> second set of 10 rows
> And so on.
>
> I have used ODBC to access Microsoft SQL Server and DB2 Databases, and I
> believe neither support the SQL LIMIT clause, although I am not as
> certain about my memory of MSS as DB2.  Someone will correct me if I am
> wrong.
>
> The only approach left that I could come up with is to transfer the
> entire sequence set to your application, and count the rows, perhaps
> only displaying the rows you want to show.  This is obviously not very
> efficient (in fact, with enough rows it may prove impossible because of
> memory limitations), but it will produce what appears to be a paged
> result.
>
> HTH,
>
> Warren Vail 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] I need do paging in php, I use ODBC Access

2005-04-21 Thread Warren Vail
> Somebody did paging in php for data origin in ODBC Access?
> 
> I need an algorithm for doing this, please Help me!

I assume by "paging" you are referring to a scrolling algorithm that
allows you to view only a small portion of your query result set.  The
algorithm that comes to mind is dependent on the database that ODBC is
connected to.

If the database is MySQL, the query that would allow do this is the SQL
LIMIT clause, where executing and re-executing the query will return
only a portion of the sequence set produced by the query;

$query = "SELECT ".$columnlist
." from my_table where col1 = \"sold\" order by order_date "
."LIMIT ".sprintf("%01d",$rowno).", 10 ";

If $rowno = 0 the query will return the first 10 rows
If you add 10 to $rowno and re-execute the query, it will return the
second set of 10 rows
And so on.

I have used ODBC to access Microsoft SQL Server and DB2 Databases, and I
believe neither support the SQL LIMIT clause, although I am not as
certain about my memory of MSS as DB2.  Someone will correct me if I am
wrong.

The only approach left that I could come up with is to transfer the
entire sequence set to your application, and count the rows, perhaps
only displaying the rows you want to show.  This is obviously not very
efficient (in fact, with enough rows it may prove impossible because of
memory limitations), but it will produce what appears to be a paged
result.

HTH,

Warren Vail

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] I need do paging in php, I use ODBC Access

2005-04-21 Thread Tomás Rodriguez Orta
Dear Friends.

Somebody did paging in php for data origin in ODBC Access?

I need an algorithm for doing this, please Help me!

Ok?

TOMAS


-
Este correo fue escaneado en busca de virus con el MDaemon Antivirus 2.27
en el dominio de correo angerona.cult.cu  y no se encontro ninguna coincidencia.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php