ASPit - Totally ASP
 

Go Back   PHPit Forums > Community > TPG PHP Scripts > AutoCRUD for PHP
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Display Modes
Old 07-05-2006, 10:22 PM   #1
pjacobs
Junior Member
 
Join Date: Jul 2006
Posts: 1
Default trying to do a "real" join

Hey,

I have a suggestion, maybe you could make autocrud do a real join so when I make a relationship between tables I can filter criteria depending on data of a foreign field. I think it's a huge performance advantage.

Here's my scenario, just to give a bit of background on what I'm trying to do, and why I know It doesn't do what I want it to do.

I have a one to many relationship between two tables. The first is a table called companies, which is a list of companies. In relation to said table, there is a table of addresses. Each company can have many addresses. I would like to be able to do a query listing every company in a certain location. So maybe every company in the state of Texas.

I try:
$autoCrud->Address->where = "state = 'tx'";
$autoCrud->Company->orderBy = 'AlphaSort';

OR

$autoCrud->Company->where = "Address.state = 'tx'";
$autoCrud->Company->orderBy = 'AlphaSort';

$results = $autoCrud->Company->select();
print_r($results);

The results in the first come through with no filtering for the address criteria. The second one comes in an error since there is no "real" join, which ouputs the query. I understand that I could do two sperate queries, but truthfully, the performance hit dosn't compensate for my use of this library in a production enviornment.

Oh, and the same issue happens when you want to paginate. I would really stick to defining limit. Maybe extend the application with pagination at a later date. All in all good work mate, please let me know if you come up with a fix
pjacobs is offline   Reply With Quote
Old 07-12-2006, 01:58 PM   #2
Dennis Pallett
Administrator
 
Dennis Pallett's Avatar
 
Join Date: Nov 2005
Posts: 243
Default

Unfortunately it's not (yet) possible to use fields from the other table in the WHERE clause, because it's not a real join, like you say. I'm hoping the next version will solve this problem (it's annoyed me as well).
__________________
Dennis Pallett
Dennis Pallett is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT. The time now is 09:46 AM.


Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2006, Jelsoft Enterprises Ltd.