| @@ 1021-1032 (lines=12) @@ | ||
| 1018 | * @param boolean $desc default false |
|
| 1019 | * @return string case field when ... then ... end |
|
| 1020 | */ |
|
| 1021 | function smf_db_custom_order($field, $array_values, $desc = false) |
|
| 1022 | { |
|
| 1023 | $return = 'CASE '. $field . ' '; |
|
| 1024 | $count = count($array_values); |
|
| 1025 | $then = ($desc ? ' THEN -' : ' THEN '); |
|
| 1026 | ||
| 1027 | for ($i = 0; $i < $count; $i++) |
|
| 1028 | $return .= 'WHEN ' . (int) $array_values[$i] . $then . $i . ' '; |
|
| 1029 | ||
| 1030 | $return .= 'END'; |
|
| 1031 | return $return; |
|
| 1032 | } |
|
| 1033 | ||
| 1034 | /** |
|
| 1035 | * Function which return the information if the database supports native replace inserts |
|
| @@ 935-946 (lines=12) @@ | ||
| 932 | * @param boolean $desc default false |
|
| 933 | * @return string case field when ... then ... end |
|
| 934 | */ |
|
| 935 | function smf_db_custom_order($field, $array_values, $desc = false) |
|
| 936 | { |
|
| 937 | $return = 'CASE '. $field . ' '; |
|
| 938 | $count = count($array_values); |
|
| 939 | $then = ($desc ? ' THEN -' : ' THEN '); |
|
| 940 | ||
| 941 | for ($i = 0; $i < $count; $i++) |
|
| 942 | $return .= 'WHEN ' . (int) $array_values[$i] . $then . $i . ' '; |
|
| 943 | ||
| 944 | $return .= 'END'; |
|
| 945 | return $return; |
|
| 946 | } |
|
| 947 | ||
| 948 | /** |
|
| 949 | * Function which return the information if the database supports native replace inserts |
|