Last modified: 2011-11-25 07:37:30 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T29646, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 27646 - Implement Database convie BETWEEN
Implement Database convie BETWEEN
Status: NEW
Product: MediaWiki
Classification: Unclassified
Database (Other open bugs)
unspecified
All All
: Normal enhancement (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-02-22 23:47 UTC by Sam Reed (reedy)
Modified: 2011-11-25 07:37 UTC (History)
2 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Sam Reed (reedy) 2011-02-22 23:47:57 UTC
array( 'colname' => array( 'BETWEEN', array( 1, 5 ) ) )

or

array( 'colname' => array( 'BETWEEN', 1, 5 ) ) maybe?

Would be applicable syntax... Or something. Similar to LEFT JOIN, I suppose

Shouldn't be too difficult, might poke it later...
Comment 1 Daniel Friesen 2011-02-23 00:13:28 UTC
We don't have any good support for the more common operators like != < > <= etc... besides inline sql, we should come up with proper support for those before we add BETWEEN.

Also, we can't support those syntaxes. 'colname' => array( [...] ) is already used to create a 'colname IN (...)'.

We'll need to come up with a new way of writing queries.

We could make a "real" query building object:

DBQuery::conds()
  ->column('colname')->eq($foo)
  ->column('colname')->in($arr)
  ->column('colname')->like("{0}%", $foo) // perhaps something better, but I didn't like the idea of a pile more buildLike-like stuff
  ->column('colname')->between(1,5)
  ->column('colname')->compare('>=', 3)

Then again, what I really want myself is abstraction that kills the need to depend heavily on database structure.
Comment 2 Sam Reed (reedy) 2011-02-23 00:18:31 UTC
(In reply to comment #1)
> We don't have any good support for the more common operators like != < > <=
> etc... besides inline sql, we should come up with proper support for those
> before we add BETWEEN.

Maybe that's a different bug to log? ;)

But you're right, it'd be nicer to be able to support the numerous "basic" operations
Comment 3 Krinkle 2011-09-17 01:54:02 UTC
There appears to be some movement lately that might open up an easy way to choose an implementation. The '!' (bang, not) operator is not supported by passing it in the column-key separated by a space.

> array( 'user_name !' => 'krinkle' )

That could be extended to allow something like this:

> array( 'colname BETWEEN' => array( 1, 5 );

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links