Conditions | 3 |
Paths | 3 |
Total Lines | 16 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
36 | 7 | public function loadData(string $table, string $fname, array $fields, string $mode): string |
|
37 | { |
||
38 | 7 | $fields = implode(', ', $fields); |
|
39 | |||
40 | 7 | if ($this->pretend === false) { |
|
41 | 6 | if ($mode === 'update') { |
|
42 | 4 | $this->conn->query("TRUNCATE {$table}"); |
|
43 | } |
||
44 | 6 | $pdo = $this->conn->getWrappedConnection(); |
|
45 | 6 | $pdo->pgsqlCopyFromFile($table, $fname, '|', '\\\\N', $fields); |
|
46 | } |
||
47 | |||
48 | 6 | $sql = "COPY {$table} ($fields) FROM '{$fname}' "; |
|
49 | 6 | $sql.= '... Managed by pgsqlCopyFromFile'; |
|
50 | |||
51 | 6 | return $sql; |
|
52 | } |
||
54 |