30
30
* @package eftec
31
31
* @author Jorge Castro Castillo
32
32
* @copyright (c) Jorge Castro C. Dual Licence: MIT and Commercial License https://github.com/EFTEC/PdoOne
33
- * @version 4.13
33
+ * @version 4.13.1
34
34
*/
35
35
class PdoOne
36
36
{
37
- public const VERSION = '4.13 ' ;
37
+ public const VERSION = '4.13.1 ' ;
38
38
/** @var int We need this value because null and false could be a valid value. */
39
39
public const NULL = PHP_INT_MAX ;
40
40
/** @var string Prefix of the related columns. It is used for ORM */
@@ -209,8 +209,9 @@ class PdoOne
209
209
* for sequence. Form 0 to 1023
210
210
* @param string $tableKV (optional), the name of the table key-value
211
211
* @param string $instanceName (optional, default "0"), the name of the instance
212
+ * @param string|null $prefix The prefix of the associative column. By default is "_". Null keeps the value
213
+ * @param string|null $postfix The postfix of the associative column. Null keeps the value.
212
214
* @see PdoOne::connect()
213
- * @noinspection ClassConstantCanBeUsedInspection
214
215
*/
215
216
public function __construct (
216
217
$ databaseType ,
@@ -223,8 +224,8 @@ public function __construct(
223
224
int $ nodeId = 1 ,
224
225
string $ tableKV = '' ,
225
226
string $ instanceName = "0 " ,
226
- string $ prefix = ' _ ' ,
227
- string $ postfix = ''
227
+ ? string $ prefix = null ,
228
+ ? string $ postfix = null
228
229
)
229
230
{
230
231
if (is_array ($ databaseType )) {
@@ -239,12 +240,14 @@ public function __construct(
239
240
$ nodeId =$ cp ['nodeId ' ]??1 ;
240
241
$ tableKV =$ cp ['tableKV ' ]??'' ;
241
242
$ instanceName =$ cp ['$instanceName ' ]??'0 ' ;
242
- self ::$ prefixBase = $ cp ['prefix ' ]??'_ ' ;
243
- self ::$ postfixBase = $ cp ['postfix ' ]??'' ;
243
+
244
+ self ::$ prefixBase = $ cp ['prefix ' ]??self ::$ prefixBase ;
245
+ self ::$ postfixBase = $ cp ['postfix ' ]??self ::$ postfixBase ;
244
246
245
247
}
246
248
$ this ->construct ($ databaseType , $ server , $ user , $ pwd , $ db , $ logFile ,
247
249
$ charset , $ nodeId , $ tableKV ,$ prefix ,$ postfix );
250
+ /** @noinspection ClassConstantCanBeUsedInspection */
248
251
if (class_exists ('eftec\MessageContainer ' )) {
249
252
// autowire MessageContainer if the method exists.
250
253
$ this ->messageContainer = MessageContainer::instance ();
@@ -350,8 +353,8 @@ protected function construct(
350
353
$ charset = null ,
351
354
$ nodeId = 1 ,
352
355
$ tableKV = '' ,
353
- $ prefix = ' _ ' ,
354
- $ postfix = ''
356
+ $ prefix = null ,
357
+ $ postfix = null
355
358
): void
356
359
{
357
360
$ this ->databaseType = $ databaseType ;
@@ -379,8 +382,8 @@ protected function construct(
379
382
default :
380
383
throw new RuntimeException ('no database type selected ' );
381
384
}
382
- self ::$ prefixBase = $ prefix ??' _ ' ;
383
- self ::$ postfixBase = $ postfix ??'' ;
385
+ self ::$ prefixBase = $ prefix ??self :: $ prefixBase ;
386
+ self ::$ postfixBase = $ postfix ??self :: $ postfixBase ;
384
387
$ charset = $ this ->service ->construct ($ charset , []);
385
388
$ this ->server = $ server ;
386
389
$ this ->user = $ user ;
0 commit comments