| Total Complexity | 3 |
| Total Lines | 70 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 11 | class Pgsql extends SQL |
||
| 12 | { |
||
| 13 | const DEFAULT_HOST = '127.0.0.1'; |
||
| 14 | const DEFAULT_PORT = '5432'; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * @link https://secure.php.net/manual/en/ref.pdo-pgsql.connection.php |
||
| 18 | * @link https://www.postgresql.org/docs/8.3/static/libpq-connect.html |
||
| 19 | * |
||
| 20 | * The PDO_PGSQL Data Source Name (DSN) is composed of the following elements: |
||
| 21 | */ |
||
| 22 | const AVAILABLE_OPTIONS = [ |
||
| 23 | 'host', |
||
| 24 | 'hostaddr', |
||
| 25 | 'port', |
||
| 26 | 'dbname', |
||
| 27 | |||
| 28 | /** |
||
| 29 | * These two parameters below is not needed, because we can put user/pass |
||
| 30 | * as parameters of PDO class, you can read more by link |
||
| 31 | * @link https://secure.php.net/manual/en/pdo.construct.php |
||
| 32 | */ |
||
| 33 | //'user', |
||
| 34 | //'password', |
||
| 35 | |||
| 36 | 'passfile', |
||
| 37 | 'connect_timeout', |
||
| 38 | 'client_encoding', |
||
| 39 | 'options', |
||
| 40 | 'application_name', |
||
| 41 | 'fallback_application_name', |
||
| 42 | 'keepalives', |
||
| 43 | 'keepalives_idle', |
||
| 44 | 'keepalives_interval', |
||
| 45 | 'keepalives_count', |
||
| 46 | 'tty', |
||
| 47 | 'sslmode', |
||
| 48 | 'requiressl', |
||
| 49 | 'sslcompression', |
||
| 50 | 'sslcert', |
||
| 51 | 'sslkey', |
||
| 52 | 'sslrootcert', |
||
| 53 | 'sslcrl', |
||
| 54 | 'requirepeer', |
||
| 55 | 'krbsrvname', |
||
| 56 | 'gsslib', |
||
| 57 | 'service', |
||
| 58 | 'target_session_attrs' |
||
| 59 | ]; |
||
| 60 | |||
| 61 | /** |
||
| 62 | * Generate DSN by parameters in config |
||
| 63 | * |
||
| 64 | * @param array $config |
||
| 65 | * @return string |
||
| 66 | */ |
||
| 67 | public function genDsn($config): string |
||
| 83 |