Jump to content
Sign in to follow this  
Jim1

ODBC LIMIT command. Limit returned rows

Recommended Posts

This does not seem to work for me. Does anyone know where I should place the limit property so that I can control how many results are returned?

Here is a (basic) MySQL example:

"Select 'fieldname' FROM table LIMIT 0,10"

This brings back the first 10 records it finds. This causes an error when trying this query with PHP and FileMaker via ODBC.

Error is as follows:

SQL error: [DataDirect][ODBC SequeLink driver][ODBC Socket][DataDirect][ODBC FileMaker driver][FileMaker]Parse Error in SQL, SQL state S1000 in SQLExecDirect

Thanks in advance,

Jim.

Share this post


Link to post
Share on other sites

Though it seems to be an indispensable feature, you cannot do this in FileMaker ODBC/JDBC, currently.

Please submit a feature request.

http://www.filemaker.com/company/feature_request.html

--

If FileMaker PHP API or FX.php can be your platform, they have corresponding feature, I think.

Share this post


Link to post
Share on other sites

Do you know this for sure?

I cannot believe that this was not included in the ODBC specification. I cannot use FX.php in this instance as I have AND and OR requests in the query. Thanks for your rapid response.

Jim.

Share this post


Link to post
Share on other sites

I cannot use FX.php in this instance as I have AND and OR requests in the query

... Why not? You just generate multiple find requests.

Share this post


Link to post
Share on other sites

Thanks again for your reply.

How to do a multiple find requests in FX.php then? (With the following as an example).

SQL ~ SELECT * FROM TABLE1 WHERE (Field1='1' OR Field1='2' OR Field1='5') AND (Field2='a' OR Field2='b' OR Field2='e')

How do I do the above example SQL request with FX.PHP?

$userQuery = new FX($serverIP, $webCompanionPort, $dataSourceType);

$userQuery->SetDBData ($HostDB, 'LayoutName');

$userQuery->SetDBUserPass('user', 'pass');

$userQuery->AddDBParam('Field1', '1');

$userQuery->AddDBParam('Field1', '2');

$userQuery->AddDBParam('Field1', '5');

$userQuery->AddDBParam('Field2', 'a');

$userQuery->AddDBParam('Field2', 'b');

$userQuery->AddDBParam('Field2', 'e');

$userQuery->AddDBParam('-lop', 'or');

$userData=$userQuery->FMFind();

The above FX.php would not give the same result as the SQL.

Thanks,

Jim.

Share this post


Link to post
Share on other sites

Oh right, because in this case it's searching or over any of the fields?

If there's a -lop or, surely there's a -lop and?

Share this post


Link to post
Share on other sites

That is correct, there is a -lop 'and'.

However FX.PHP uses one or the other. You cannot combine a "-lop 'and'" and a "-lop 'or'" in the same request.

Thanks,

Jim.

Share this post


Link to post
Share on other sites

Go ask this question at: www.fmwebschool.com/frm , you'll probably get a better response for Fx.php and FM API related questions there.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

By using this site, you agree to our Terms of Use.