Watch, Follow, &
Connect with Us

Please visit our new home
community.embarcadero.com.

Public Report
Report From: Delphi for PHP/Library    [ Add a report in this area ]  
Report #:  111805   Status: Need Feedback
The Database Component and the SQL "LIMIT" Clause
Project:  HTML5 Builder Build #:  5.1.167.137
Version:    5.0 Submitted By:   Michael Ainsworth
Report Type:  Crash / Data loss / Total failure Date Reported:  1/8/2013 3:17:07 PM
Severity:    Critical / Show Stopper Last Updated: 1/9/2013 9:22:32 PM
Platform:    All platforms Internal Tracking #:  
Resolution: Need More Info (Resolution Comments) Resolved in Build: : None
Duplicate of:  None
Voting and Rating
Overall Rating: No Ratings Yet
0.00 out of 5
Total Votes: None
Description
The Database component automatically creates and appends a "LIMIT" clause to SQL queries. This limit clause follows the MySQL convention "LIMIT X, Y" and does not work with PostgreSQL.
I've modified the PHP script to generate "LIMIT X OFFSET Y" code for compatibility with PostgreSQL.

Two suggested solutions that you could implement:

1. Firstly, have a flag that generates the appropriate syntax depending on if you're using MySQL, PostgreSQL, MSSQL, etc.
2. Perhaps more appropriately, forget the auto-creation of the LIMIT clause. If the programmer wants it, they'll specify it.

This is listed as "Critical / Show Stopper" because non-MySQL queries may simply not work, with the Query component returning an SQL syntax error.
Steps to Reproduce:
None
Workarounds
None
Attachment
None
Comments

Tomohiro Takahashi at 1/9/2013 9:23:52 PM -
> I've modified the PHP script to generate "LIMIT X OFFSET Y" code for compatibility with PostgreSQL.
Could you tell us more detail about your fix(e.g., php file name, line number etc...)?

Server Response from: ETNACODE01