1 | <?php |
||
2 | |||
3 | declare(strict_types=1); |
||
4 | |||
5 | /** |
||
6 | * neuralyzer : Data Anonymization Library and CLI Tool |
||
7 | * |
||
8 | * PHP Version 7.2 |
||
9 | * |
||
10 | * @author Emmanuel Dyan |
||
11 | * |
||
12 | * @copyright 2020 Emmanuel Dyan |
||
13 | * |
||
14 | * @package edyan/neuralyzer |
||
15 | * |
||
16 | * @license GNU General Public License v2.0 |
||
17 | * |
||
18 | * @link https://github.com/edyan/neuralyzer |
||
19 | */ |
||
20 | |||
21 | namespace Edyan\Neuralyzer\Helper\DB; |
||
22 | |||
23 | /** |
||
24 | * Various methods related to PostgreSQL |
||
25 | */ |
||
26 | class PostgreSQL extends AbstractDBHelper |
||
27 | { |
||
28 | 7 | /** |
|
29 | * Set the right enclosure |
||
30 | 7 | */ |
|
31 | public function getEnclosureForCSV(): string |
||
32 | { |
||
33 | return chr(0); |
||
34 | } |
||
35 | |||
36 | 7 | /** |
|
37 | * {@inheritdoc} |
||
38 | 7 | */ |
|
39 | public function loadData(string $table, string $fname, array $fields, string $mode): string |
||
40 | 7 | { |
|
41 | 6 | $fields = implode(', ', $fields); |
|
42 | 4 | ||
43 | if ($this->pretend === false) { |
||
44 | 6 | if ($mode === 'update') { |
|
45 | 6 | $this->conn->query("TRUNCATE {$table}"); |
|
0 ignored issues
–
show
|
|||
46 | } |
||
47 | $pdo = $this->conn->getWrappedConnection(); |
||
48 | 6 | $pdo->pgsqlCopyFromFile($table, $fname, '|', '\\\\N', $fields); |
|
49 | 6 | } |
|
50 | |||
51 | 6 | $sql = "COPY {$table} (${fields}) FROM '{$fname}' "; |
|
52 | $sql .= '... Managed by pgsqlCopyFromFile'; |
||
53 | |||
54 | return $sql; |
||
55 | } |
||
56 | } |
||
57 |
This function has been deprecated. The supplier of the function has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.