You are here: Re: How to use SQL "LIMIT" keyword against an MDB file « PHP Programming Language « IT news, forums, messages
Re: How to use SQL "LIMIT" keyword against an MDB file

Posted by Steve on 09/28/09 12:01

"Ivan Marsh" <annoyed@you.now> wrote in message
news:pan.2008.01.28.22.40.54.715306@you.now...
> On Mon, 28 Jan 2008 16:09:32 -0600, Steve wrote:
>
>
>> "Ivan Marsh" <annoyed@you.now> wrote in message
>> news:pan.2008.01.28.21.50.48.197643@you.now...
>>> On Mon, 28 Jan 2008 14:37:03 -0700, Martin wrote:
>>>
>>>> I'm trying to adapt a PHP script that was written to use MySQL, so
>>>> that it will work with an MSAccess MDB file.
>>>>
>>>> An important part of the script makes use of the SQL "LIMIT" keyword
>>>> available in MySQL. eg: "SELECT MyField FROM MyTable LIMIT 40,10" to
>>>> select 10 records beginning at the 41st record.
>>>>
>>>> Can anyone tell me how I can achieve this same functionality when
>>>> using ODBC functions to access an MDB file? I think I can set ROWCOUNT
>>>> (or possibly TOP) to retrieve only 10 records but how do I get it to
>>>> start at the 41st record?
>>>
>>> You just lost an enormous amount of functionality. I'm assuming this is
>>> something you had to do.
>>>
>>> Pull all of the records and then programatically strip out the records
>>> you don't want from the array.
>>
>> are you out of your fucking mind?!!!
>
> I assure you I'm not... though I don't claim to be Mr. Grand Wizard PHP
> Programmer Guy.
>
>> yeah, let me pull all the records from my 55 million rowed table into a
>> php array...
>
> Can you fit 55 million rows in an Access database that's less than 2 gigs?

let me assure you, if you pull even 2MB of data into an array just to
pseudo-query (i.e. removed unwanted data) then you're not using your tools
wisely. the only thing that should be returned from ANY db is *just* the
data you want...nothing more.

>> THEN strip out the unwanted ones from the array. hell, let's just put
>> the records into a text file and pull them from there...build our own
>> php query functionality for the file. while we're at it, we'll run our
>> lil 'query' in a loop. and, for good measure...
>
> You may very well have to do that. Like I said: You/He just lost an
> enormous amount of functionality.

why?

the answer is, no, we're using the functionality afforded by a db...i.e.
writting good queries. i fail to see how using php to kill off unwanted
records actually *adds* functionality.

>> you've got to be fucking kidding...right?!!!
>
> No... An Access MDB file would simply be the wrong tool for the job unless
> you're dealing with a very small dataset.

agreed. did i just misunderstand you? the functionality loss is the choice
of db's...not in your array advice? the two seemed to be one cohesive
thought...that's how i took it anyway.

> Without a LIMIT function you have to query for the matching records with
> odbc_exec and then eliminate the unwanted data from the result set or move
> the wanted data to a new array. I don't know of any way of doing it at
> query time... and while I was looking into it when I had to use a dBase
> file as a backend for a project it was apparent that no one else did
> either.
>
> If you have a run-time solution please share it with the group. I could
> sure use it.

you can surely mimic the functionality. the easiest way is to select into a
temp table where one of the columns is an auto-number...the query then
becomes WHERE blah BETWEEN x AND n.

there are several other ways to skin that cat however.

sorry if i misunderstood you.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация