Conditions | 2 |
Paths | 2 |
Total Lines | 16 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php |
||
44 | 7 | public function loadData( |
|
45 | string $table, |
||
46 | string $filename, |
||
47 | array $fields, |
||
48 | string $mode |
||
49 | ): string { |
||
50 | 7 | $sql ="LOAD DATA LOCAL INFILE '{$filename}' |
|
51 | 7 | REPLACE INTO TABLE {$table} |
|
52 | 7 | FIELDS TERMINATED BY '|' ENCLOSED BY '\"' LINES TERMINATED BY '" . PHP_EOL . "' |
|
53 | 7 | (`" . implode("`, `", $fields) . "`)"; |
|
54 | // Run the query if asked |
||
55 | 7 | if ($this->pretend === false) { |
|
56 | 6 | $this->conn->query($sql); |
|
57 | } |
||
58 | |||
59 | 6 | return $sql; |
|
60 | } |
||
62 |