| Conditions | 3 |
| Paths | 3 |
| Total Lines | 22 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 36 | public function execute() |
||
| 37 | { |
||
| 38 | $db = $this->dbHandle; |
||
| 39 | $db->/** @scrutinizer ignore-call */sqliteCreateFunction('log', 'log', 1); |
||
| 40 | $sql = ' |
||
| 41 | INSERT INTO inverse_document_frequency (term, inverseDocumentFrequency) |
||
| 42 | SELECT DISTINCT term, (1+(log(:documentCount / COUNT(documentPath) + 1))) as inverseDocumentFrequency |
||
| 43 | FROM term_count |
||
| 44 | GROUP BY term |
||
| 45 | '; |
||
| 46 | |||
| 47 | if (!$stmt = $db->prepare($sql)) { |
||
| 48 | $errorInfo = $db->errorInfo(); |
||
| 49 | $errorMsg = $errorInfo[2]; |
||
| 50 | throw new \Exception('SQLite Exception: ' . $errorMsg . ' in SQL: <br /><pre>' . $sql . '</pre>'); |
||
| 51 | } |
||
| 52 | $stmt->bindValue(':documentCount', $this->documentCount); |
||
| 53 | $result = $stmt->execute(); |
||
| 54 | if ($result === false) { |
||
| 55 | $errorInfo = $db->errorInfo(); |
||
| 56 | $errorMsg = $errorInfo[2]; |
||
| 57 | throw new \Exception('SQLite Exception: ' . $errorMsg . ' in SQL: <br /><pre>' . $sql . '</pre>'); |
||
| 58 | } |
||
| 60 | } |