1 | <?php |
||
5 | class Operators { |
||
6 | CONST OPERATORS = array( |
||
7 | '>' => array( |
||
8 | 'format' => '> ?', |
||
9 | 'prepared' => true |
||
10 | ), |
||
11 | '>=' => array( |
||
12 | 'format' => '>= ?', |
||
13 | 'prepared' => true |
||
14 | ), |
||
15 | '<' => array( |
||
16 | 'format' => '< ?', |
||
17 | 'prepared' => true |
||
18 | ), |
||
19 | '<=' => array( |
||
20 | 'format' => '<= ?', |
||
21 | 'prepared' => true |
||
22 | ), |
||
23 | '!=' => array( |
||
24 | 'format' => '!= ?', |
||
25 | 'prepared' => true |
||
26 | ), |
||
27 | 'LIKE' => array( |
||
28 | 'format' => 'LIKE ?', |
||
29 | 'prepared' => true |
||
30 | ), |
||
31 | 'NOT LIKE' => array( |
||
32 | 'format' => 'NOT LIKE ?', |
||
33 | 'prepared' => true |
||
34 | ), |
||
35 | 'IN' => array( |
||
36 | 'format' => '%s ?', |
||
37 | 'prepared' => true |
||
38 | ), |
||
39 | 'NOT IN' => array( |
||
40 | 'format' => '%s ?', |
||
41 | 'prepared' => true |
||
42 | ), |
||
43 | 'BETWEEN' => array( |
||
44 | 'format' => 'BETWEEN ? AND ?', |
||
45 | 'prepared' => true |
||
46 | ), |
||
47 | 'NOT BETWEEN' => array( |
||
48 | 'format' => 'NOT BETWEEN ? AND ?', |
||
49 | 'prepared' => true |
||
50 | ), |
||
51 | 'IS NULL' => array( |
||
52 | 'format' => 'IS NULL', |
||
53 | 'prepared' => false |
||
54 | ), |
||
55 | 'IS NOT NULL' => array( |
||
56 | 'format' => 'IS NOT NULL', |
||
57 | 'prepared' => false |
||
58 | ) |
||
59 | ); |
||
60 | |||
61 | /** |
||
62 | * Gets the correct formated string for the operator |
||
63 | * @param string $value This should be the operator value |
||
64 | * @return string The string to add to the database will be added |
||
65 | */ |
||
66 | 2 | public static function getOperatorFormat($value){ |
|
70 | |||
71 | /** |
||
72 | * Checks to see if the operator is valid |
||
73 | * @param string $operator This should be the operator value |
||
74 | * @return boolean If the operator exists in the array will return true else returns false |
||
75 | */ |
||
76 | 1 | public static function isOperatorValid($operator){ |
|
80 | |||
81 | /** |
||
82 | * Checks to see if a prepared statement value should be added |
||
83 | * @param string $value This should be the operator value |
||
84 | * @return boolean If the operator should be prepared returns true else returns false |
||
85 | */ |
||
86 | 1 | public static function isOperatorPrepared($value){ |
|
89 | } |
||
90 |