Ticket #166 (new enhancement)

Opened 4 years ago

Last modified 4 years ago

QRandom Support

Reported by: enzo Owned by:
Priority: minor Milestone: 1.2
Component: Other Version: 1.0.0 RC1
Keywords: Random Cc:

Description (last modified by alex94040) (diff)

This patch include the possibility to get data in random order.

I based on zcodo change at  http://code.google.com/p/zcodo/source/browse/trunk/wwwroot/includes/qcodo/_core/framework/QQuery.class.php?spec=svn52&r=52

Thread discussing this:  http://qcu.be/content/how-do-i-create-random-output-query#comment-790

Just remember order random in big tables could be a bad idea.

Attachments

QQuery-Random.patch Download (1.1 KB) - added by enzo 4 years ago.

Change History

Changed 4 years ago by enzo

Changed 4 years ago by alex94040

  • priority changed from important to minor
  • status changed from new to in_QA
  • milestone changed from 1.0.0 RC2 to 1.1.0

No new features can be added to the 1.0 branch now. This is a cool enhancement - thanks for the contribution - but it'll have to wait until 1.1.

Changed 4 years ago by alex94040

Question: is the RAND() function supported by every single database adapter? I don't want to introduce QQuery components that are database vendor-specific.

Changed 4 years ago by agsel

RAND() is basically used only in MySQL. You can check  http://www.petefreitag.com/item/466.cfm for random usage in different databases. Though the site has examples for ordering by random, it still gives you the idea.

Changed 4 years ago by alex94040

  • description modified (diff)

Since this is MySQL-specific, this cannot go into QQuery. MySQL users will have to write manual SQL statement queries to do this. Unless there's a vendor-independent way to do this, I will be closing this bug as a "won't fix".

Changed 4 years ago by VexedPanda

  • status changed from in_QA to assigned

I think the line is more "can other DBs do the same thing", not "do they use the same syntax". Our database abstraction layer should be able to handle it the same way the limit clause is handled.

This is significantly more work, but seems like a valid improvement to me.

Changed 4 years ago by VexedPanda

  • owner somebody deleted
  • status changed from assigned to new

Changed 4 years ago by MikeHostetler

  • milestone changed from 1.1 to 1.2
Note: See TracTickets for help on using tickets.