osclass / Osclass

With Osclass, get your own classifieds site for free. Build your own Osclass installation and start advertising real estate, jobs or whatever you want- in minutes!
http://osclass.org/
648 stars 344 forks source link

DBCommandClass LIMIT and OFFSET clause issue #2236

Open istvanpatai opened 6 years ago

istvanpatai commented 6 years ago

Hi, There is an issue in the DBCommandClass.php between lines 1578-1582 in the sql SELECT query contructor function. The LIMIT clause arguments (limit and offset numeric values) are used in a wrong order in some cases. According to SQL documentation the LIMIT clause syntax can be defined in two ways:

Longer syntax

$sql = "SELECT * FROM Orders LIMIT 10 OFFSET 15";

Shorter syntax

$sql = "SELECT * FROM Orders LIMIT 15, 10";

When defining just the LIMIT argument, it's fine. But when there is also an OFFSET argument defined, basically the LIMIT and OFFSET arguments have to be swapped between each other.

Unfortunately this function is so basic and essential for the complete project that is questionable that does is worth fix it or we just can live with that? :)

Please let me know if I'm wrong or I just missed something.

Thanks, Istvan