| @@ 113-127 (lines=15) @@ | ||
| 110 | * @param int $errorLevel The level of error reporting to enable for the query |
|
| 111 | * @return SS_Query |
|
| 112 | */ |
|
| 113 | public function query($sql, $errorLevel = E_USER_ERROR) { |
|
| 114 | // Check if we should only preview this query |
|
| 115 | if ($this->previewWrite($sql)) { |
|
| 116 | return; |
|
| 117 | } |
|
| 118 | ||
| 119 | // Benchmark query |
|
| 120 | $connector = $this->connector; |
|
| 121 | return $this->benchmarkQuery( |
|
| 122 | $sql, |
|
| 123 | function($sql) use($connector, $errorLevel) { |
|
| 124 | return $connector->query($sql, $errorLevel); |
|
| 125 | } |
|
| 126 | ); |
|
| 127 | } |
|
| 128 | ||
| 129 | ||
| 130 | /** |
|
| @@ 138-153 (lines=16) @@ | ||
| 135 | * @param int $errorLevel The level of error reporting to enable for the query |
|
| 136 | * @return SS_Query |
|
| 137 | */ |
|
| 138 | public function preparedQuery($sql, $parameters, $errorLevel = E_USER_ERROR) { |
|
| 139 | // Check if we should only preview this query |
|
| 140 | if ($this->previewWrite($sql)) { |
|
| 141 | return; |
|
| 142 | } |
|
| 143 | ||
| 144 | // Benchmark query |
|
| 145 | $connector = $this->connector; |
|
| 146 | return $this->benchmarkQuery( |
|
| 147 | $sql, |
|
| 148 | function($sql) use($connector, $parameters, $errorLevel) { |
|
| 149 | return $connector->preparedQuery($sql, $parameters, $errorLevel); |
|
| 150 | }, |
|
| 151 | $parameters |
|
| 152 | ); |
|
| 153 | } |
|
| 154 | ||
| 155 | /** |
|
| 156 | * Determines if the query should be previewed, and thus interrupted silently. |
|