1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Trait DatabaseOptionsTrait |
4
|
|
|
* |
5
|
|
|
* @filesource DatabaseOptionsTrait.php |
6
|
|
|
* @created 24.01.2018 |
7
|
|
|
* @package chillerlan\Database |
8
|
|
|
* @author Smiley <[email protected]> |
9
|
|
|
* @copyright 2018 Smiley |
10
|
|
|
* @license MIT |
11
|
|
|
*/ |
12
|
|
|
|
13
|
|
|
namespace chillerlan\Database; |
14
|
|
|
|
15
|
|
|
trait DatabaseOptionsTrait{ |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* The database driver to use (FQCN) |
19
|
|
|
* |
20
|
|
|
* @var string |
21
|
|
|
*/ |
22
|
|
|
protected $driver; |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* The host to connect to |
26
|
|
|
* |
27
|
|
|
* @var string |
28
|
|
|
*/ |
29
|
|
|
protected $host = 'localhost'; |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* The port number |
33
|
|
|
* |
34
|
|
|
* @var int |
35
|
|
|
*/ |
36
|
|
|
protected $port; |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* A socket |
40
|
|
|
* |
41
|
|
|
* @var string |
42
|
|
|
*/ |
43
|
|
|
protected $socket; |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* The database name |
47
|
|
|
* |
48
|
|
|
* @var string |
49
|
|
|
*/ |
50
|
|
|
protected $database; |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* The username |
54
|
|
|
* |
55
|
|
|
* @var string |
56
|
|
|
*/ |
57
|
|
|
protected $username; |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* The password |
61
|
|
|
* |
62
|
|
|
* @var string |
63
|
|
|
*/ |
64
|
|
|
protected $password; |
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* Indicates whether the connection should use SSL or not |
68
|
|
|
* |
69
|
|
|
* @var bool |
70
|
|
|
*/ |
71
|
|
|
protected $use_ssl = false; |
72
|
|
|
|
73
|
|
|
/** |
74
|
|
|
* The SSL key |
75
|
|
|
* |
76
|
|
|
* @var string |
77
|
|
|
*/ |
78
|
|
|
protected $ssl_key; |
79
|
|
|
|
80
|
|
|
/** |
81
|
|
|
* The SSL certificate |
82
|
|
|
* |
83
|
|
|
* @var string |
84
|
|
|
*/ |
85
|
|
|
protected $ssl_cert; |
86
|
|
|
|
87
|
|
|
/** |
88
|
|
|
* The path to a SSL certificate authority file |
89
|
|
|
* |
90
|
|
|
* @var string |
91
|
|
|
*/ |
92
|
|
|
protected $ssl_ca; |
93
|
|
|
|
94
|
|
|
/** |
95
|
|
|
* The directory containing SSL certificate authority files |
96
|
|
|
* |
97
|
|
|
* @var string |
98
|
|
|
*/ |
99
|
|
|
protected $ssl_capath; |
100
|
|
|
|
101
|
|
|
/** |
102
|
|
|
* The SSL cipher |
103
|
|
|
* |
104
|
|
|
* @var string |
105
|
|
|
*/ |
106
|
|
|
protected $ssl_cipher; |
107
|
|
|
|
108
|
|
|
/** |
109
|
|
|
* MySQLi connection timeout |
110
|
|
|
* |
111
|
|
|
* @var int |
112
|
|
|
*/ |
113
|
|
|
protected $mysqli_timeout = 3; |
114
|
|
|
|
115
|
|
|
/** |
116
|
|
|
* MySQL connection character set |
117
|
|
|
* |
118
|
|
|
* @link https://mathiasbynens.be/notes/mysql-utf8mb4 How to support full Unicode in MySQL |
119
|
|
|
* |
120
|
|
|
* @var string |
121
|
|
|
*/ |
122
|
|
|
protected $mysql_charset = 'utf8mb4'; |
123
|
|
|
|
124
|
|
|
/** |
125
|
|
|
* PostgreSQL connection character set |
126
|
|
|
* |
127
|
|
|
* @var string |
128
|
|
|
*/ |
129
|
|
|
protected $pgsql_charset = 'UTF8'; |
130
|
|
|
|
131
|
|
|
/** |
132
|
|
|
* The driver name to use for an ODBC connection |
133
|
|
|
* |
134
|
|
|
* @var string |
135
|
|
|
*/ |
136
|
|
|
protected $odbc_driver; |
137
|
|
|
|
138
|
|
|
/** |
139
|
|
|
* @var string database result encoding (mb_convert_encoding) |
140
|
|
|
*/ |
141
|
|
|
protected $convert_encoding_src; |
142
|
|
|
|
143
|
|
|
/** |
144
|
|
|
* @var string target encoding |
145
|
|
|
*/ |
146
|
|
|
protected $convert_encoding_dest = 'UTF-8'; |
147
|
|
|
|
148
|
|
|
/** |
149
|
|
|
* MS SQL Server connection timeout |
150
|
|
|
* |
151
|
|
|
* @link https://docs.microsoft.com/en-us/sql/connect/php/connection-options |
152
|
|
|
* |
153
|
|
|
* @var int |
154
|
|
|
*/ |
155
|
|
|
protected $mssql_timeout = 3; |
156
|
|
|
|
157
|
|
|
/** |
158
|
|
|
* MS SQL Server connection character set |
159
|
|
|
* |
160
|
|
|
* @var string |
161
|
|
|
*/ |
162
|
|
|
protected $mssql_charset = 'UTF-8'; |
163
|
|
|
|
164
|
|
|
/** |
165
|
|
|
* Specifies whether the communication with MS SQL Server is encrypted or unencrypted. |
166
|
|
|
* |
167
|
|
|
* @var int |
168
|
|
|
*/ |
169
|
|
|
protected $mssql_encrypt = 0; // how??? |
170
|
|
|
|
171
|
|
|
/** |
172
|
|
|
* Firebird connection encoding |
173
|
|
|
* |
174
|
|
|
* @var string |
175
|
|
|
*/ |
176
|
|
|
protected $firebird_encoding = 'UTF8'; |
177
|
|
|
|
178
|
|
|
/** |
179
|
|
|
* @var string |
180
|
|
|
*/ |
181
|
|
|
protected $cachekey_hash_algo = 'sha256'; |
182
|
|
|
|
183
|
|
|
/** |
184
|
|
|
* @var |
185
|
|
|
*/ |
186
|
|
|
protected $storage_path; |
187
|
|
|
|
188
|
|
|
} |
189
|
|
|
|