forked from codeigniter4/CodeIgniter4
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDefaultConnection.php
More file actions
122 lines (108 loc) · 4.37 KB
/
Copy pathDefaultConnection.php
File metadata and controls
122 lines (108 loc) · 4.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
<?php namespace App\Config\Database;
/**
* The default connection configuration for the application.
*
* This file will contain the settings needed to access your database.
*
* Mapping values from CI3 database configuration:
* $active_group - not set here, see $activeConnection in the application's Database config
* $query_builder - currently not supported
* $db - set by a combination of $availableConnections in the application's
* Database config and files like this one to set the configuration
* of the individual connections.
*
* The following are the keys used in configuring connection groups in CI3's $db
* property and their equivalent properties in CI4's Database Connection config:
* 'dsn' - $dsn
* 'hostname' - $hostname
* 'username' - $username
* 'password' - $password
* 'dbdriver' - Instead of setting this value directly, extend the platform-specific
* Connection Configuration class (to be added here when available):
* 'mysqli' - \CodeIgniter\Config\Database\Connection\MySQLi
* 'dbprefix' - currently not supported
* 'pconnect' - $persistentConnectionEnabled
* 'db_debug' - $debugEnabled
* 'cache_on' - $cacheEnabled - may be modified to reference the cache configuration
* 'cachedir' - currently not supported (to be configured elsewhere)
* 'char_set' - $characterSet
* 'dbcollat' - $collation (MySQLi-only)
* 'swap_pre' - currently not supported
* 'encrypt' - (MySQLi-only) instead of an array with the following options, set
* the associated properties directly:
* 'ssl_key' - $sslKey
* 'ssl_cert' - $sslCert
* 'ssl_ca' - $sslCA
* 'ssl_capath' - $sslCAPath
* 'ssl_cipher' - $sslCipher
* 'ssl_verify' - $sslVerify
* 'compress' - $compressionEnabled (MySQLi-only)
* 'stricton' - $strictSQLEnabled
* 'failover' - $failover Instead of an array containing connection configurations,
* this will contain values matching keys used in the application's
* database configuration's $availableConnections property
* 'save_queries' - $saveStatementsEnabled
* 'port' - $port
*
* Additional configuration options:
* $deleteHack - (MySQLi-only)
*
* The order of the properties below has been arranged (and their values have been
* set) to match the default connection group in CI3's database config.
*/
class DefaultConnection extends \CodeIgniter\Config\Database\Connection\MySQLi
{
/**
* Data Source Name.
*
* A string which will usually contain all of the settings required to connect
* to a database. Commonly used for database adapters which support multiple
* database types, like PDO or ODBC.
*
* @var string
*/
public $dsn = '';
/** @var string The database server's hostname. */
public $hostname = 'localhost';
/** @var string The username for the database connection. */
public $username = '';
/** @var string The password for the database connection. */
public $password = '';
/** @var string The name of the database. */
public $database = '';
/** @var bool Use a persistent connection. */
public $persistentConnectionEnabled = false;
/** @var bool Enable debug messages. */
public $debugEnabled = (ENVIRONMENT !== 'production');
/** @var bool Enable database result caching. */
public $cacheEnabled = false;
/** @var string The character set. */
public $characterSet = 'utf8';
/** @var string The character collation used in communicating with the database. */
public $collation = 'utf8_general_ci';
/** @var bool Whether client compression is enabled. */
public $compressionEnabled = false;
/** @var bool Forces "Strict Mode" connections to enforce strict SQL. */
public $strictSQLEnabled = false;
/**
* List of connections to use if this one fails to connect.
*
* The values in this array should match the keys used in the application's
* Database config to reference other connection configuration classes.
*
* @var array
*/
public $failover = [];
/**
* Whether to "save" all executed SQL statements.
*
* Disabling this will also effectively disable application-level profiling
* of SQL statements.
*
* Enabling this setting may cause high memory use, especially when running
* a lot of SQL statements.
*
* @var bool
*/
public $saveStatementsEnabled = true;
}