Cancelled
Push — develop ( de9bfb...d662a5 )
by Felipe
06:08
created

HasTrait::hasUserSignals()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
eloc 1
nc 1
nop 0
1
<?php
2
3
/**
4
 * PHPPgAdmin v6.0.0-beta.47
5
 */
6
7
namespace PHPPgAdmin\Database\Traits;
8
9
/**
10
 * Common trait for flags telling if the driver supports certain attributes/operations.
11
 */
12
trait HasTrait
13
{
14
    public $conn;
15
16
    // The backend platform.  Set to UNKNOWN by default.
17
    public $platform = 'UNKNOWN';
18
19
    public $major_version = 9.6;
20
    // Max object name length
21
    public $_maxNameLen = 63;
22
    // Store the current schema
23
    public $_schema;
24
    // Map of database encoding names to HTTP encoding names.  If a
25
    // database encoding does not appear in this list, then its HTTP
26
    // encoding name is the same as its database encoding name.
27
    public $codemap = [
28
        'BIG5'       => 'BIG5',
29
        'EUC_CN'     => 'GB2312',
30
        'EUC_JP'     => 'EUC-JP',
31
        'EUC_KR'     => 'EUC-KR',
32
        'EUC_TW'     => 'EUC-TW',
33
        'GB18030'    => 'GB18030',
34
        'GBK'        => 'GB2312',
35
        'ISO_8859_5' => 'ISO-8859-5',
36
        'ISO_8859_6' => 'ISO-8859-6',
37
        'ISO_8859_7' => 'ISO-8859-7',
38
        'ISO_8859_8' => 'ISO-8859-8',
39
        'JOHAB'      => 'CP1361',
40
        'KOI8'       => 'KOI8-R',
41
        'LATIN1'     => 'ISO-8859-1',
42
        'LATIN2'     => 'ISO-8859-2',
43
        'LATIN3'     => 'ISO-8859-3',
44
        'LATIN4'     => 'ISO-8859-4',
45
        'LATIN5'     => 'ISO-8859-9',
46
        'LATIN6'     => 'ISO-8859-10',
47
        'LATIN7'     => 'ISO-8859-13',
48
        'LATIN8'     => 'ISO-8859-14',
49
        'LATIN9'     => 'ISO-8859-15',
50
        'LATIN10'    => 'ISO-8859-16',
51
        'SJIS'       => 'SHIFT_JIS',
52
        'SQL_ASCII'  => 'US-ASCII',
53
        'UHC'        => 'WIN949',
54
        'UTF8'       => 'UTF-8',
55
        'WIN866'     => 'CP866',
56
        'WIN874'     => 'CP874',
57
        'WIN1250'    => 'CP1250',
58
        'WIN1251'    => 'CP1251',
59
        'WIN1252'    => 'CP1252',
60
        'WIN1256'    => 'CP1256',
61
        'WIN1258'    => 'CP1258',
62
    ];
63
    public $defaultprops = ['', '', ''];
64
    // Extra "magic" types.  BIGSERIAL was added in PostgreSQL 7.2.
65
    public $extraTypes = ['SERIAL', 'BIGSERIAL'];
66
    // Foreign key stuff.  First element MUST be the default.
67
    public $fkactions    = ['NO ACTION', 'RESTRICT', 'CASCADE', 'SET NULL', 'SET DEFAULT'];
68
    public $fkdeferrable = ['NOT DEFERRABLE', 'DEFERRABLE'];
69
    public $fkinitial    = ['INITIALLY IMMEDIATE', 'INITIALLY DEFERRED'];
70
    public $fkmatches    = ['MATCH SIMPLE', 'MATCH FULL'];
71
    // Function properties
72
    public $funcprops = [
73
        ['', 'VOLATILE', 'IMMUTABLE', 'STABLE'],
74
        ['', 'CALLED ON NULL INPUT', 'RETURNS NULL ON NULL INPUT'],
75
        ['', 'SECURITY INVOKER', 'SECURITY DEFINER'],
76
    ];
77
78
    // Default help URL
79
    public $help_base;
80
    // Help sub pages
81
    public $help_page;
82
    // Name of id column
83
    public $id = 'oid';
84
85
    // Supported join operations for use with view wizard
86
    public $joinOps = ['INNER JOIN' => 'INNER JOIN', 'LEFT JOIN' => 'LEFT JOIN', 'RIGHT JOIN' => 'RIGHT JOIN', 'FULL JOIN' => 'FULL JOIN'];
87
    // Map of internal language name to syntax highlighting name
88
    public $langmap = [
89
        'sql'       => 'SQL',
90
        'plpgsql'   => 'SQL',
91
        'php'       => 'PHP',
92
        'phpu'      => 'PHP',
93
        'plphp'     => 'PHP',
94
        'plphpu'    => 'PHP',
95
        'perl'      => 'Perl',
96
        'perlu'     => 'Perl',
97
        'plperl'    => 'Perl',
98
        'plperlu'   => 'Perl',
99
        'java'      => 'Java',
100
        'javau'     => 'Java',
101
        'pljava'    => 'Java',
102
        'pljavau'   => 'Java',
103
        'plj'       => 'Java',
104
        'plju'      => 'Java',
105
        'python'    => 'Python',
106
        'pythonu'   => 'Python',
107
        'plpython'  => 'Python',
108
        'plpythonu' => 'Python',
109
        'ruby'      => 'Ruby',
110
        'rubyu'     => 'Ruby',
111
        'plruby'    => 'Ruby',
112
        'plrubyu'   => 'Ruby',
113
    ];
114
    // Predefined size types
115
    public $predefined_size_types = [
116
        'abstime',
117
        'aclitem',
118
        'bigserial',
119
        'boolean',
120
        'bytea',
121
        'cid',
122
        'cidr',
123
        'circle',
124
        'date',
125
        'float4',
126
        'float8',
127
        'gtsvector',
128
        'inet',
129
        'int2',
130
        'int4',
131
        'int8',
132
        'macaddr',
133
        'money',
134
        'oid',
135
        'path',
136
        'polygon',
137
        'refcursor',
138
        'regclass',
139
        'regoper',
140
        'regoperator',
141
        'regproc',
142
        'regprocedure',
143
        'regtype',
144
        'reltime',
145
        'serial',
146
        'smgr',
147
        'text',
148
        'tid',
149
        'tinterval',
150
        'tsquery',
151
        'tsvector',
152
        'varbit',
153
        'void',
154
        'xid',
155
    ];
156
    // List of all legal privileges that can be applied to different types
157
    // of objects.
158
    public $privlist = [
159
        'table'      => ['SELECT', 'INSERT', 'UPDATE', 'DELETE', 'REFERENCES', 'TRIGGER', 'ALL PRIVILEGES'],
160
        'view'       => ['SELECT', 'INSERT', 'UPDATE', 'DELETE', 'REFERENCES', 'TRIGGER', 'ALL PRIVILEGES'],
161
        'sequence'   => ['SELECT', 'UPDATE', 'ALL PRIVILEGES'],
162
        'database'   => ['CREATE', 'TEMPORARY', 'CONNECT', 'ALL PRIVILEGES'],
163
        'function'   => ['EXECUTE', 'ALL PRIVILEGES'],
164
        'language'   => ['USAGE', 'ALL PRIVILEGES'],
165
        'schema'     => ['CREATE', 'USAGE', 'ALL PRIVILEGES'],
166
        'tablespace' => ['CREATE', 'ALL PRIVILEGES'],
167
        'column'     => ['SELECT', 'INSERT', 'UPDATE', 'REFERENCES', 'ALL PRIVILEGES'],
168
    ];
169
    // List of characters in acl lists and the privileges they
170
    // refer to.
171
    public $privmap = [
172
        'r' => 'SELECT',
173
        'w' => 'UPDATE',
174
        'a' => 'INSERT',
175
        'd' => 'DELETE',
176
        'D' => 'TRUNCATE',
177
        'R' => 'RULE',
178
        'x' => 'REFERENCES',
179
        't' => 'TRIGGER',
180
        'X' => 'EXECUTE',
181
        'U' => 'USAGE',
182
        'C' => 'CREATE',
183
        'T' => 'TEMPORARY',
184
        'c' => 'CONNECT',
185
    ];
186
    // Rule action types
187
    public $rule_events = ['SELECT', 'INSERT', 'UPDATE', 'DELETE'];
188
    // Select operators
189
    public $selectOps = [
190
        '='                   => 'i',
191
        '!='                  => 'i',
192
        '<'                   => 'i',
193
        '>'                   => 'i',
194
        '<='                  => 'i',
195
        '>='                  => 'i',
196
        '<<'                  => 'i',
197
        '>>'                  => 'i',
198
        '<<='                 => 'i',
199
        '>>='                 => 'i',
200
        'LIKE'                => 'i',
201
        'NOT LIKE'            => 'i',
202
        'ILIKE'               => 'i',
203
        'NOT ILIKE'           => 'i',
204
        'SIMILAR TO'          => 'i',
205
        'NOT SIMILAR TO'      => 'i',
206
        '~'                   => 'i',
207
        '!~'                  => 'i',
208
        '~*'                  => 'i',
209
        '!~*'                 => 'i',
210
        'IS NULL'             => 'p',
211
        'IS NOT NULL'         => 'p',
212
        'IN'                  => 'x',
213
        'NOT IN'              => 'x',
214
        '@@'                  => 'i',
215
        '@@@'                 => 'i',
216
        '@>'                  => 'i',
217
        '<@'                  => 'i',
218
        '@@ to_tsquery'       => 't',
219
        '@@@ to_tsquery'      => 't',
220
        '@> to_tsquery'       => 't',
221
        '<@ to_tsquery'       => 't',
222
        '@@ plainto_tsquery'  => 't',
223
        '@@@ plainto_tsquery' => 't',
224
        '@> plainto_tsquery'  => 't',
225
        '<@ plainto_tsquery'  => 't',
226
    ];
227
    // Array of allowed trigger events
228
    public $triggerEvents = [
229
        'INSERT',
230
        'UPDATE',
231
        'DELETE',
232
        'INSERT OR UPDATE',
233
        'INSERT OR DELETE',
234
        'DELETE OR UPDATE',
235
        'INSERT OR DELETE OR UPDATE',
236
    ];
237
    // When to execute the trigger
238
    public $triggerExecTimes = ['BEFORE', 'AFTER'];
239
    // How often to execute the trigger
240
    public $triggerFrequency = ['ROW', 'STATEMENT'];
241
    // Array of allowed type alignments
242
    public $typAligns = ['char', 'int2', 'int4', 'double'];
243
    // The default type alignment
244
    public $typAlignDef = 'int4';
245
    // Default index type
246
    public $typIndexDef = 'BTREE';
247
    // Array of allowed index types
248
    public $typIndexes = ['BTREE', 'RTREE', 'GIST', 'GIN', 'HASH'];
249
    // Array of allowed type storage attributes
250
    public $typStorages = ['plain', 'external', 'extended', 'main'];
251
    // The default type storage
252
    public $typStorageDef = 'plain';
253
254
    /**
255
     * Determines if it has tablespaces.
256
     *
257
     * @return bool true if has tablespaces, False otherwise
258
     */
259
    public function hasTablespaces()
260
    {
261
        return true;
262
    }
263
264
    /**
265
     * Determines if it has shared comments.
266
     *
267
     * @return bool true if has shared comments, False otherwise
268
     */
269
    public function hasSharedComments()
270
    {
271
        return true;
272
    }
273
274
    /**
275
     * Determines if it has roles.
276
     *
277
     * @return bool true if has roles, False otherwise
278
     */
279
    public function hasRoles()
280
    {
281
        return true;
282
    }
283
284
    /**
285
     * Determines if it has grant option.
286
     *
287
     * @return bool true if has grant option, False otherwise
288
     */
289
    public function hasGrantOption()
290
    {
291
        return true;
292
    }
293
294
    /**
295
     * Determines if it has create table like with constraints.
296
     *
297
     * @return bool true if has create table like with constraints, False otherwise
298
     */
299
    public function hasCreateTableLikeWithConstraints()
300
    {
301
        return true;
302
    }
303
304
    /**
305
     * Determines if it has create table like with indexes.
306
     *
307
     * @return bool true if has create table like with indexes, False otherwise
308
     */
309
    public function hasCreateTableLikeWithIndexes()
310
    {
311
        return true;
312
    }
313
314
    /**
315
     * Determines if it has create field with constraints.
316
     *
317
     * @return bool true if has create field with constraints, False otherwise
318
     */
319
    public function hasCreateFieldWithConstraints()
320
    {
321
        return true;
322
    }
323
324
    /**
325
     * Determines if it has domain constraints.
326
     *
327
     * @return bool true if has domain constraints, False otherwise
328
     */
329
    public function hasDomainConstraints()
330
    {
331
        return true;
332
    }
333
334
    /**
335
     * Determines if it has function alter owner.
336
     *
337
     * @return bool true if has function alter owner, False otherwise
338
     */
339
    public function hasFunctionAlterOwner()
340
    {
341
        return true;
342
    }
343
344
    /**
345
     * Determines if it has function alter schema.
346
     *
347
     * @return bool true if has function alter schema, False otherwise
348
     */
349
    public function hasFunctionAlterSchema()
350
    {
351
        return true;
352
    }
353
354
    /**
355
     * Determines if it has read only queries.
356
     *
357
     * @return bool true if has read only queries, False otherwise
358
     */
359
    public function hasReadOnlyQueries()
360
    {
361
        return true;
362
    }
363
364
    /**
365
     * Determines if it has aggregate sort operation.
366
     *
367
     * @return bool true if has aggregate sort operation, False otherwise
368
     */
369
    public function hasAggregateSortOp()
370
    {
371
        return true;
372
    }
373
374
    /**
375
     * Determines if it has alter aggregate.
376
     *
377
     * @return bool true if has alter aggregate, False otherwise
378
     */
379
    public function hasAlterAggregate()
380
    {
381
        return true;
382
    }
383
384
    /**
385
     * Determines if it has alter column type.
386
     *
387
     * @return bool true if has alter column type, False otherwise
388
     */
389
    public function hasAlterColumnType()
390
    {
391
        return true;
392
    }
393
394
    /**
395
     * Determines if it has alter database owner.
396
     *
397
     * @return bool true if has alter database owner, False otherwise
398
     */
399
    public function hasAlterDatabaseOwner()
400
    {
401
        return true;
402
    }
403
404
    /**
405
     * Determines if it has alter schema.
406
     *
407
     * @return bool true if has alter schema, False otherwise
408
     */
409
    public function hasAlterSchema()
410
    {
411
        return true;
412
    }
413
414
    /**
415
     * Determines if it has alter schema owner.
416
     *
417
     * @return bool true if has alter schema owner, False otherwise
418
     */
419
    public function hasAlterSchemaOwner()
420
    {
421
        return true;
422
    }
423
424
    /**
425
     * Determines if it has alter sequence schema.
426
     *
427
     * @return bool true if has alter sequence schema, False otherwise
428
     */
429
    public function hasAlterSequenceSchema()
430
    {
431
        return true;
432
    }
433
434
    /**
435
     * Determines if it has alter sequence start.
436
     *
437
     * @return bool true if has alter sequence start, False otherwise
438
     */
439
    public function hasAlterSequenceStart()
440
    {
441
        return true;
442
    }
443
444
    /**
445
     * Determines if it has alter table schema.
446
     *
447
     * @return bool true if has alter table schema, False otherwise
448
     */
449
    public function hasAlterTableSchema()
450
    {
451
        return true;
452
    }
453
454
    /**
455
     * Determines if it has autovacuum.
456
     *
457
     * @return bool true if has autovacuum, False otherwise
458
     */
459
    public function hasAutovacuum()
460
    {
461
        return true;
462
    }
463
464
    /**
465
     * Determines if it has create table like.
466
     *
467
     * @return bool true if has create table like, False otherwise
468
     */
469
    public function hasCreateTableLike()
470
    {
471
        return true;
472
    }
473
474
    /**
475
     * Determines if it has disable triggers.
476
     *
477
     * @return bool true if has disable triggers, False otherwise
478
     */
479
    public function hasDisableTriggers()
480
    {
481
        return true;
482
    }
483
484
    /**
485
     * Determines if it has alter domains.
486
     *
487
     * @return bool true if has alter domains, False otherwise
488
     */
489
    public function hasAlterDomains()
490
    {
491
        return true;
492
    }
493
494
    /**
495
     * Determines if it has enum types.
496
     *
497
     * @return bool true if has enum types, False otherwise
498
     */
499
    public function hasEnumTypes()
500
    {
501
        return true;
502
    }
503
504
    /**
505
     * Determines if it has fts.
506
     *
507
     * @return bool true if has fts, False otherwise
508
     */
509
    public function hasFTS()
510
    {
511
        return true;
512
    }
513
514
    /**
515
     * Determines if it has function costing.
516
     *
517
     * @return bool true if has function costing, False otherwise
518
     */
519
    public function hasFunctionCosting()
520
    {
521
        return true;
522
    }
523
524
    /**
525
     * Determines if it has function guc.
526
     *
527
     * @return bool true if has function guc, False otherwise
528
     */
529
    public function hasFunctionGUC()
530
    {
531
        return true;
532
    }
533
534
    /**
535
     * Determines if it has named parameters.
536
     *
537
     * @return bool true if has named parameters, False otherwise
538
     */
539
    public function hasNamedParams()
540
    {
541
        return true;
542
    }
543
544
    /**
545
     * Determines if it has prepare.
546
     *
547
     * @return bool true if has prepare, False otherwise
548
     */
549
    public function hasPrepare()
550
    {
551
        return true;
552
    }
553
554
    /**
555
     * Determines if it has prepared xacts.
556
     *
557
     * @return bool true if has prepared xacts, False otherwise
558
     */
559
    public function hasPreparedXacts()
560
    {
561
        return true;
562
    }
563
564
    /**
565
     * Determines if it has recluster.
566
     *
567
     * @return bool true if has recluster, False otherwise
568
     */
569
    public function hasRecluster()
570
    {
571
        return true;
572
    }
573
574
    /**
575
     * Determines if it has server admin funcs.
576
     *
577
     * @return bool true if has server admin funcs, False otherwise
578
     */
579
    public function hasServerAdminFuncs()
580
    {
581
        return true;
582
    }
583
584
    /**
585
     * Determines if it has query cancel.
586
     *
587
     * @return bool true if has query cancel, False otherwise
588
     */
589
    public function hasQueryCancel()
590
    {
591
        return true;
592
    }
593
594
    /**
595
     * Determines if it has user rename.
596
     *
597
     * @return bool true if has user rename, False otherwise
598
     */
599
    public function hasUserRename()
600
    {
601
        return true;
602
    }
603
604
    /**
605
     * Determines if it has user signals.
606
     *
607
     * @return bool true if has user signals, False otherwise
608
     */
609
    public function hasUserSignals()
610
    {
611
        return true;
612
    }
613
614
    /**
615
     * Determines if it has virtual transaction identifier.
616
     *
617
     * @return bool true if has virtual transaction identifier, False otherwise
618
     */
619
    public function hasVirtualTransactionId()
620
    {
621
        return true;
622
    }
623
624
    /**
625
     * Determines if it has alter database.
626
     *
627
     * @return bool true if has alter database, False otherwise
628
     */
629
    public function hasAlterDatabase()
630
    {
631
        return $this->hasAlterDatabaseRename();
632
    }
633
634
    /**
635
     * Determines if it has alter database rename.
636
     *
637
     * @return bool true if has alter database rename, False otherwise
638
     */
639
    public function hasAlterDatabaseRename()
640
    {
641
        return true;
642
    }
643
644
    /**
645
     * Determines if it has database collation.
646
     *
647
     * @return bool true if has database collation, False otherwise
648
     */
649
    public function hasDatabaseCollation()
650
    {
651
        return true;
652
    }
653
654
    /**
655
     * Determines if it has magic types.
656
     *
657
     * @return bool true if has magic types, False otherwise
658
     */
659
    public function hasMagicTypes()
660
    {
661
        return true;
662
    }
663
664
    /**
665
     * Determines if it has query kill.
666
     *
667
     * @return bool true if has query kill, False otherwise
668
     */
669
    public function hasQueryKill()
670
    {
671
        return true;
672
    }
673
674
    /**
675
     * Determines if it has concurrent index build.
676
     *
677
     * @return bool true if has concurrent index build, False otherwise
678
     */
679
    public function hasConcurrentIndexBuild()
680
    {
681
        return true;
682
    }
683
684
    /**
685
     * Determines if it has force reindex.
686
     *
687
     * @return bool true if has force reindex, False otherwise
688
     */
689
    public function hasForceReindex()
690
    {
691
        return false;
692
    }
693
694
    /**
695
     * Determines if it has bytea hexadecimal default.
696
     *
697
     * @return bool true if has bytea hexadecimal default, False otherwise
698
     */
699
    public function hasByteaHexDefault()
700
    {
701
        return true;
702
    }
703
}
704