@@ 1000-1011 (lines=12) @@ | ||
997 | * @param boolean $desc default false |
|
998 | * @return string case field when ... then ... end |
|
999 | */ |
|
1000 | function smf_db_custom_order($field, $array_values, $desc = false) |
|
1001 | { |
|
1002 | $return = 'CASE '. $field . ' '; |
|
1003 | $count = count($array_values); |
|
1004 | $then = ($desc ? ' THEN -' : ' THEN '); |
|
1005 | ||
1006 | for ($i = 0; $i < $count; $i++) |
|
1007 | $return .= 'WHEN ' . (int) $array_values[$i] . $then . $i . ' '; |
|
1008 | ||
1009 | $return .= 'END'; |
|
1010 | return $return; |
|
1011 | } |
|
1012 | ||
1013 | ?> |
@@ 992-1003 (lines=12) @@ | ||
989 | * @param boolean $desc default false |
|
990 | * @return string case field when ... then ... end |
|
991 | */ |
|
992 | function smf_db_custom_order($field, $array_values, $desc = false) |
|
993 | { |
|
994 | $return = 'CASE '. $field . ' '; |
|
995 | $count = count($array_values); |
|
996 | $then = ($desc ? ' THEN -' : ' THEN '); |
|
997 | ||
998 | for ($i = 0; $i < $count; $i++) |
|
999 | $return .= 'WHEN ' . (int) $array_values[$i] . $then . $i . ' '; |
|
1000 | ||
1001 | $return .= 'END'; |
|
1002 | return $return; |
|
1003 | } |
|
1004 | ||
1005 | /** |
|
1006 | * Function which return the information if the database supports native replace inserts |