Add XDB::formatCustomOrder (to create a custom order in an SQL query)
authorRaphaël Barrois <raphael.barrois@polytechnique.org>
Tue, 16 Feb 2010 10:33:00 +0000 (11:33 +0100)
committerRaphaël Barrois <raphael.barrois@polytechnique.org>
Tue, 16 Feb 2010 10:33:00 +0000 (11:33 +0100)
Signed-off-by: Raphaël Barrois <raphael.barrois@polytechnique.org>
classes/xdb.php

index 829941c..1df0fff 100644 (file)
@@ -181,6 +181,12 @@ class XDB
         }
     }
 
+    // Returns a FIELD(blah, 3, 1, 2) for use in an order with custom orders
+    public static function formatCustomOrder($field, $values)
+    {
+        return 'FIELD( ' . $field . ', ' . XDB::formatArray($values) . ')';
+    }
+
     public static function execute()
     {
         global $globals;