Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
db query where() method argument order
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  5 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Adam Stephen Docherty  
View profile  
 More options Aug 9 2012, 3:46 pm
From: Adam Stephen Docherty <adam.doche...@gmail.com>
Date: Thu, 9 Aug 2012 12:46:14 -0700 (PDT)
Local: Thurs, Aug 9 2012 3:46 pm
Subject: db query where() method argument order

Would it not seem more readable to have the second argument as it currently stands:
$query->where( 'field.a = 1', 'OR' );
$query->where( 'field.b = 2' );

Changed to be the first argument:
$query->where( 'field.a = 1' );
$query->where( 'OR', 'field.b = 2' );

Also have it a *requirement to declare the operator in the first argument of a where() method following another. This seems to be more logical to me. Also when the sql in the first argument is long it can be easy to miss the addition of the operator override...


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Adam Stephen Docherty  
View profile  
 More options Aug 9 2012, 3:48 pm
From: Adam Stephen Docherty <adam.doche...@gmail.com>
Date: Thu, 9 Aug 2012 12:48:19 -0700 (PDT)
Local: Thurs, Aug 9 2012 3:48 pm
Subject: Re: db query where() method argument order

oh and I do realise that this kind of change would "break the world" so it
is probably not feasible at this time...


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
elin  
View profile  
 More options Aug 9 2012, 9:10 pm
From: elin <elin.war...@gmail.com>
Date: Thu, 9 Aug 2012 18:10:03 -0700 (PDT)
Local: Thurs, Aug 9 2012 9:10 pm
Subject: Re: db query where() method argument order

$query->where(array ('field.a = 1' ,'field.b = 2'), 'OR' );

is also an alternative.

No I don't think it's particularly more logical to have it first especially since it is optional both because sometimes you have only one condition and because sometimes you are using AND and just want to use the default. If you put it first you would have to deal with it all the time.

Elin


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Sam Moffatt  
View profile  
 More options Aug 11 2012, 10:13 pm
From: Sam Moffatt <pasa...@gmail.com>
Date: Sat, 11 Aug 2012 19:13:54 -0700
Local: Sat, Aug 11 2012 10:13 pm
Subject: Re: [jcms] Re: db query where() method argument order
I agree that having the operator there all of the time doesn't make
sense in addition to being something not particularly backwards
compatible friendly. In the vast majority of cases an AND statement as
a default makes sense. I do like where this is headed however as it
allows the same level of simplicity with have with a reasonably quick
way of overriding the glue on a per clause basis.

Cheers,

Sam Moffatt
http://pasamio.id.au


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
elin  
View profile  
 More options Aug 11 2012, 11:30 pm
From: elin <elin.war...@gmail.com>
Date: Sat, 11 Aug 2012 20:30:16 -0700 (PDT)
Local: Sat, Aug 11 2012 11:30 pm
Subject: Re: [jcms] Re: db query where() method argument order

We had quite a detailed discussion of WHERE glue in the git hub tracker
although nothing ever really came of it.

https://github.com/joomla/joomla-platform/pull/956

Elin


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »