Completed
Push — master ( 51b667...4076e7 )
by Daniel
02:18
created

MySQLiAdvancedOutput::getFieldOutputEnumSet()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 14
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 5
Bugs 0 Features 1
Metric Value
c 5
b 0
f 1
dl 0
loc 14
rs 9.4285
cc 3
eloc 10
nc 3
nop 4
1
<?php
2
3
/**
4
 *
5
 * The MIT License (MIT)
6
 *
7
 * Copyright (c) 2015 Daniel Popiniuc
8
 *
9
 * Permission is hereby granted, free of charge, to any person obtaining a copy
10
 * of this software and associated documentation files (the "Software"), to deal
11
 * in the Software without restriction, including without limitation the rights
12
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
 * copies of the Software, and to permit persons to whom the Software is
14
 * furnished to do so, subject to the following conditions:
15
 *
16
 * The above copyright notice and this permission notice shall be included in all
17
 * copies or substantial portions of the Software.
18
 *
19
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
 *  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25
 * SOFTWARE.
26
 *
27
 */
28
29
namespace danielgp\common_lib;
30
31
/**
32
 * usefull functions to get quick results
33
 *
34
 * @author Daniel Popiniuc
35
 */
36
trait MySQLiAdvancedOutput
37
{
38
39
    use MySQLiByDanielGPstructures;
40
41
    protected $advCache = null;
42
43
    /**
44
     * Establish Database and Table intended to work with
45
     * (in case the DB is ommited get the default one)
46
     *
47
     * @param string $tblSrc
48
     */
49
    private function establishDatabaseAndTable($tblSrc)
50
    {
51
        if (strpos($tblSrc, '.') === false) {
52
            if (!array_key_exists('workingDatabase', $this->advCache)) {
53
                $this->advCache['workingDatabase'] = $this->getMySqlCurrentDatabase();
54
            }
55
            return [$this->advCache['workingDatabase'], $tblSrc];
56
        }
57
        return explode('.', str_replace('`', '', $tblSrc));
58
    }
59
60
    /**
61
     * Returns the name of a field for displaying
62
     *
63
     * @param array $details
64
     * @return string
65
     */
66
    private function getFieldNameForDisplay($details)
67
    {
68
        $tableUniqueId = $details['TABLE_SCHEMA'] . '.' . $details['TABLE_NAME'];
69
        if ($details['COLUMN_COMMENT'] != '') {
70
            return $details['COLUMN_COMMENT'];
71
        } elseif (isset($this->advCache['tableStructureLocales'][$tableUniqueId][$details['COLUMN_NAME']])) {
72
            return $this->advCache['tableStructureLocales'][$tableUniqueId][$details['COLUMN_NAME']];
73
        }
74
        return $details['COLUMN_NAME'];
75
    }
76
77
    /**
78
     * Returns a Enum or Set field to use in form
79
     *
80
     * @param string $tblSrc
81
     * @param string $fldType
82
     * @param array $val
83
     * @param array $iar
84
     * @return string
85
     */
86
    private function getFieldOutputEnumSet($tblSrc, $fldType, $val, $iar = [])
87
    {
88
        $adnlThings = $this->establishDefaultEnumSet($fldType);
89
        if (array_key_exists('readonly', $val)) {
90
            return $this->getFieldOutputEnumSetReadOnly($val, $adnlThings);
91
        }
92
        $inAdtnl = $adnlThings['additional'];
93
        if ($iar !== []) {
94
            $inAdtnl = array_merge($inAdtnl, $iar);
95
        }
96
        $vlSlct    = explode(',', $this->getFieldValue($val));
97
        $slctOptns = $this->getSetOrEnum2Array($tblSrc, $val['COLUMN_NAME']);
98
        return $this->setArrayToSelect($slctOptns, $vlSlct, $val['COLUMN_NAME'] . $adnlThings['suffix'], $inAdtnl);
99
    }
100
101
    /**
102
     * Returns a Numeric field 2 use in a form
103
     *
104
     * @param string $tblSrc
105
     * @param array $value
106
     * @param array $iar
107
     * @return string
108
     */
109
    private function getFieldOutputNumeric($tblSrc, $value, $iar = [])
110
    {
111
        if ($value['EXTRA'] == 'auto_increment') {
112
            return $this->getFieldOutputNumericAI($value, $iar);
113
        }
114
        $fkArray = $this->getForeignKeysToArray($this->advCache['workingDatabase'], $tblSrc, $value['COLUMN_NAME']);
115
        if (is_null($fkArray)) {
116
            $fldNos = $this->setFieldNumbers($value);
117
            return $this->getFieldOutputTT($value, min(50, $fldNos['l']), $iar);
118
        }
119
        return $this->getFieldOutputNumericNonFK($fkArray, $value, $iar);
120
    }
121
122
    /**
123
     * Handles creation of Auto Increment numeric field type output
124
     *
125
     * @param array $value
126
     * @param array $iar
127
     * @return string
128
     */
129
    private function getFieldOutputNumericAI($value, $iar = [])
130
    {
131
        if ($this->getFieldValue($value) == '') {
132
            $spF = ['id' => $value['COLUMN_NAME'], 'style' => 'font-style:italic;'];
133
            return $this->setStringIntoTag('auto-numar', 'span', $spF);
134
        }
135
        $inAdtnl = [
136
            'type'  => 'hidden',
137
            'name'  => $value['COLUMN_NAME'],
138
            'id'    => $value['COLUMN_NAME'],
139
            'value' => $this->getFieldValue($value),
140
        ];
141
        if ($iar !== []) {
142
            $inAdtnl = array_merge($inAdtnl, $iar);
143
        }
144
        return '<b>' . $this->getFieldValue($value) . '</b>' . $this->setStringIntoShortTag('input', $inAdtnl);
145
    }
146
147
    /**
148
     * Builds field output type for numeric types if not FK
149
     *
150
     * @param array $fkArray
151
     * @param array $value
152
     * @param array $iar
153
     * @return string
154
     */
155
    private function getFieldOutputNumericNonFK($fkArray, $value, $iar = [])
156
    {
157
        $query         = $this->sQueryGenericSelectKeyValue([
158
            $fkArray[$value['COLUMN_NAME']][1],
159
            $fkArray[$value['COLUMN_NAME']][2],
160
            $fkArray[$value['COLUMN_NAME']][0],
161
        ]);
162
        $selectOptions = $this->setMySQLquery2Server($query, 'array_key_value')['result'];
163
        $selectValue   = $this->getFieldValue($value);
164
        $inAdtnl       = ['size' => 1];
165
        if ($value['IS_NULLABLE'] == 'YES') {
166
            $inAdtnl = array_merge($inAdtnl, ['include_null']);
167
        }
168
        if ($iar !== []) {
169
            $inAdtnl = array_merge($inAdtnl, $iar);
170
        }
171
        return $this->setArrayToSelect($selectOptions, $selectValue, $value['COLUMN_NAME'], $inAdtnl);
172
    }
173
174
    /**
175
     * Returns a Char field 2 use in a form
176
     *
177
     * @param string $tbl
178
     * @param string $fieldType
179
     * @param array $value
180
     * @param array $iar
181
     * @return string
182
     */
183
    private function getFieldOutputText($tbl, $fieldType, $value, $iar = [])
184
    {
185
        if (!in_array($fieldType, ['char', 'tinytext', 'varchar'])) {
186
            return '';
187
        }
188
        $foreignKeysArray = $this->getFieldOutputTextPrerequisites($tbl, $value);
189
        if (!is_null($foreignKeysArray)) {
190
            return $this->getFieldOutputTextFK($foreignKeysArray, $value, $iar);
191
        }
192
        return $this->getFieldOutputTextNonFK($value, $iar);
193
    }
194
195
    /**
196
     * Returns a Text field 2 use in a form
197
     *
198
     * @param string $fieldType
199
     * @param array $value
200
     * @param array $iar
201
     * @return string
202
     */
203
    private function getFieldOutputTextLarge($fieldType, $value, $iar = [])
204
    {
205
        if (!in_array($fieldType, ['blob', 'text'])) {
206
            return '';
207
        }
208
        $inAdtnl = [
209
            'name' => $value['COLUMN_NAME'],
210
            'id'   => $value['COLUMN_NAME'],
211
            'rows' => 4,
212
            'cols' => 55,
213
        ];
214
        if ($iar !== []) {
215
            $inAdtnl = array_merge($inAdtnl, $iar);
216
        }
217
        return $this->setStringIntoTag($this->getFieldValue($value), 'textarea', $inAdtnl);
218
    }
219
220
    /**
221
     * Prepares the text output fields
222
     *
223
     * @param string $tbl
224
     * @param array $value
225
     * @return null|array
226
     */
227
    private function getFieldOutputTextPrerequisites($tbl, $value)
228
    {
229
        $foreignKeysArray = null;
230
        if (($tbl != 'user_rights') && ($value['COLUMN_NAME'] != 'eid')) {
231
            $database = $this->advCache['workingDatabase'];
232
            if (strpos($tbl, '`.`')) {
233
                $database = substr($tbl, 0, strpos($tbl, '`.`'));
234
            }
235
            $foreignKeysArray = $this->getForeignKeysToArray($database, $tbl, $value['COLUMN_NAME']);
236
        }
237
        return $foreignKeysArray;
238
    }
239
240
    /**
241
     * Returns a Time field 2 use in a form
242
     *
243
     * @param array $value
244
     * @param array $iar
245
     * @return string
246
     */
247
    private function getFieldOutputTime($value, $iar = [])
248
    {
249
        return $this->getFieldOutputTT($value, 8, $iar);
250
    }
251
252
    /**
253
     * Returns a Timestamp field 2 use in a form
254
     *
255
     * @param array $dtl
256
     * @param array $iar
257
     * @return string
258
     */
259
    private function getFieldOutputTimestamp($dtl, $iar = [])
260
    {
261
        if (($dtl['COLUMN_DEFAULT'] == 'CURRENT_TIMESTAMP') || ($dtl['EXTRA'] == 'on update CURRENT_TIMESTAMP')) {
262
            return $this->getTimestamping($dtl)['input'];
263
        }
264
        $input = $this->getFieldOutputTT($dtl, 19, $iar);
265
        if (!array_key_exists('readonly', $iar)) {
266
            $input .= $this->setCalendarControlWithTime($dtl['COLUMN_NAME']);
267
        }
268
        return $input;
269
    }
270
271
    /**
272
     * Returns a Year field 2 use in a form
273
     *
274
     * @param array $details
275
     * @param array $iar
276
     * @return string
277
     */
278
    private function getFieldOutputYear($tblName, $details, $iar)
279
    {
280
        $listOfValues = [];
281
        for ($cntr = 1901; $cntr <= 2155; $cntr++) {
282
            $listOfValues[$cntr] = $cntr;
283
        }
284
        if ($iar == []) {
285
            $slDflt = $this->getFieldValue($details);
286
            return $this->setArrayToSelect($listOfValues, $slDflt, $details['COLUMN_NAME'], ['size' => 1]);
287
        }
288
        return $this->getFieldOutputText($tblName, 'varchar', $details, $iar);
289
    }
290
291
    /**
292
     * Returns an array with fields referenced by a Foreign key
293
     *
294
     * @param string $database
295
     * @param string $tblName
296
     * @param string|array $onlyCol
297
     * @return array
298
     */
299
    private function getForeignKeysToArray($database, $tblName, $onlyCol = '')
300
    {
301
        $this->setTableForeignKeyCache($database, $this->fixTableSource($tblName));
302
        $array2return = null;
303
        if (isset($this->advCache['tableFKs'][$database][$tblName])) {
304
            foreach ($this->advCache['tableFKs'][$database][$tblName] as $value) {
305
                if ($value['COLUMN_NAME'] == $onlyCol) {
306
                    $query                  = $this->getForeignKeysQuery($value);
307
                    $targetTblTxtFlds       = $this->setMySQLquery2Server($query, 'full_array_key_numbered')['result'];
308
                    $array2return[$onlyCol] = [
309
                        $this->glueDbTb($value['REFERENCED_TABLE_SCHEMA'], $value['REFERENCED_TABLE_NAME']),
310
                        $value['REFERENCED_COLUMN_NAME'],
311
                        '`' . $targetTblTxtFlds[0]['COLUMN_NAME'] . '`',
312
                    ];
313
                }
314
            }
315
        }
316
        return $array2return;
317
    }
318
319
    /**
320
     * Build label html tag
321
     *
322
     * @param array $details
323
     * @return string
324
     */
325
    private function getLabel($details)
326
    {
327
        return '<span class="fake_label">' . $this->getFieldNameForDisplay($details) . '</span>';
328
    }
329
330
    /**
331
     * Returns an array with possible values of a SET or ENUM column
332
     *
333
     * @param string $refTbl
334
     * @param string $refCol
335
     * @return array
336
     */
337
    protected function getSetOrEnum2Array($refTbl, $refCol)
338
    {
339
        $dat = $this->establishDatabaseAndTable($refTbl);
340
        foreach ($this->advCache['tableStructureCache'][$dat[0]][$dat[1]] as $value) {
341
            if ($value['COLUMN_NAME'] == $refCol) {
342
                $clndVls = explode(',', str_replace([$value['DATA_TYPE'], '(', "'", ')'], '', $value['COLUMN_TYPE']));
343
                $enmVls  = array_combine($clndVls, $clndVls);
344
                if ($value['IS_NULLABLE'] === 'YES') {
345
                    $enmVls['NULL'] = '';
346
                }
347
            }
348
        }
349
        ksort($enmVls);
350
        return $enmVls;
351
    }
352
353
    /**
354
     * Returns a timestamp field value
355
     *
356
     * @param array $dtl
357
     * @return array
358
     */
359
    private function getTimestamping($dtl)
360
    {
361
        $fieldValue = $this->getFieldValue($dtl);
362
        $inM        = $this->setStringIntoTag($fieldValue, 'span');
363
        if (in_array($fieldValue, ['', 'CURRENT_TIMESTAMP', 'NULL'])) {
364
            $mCN = [
365
                'InsertDateTime'        => 'data/timpul ad. informatiei',
366
                'ModificationDateTime'  => 'data/timpul modificarii inf.',
367
                'modification_datetime' => 'data/timpul modificarii inf.',
368
            ];
369
            if (array_key_exists($dtl['COLUMN_NAME'], $mCN)) {
370
                $inM = $this->setStringIntoTag($mCN[$dtl['COLUMN_NAME']], 'span', ['style' => 'font-style:italic;']);
371
            }
372
        }
373
        return ['label' => $this->getLabel($dtl), 'input' => $inM];
374
    }
375
376
    /**
377
     * Builds field output w. special column name
378
     *
379
     * @param string $tableSource
380
     * @param array $dtl
381
     * @param array $features
382
     * @param string $fieldLabel
383
     * @return array
384
     */
385
    private function setField($tableSource, $dtl, $features, $fieldLabel)
386
    {
387
        if ($dtl['COLUMN_NAME'] == 'host') {
388
            $inVl = gethostbyaddr($this->tCmnRequest->server->get('REMOTE_ADDR'));
389
            return [
390
                'label' => '<label for="' . $dtl['COLUMN_NAME'] . '">Numele calculatorului</label>',
391
                'input' => '<input type="text" name="host" size="15" readonly value="' . $inVl . '" />',
392
            ];
393
        }
394
        $result = $this->setFieldInput($tableSource, $dtl, $features);
395
        return ['label' => $this->setFieldLabel($dtl, $features, $fieldLabel), 'input' => $result];
396
    }
397
398
    /**
399
     * Builds field output w. another special column name
400
     *
401
     * @param string $tableSource
402
     * @param array $dtl
403
     * @param array $features
404
     * @return string
405
     */
406
    private function setFieldInput($tableSource, $dtl, $features)
407
    {
408
        if ($dtl['COLUMN_NAME'] == 'ChoiceId') {
409
            return '<input type="text" name="ChoiceId" value="'
410
                    . $this->tCmnRequest->request->get($dtl['COLUMN_NAME']) . '" />';
411
        }
412
        return $this->setNeededFieldByType($tableSource, $dtl, $features);
413
    }
414
415
    /**
416
     * Returns a generic form based on a given table
417
     *
418
     * @param string $tblSrc
419
     * @param array $feat
420
     * @param array $hdnInf
421
     *
422
     * @return string Form to add/modify detail for a single row within a table
423
     */
424
    protected function setFormGenericSingleRecord($tblSrc, $feat, $hdnInf = [])
425
    {
426
        echo $this->setStringIntoTag('', 'div', ['id' => 'loading']);
427
        $this->setTableCache($tblSrc);
428
        if (strpos($tblSrc, '.') !== false) {
429
            $tblSrc = explode('.', str_replace('`', '', $tblSrc))[1];
430
        }
431
        $sReturn = [];
432
        if (count($this->advCache['tableStructureCache'][$this->advCache['workingDatabase']][$tblSrc]) != 0) {
433
            foreach ($this->advCache['tableStructureCache'][$this->advCache['workingDatabase']][$tblSrc] as $value) {
434
                $sReturn[] = $this->setNeededField($tblSrc, $value, $feat);
435
            }
436
        }
437
        $frmFtrs = ['id' => $feat['id'], 'action' => $feat['action'], 'method' => $feat['method']];
438
        return $this->setStringIntoTag(implode('', $sReturn) . $this->setFormButtons($feat, $hdnInf), 'form', $frmFtrs)
439
                . $this->setFormJavascriptFinal($feat['id']);
440
    }
441
442
    /**
443
     * Analyse the field and returns the proper line 2 use in forms
444
     *
445
     * @param string $tableSource
446
     * @param array $details
447
     * @param array $features
448
     * @return string|array
449
     */
450
    private function setNeededField($tableSource, $details, $features)
451
    {
452
        if (isset($features['hidden'])) {
453
            if (in_array($details['COLUMN_NAME'], $features['hidden'])) {
454
                return null;
455
            }
456
        }
457
        $fieldLabel = $this->getFieldNameForDisplay($details);
458
        if ($fieldLabel == 'hidden') {
459
            return null;
460
        }
461
        return $this->setNeededFieldFinal($tableSource, $details, $features, $fieldLabel);
462
    }
463
464
    /**
465
     * Analyse the field type and returns the proper lines 2 use in forms
466
     *
467
     * @param string $tblName
468
     * @param array $dtls
469
     * @param array $features
470
     * @return string|array
471
     */
472
    private function setNeededFieldByType($tblName, $dtls, $features)
473
    {
474
        if (isset($features['special']) && isset($features['special'][$dtls['COLUMN_NAME']])) {
475
            $sOpt = $this->setMySQLquery2Server($features['special'][$dtls['COLUMN_NAME']], 'array_key_value');
476
            return $this->setArrayToSelect($sOpt, $this->getFieldValue($dtls), $dtls['COLUMN_NAME'], ['size' => 1]);
0 ignored issues
show
Bug introduced by
It seems like $sOpt defined by $this->setMySQLquery2Ser...']], 'array_key_value') on line 475 can also be of type string; however, danielgp\common_lib\DomC...lGP::setArrayToSelect() does only seem to accept array, maybe add an additional type check?

If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:

/**
 * @return array|string
 */
function returnsDifferentValues($x) {
    if ($x) {
        return 'foo';
    }

    return array();
}

$x = returnsDifferentValues($y);
if (is_array($x)) {
    // $x is an array.
}

If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.

Loading history...
477
        }
478
        return $this->setNeededFieldKnown($tblName, $dtls, $features);
479
    }
480
481
    private function setNeededFieldKnown($tblName, $dtls, $features)
482
    {
483
        $iar      = $this->handleFeatures($dtls['COLUMN_NAME'], $features);
484
        $sReturn  = '';
485
        $numTypes = ['bigint', 'int', 'mediumint', 'smallint', 'tinyint', 'float', 'double', 'decimal', 'numeric'];
486
        if (in_array($dtls['DATA_TYPE'], $numTypes)) {
487
            $sReturn = $this->getFieldOutputNumeric($tblName, $dtls, $iar);
488
        } elseif (in_array($dtls['DATA_TYPE'], ['char', 'tinytext', 'varchar', 'enum', 'set', 'text', 'blob'])) {
489
            $sReturn = $this->setNeededFieldTextRelated($tblName, $dtls, $iar);
490
        } elseif (in_array($dtls['DATA_TYPE'], ['date', 'datetime', 'time', 'timestamp', 'year'])) {
491
            $sReturn = $this->setNeededFieldSingleType($tblName, $dtls, $iar);
492
        }
493
        return $this->getFieldCompletionType($dtls) . $sReturn;
494
    }
495
496
    private function setNeededFieldFinal($tableSource, $details, $features, $fieldLabel)
497
    {
498
        $sReturn = $this->setField($tableSource, $details, $features, $fieldLabel);
499
        $lmts    = $this->setFieldNumbers($details);
500
        return '<div>' . $sReturn['label']
501
                . $this->setStringIntoTag($sReturn['input'], 'span', ['class' => 'labell'])
502
                . '<span style="font-size:x-small;font-style:italic;">&nbsp;(max. '
503
                . $lmts['M'] . (isset($lmts['d']) ? ' w. ' . $lmts['d'] . ' decimals' : '') . ')</span>'
504
                . '</div>';
505
    }
506
507
    private function setNeededFieldSingleType($tblName, $dtls, $iar)
508
    {
509
        if ($dtls['DATA_TYPE'] == 'date') {
510
            return $this->getFieldOutputDate($dtls);
511
        } elseif ($dtls['DATA_TYPE'] == 'time') {
512
            return $this->getFieldOutputTime($dtls, $iar);
513
        } elseif (in_array($dtls['DATA_TYPE'], ['datetime', 'timestamp'])) {
514
            return $this->getFieldOutputTimestamp($dtls, $iar);
515
        }
516
        return $this->getFieldOutputYear($tblName, $dtls, $iar);
517
    }
518
519
    private function setNeededFieldTextRelated($tblName, $dtls, $iar)
520
    {
521
        if (in_array($dtls['DATA_TYPE'], ['char', 'tinytext', 'varchar'])) {
522
            return $this->getFieldOutputText($tblName, $dtls['DATA_TYPE'], $dtls, $iar);
523
        } elseif (in_array($dtls['DATA_TYPE'], ['text', 'blob'])) {
524
            return $this->getFieldOutputTextLarge($dtls['DATA_TYPE'], $dtls, $iar);
525
        }
526
        return $this->getFieldOutputEnumSet($tblName, $dtls['DATA_TYPE'], $dtls, $iar);
527
    }
528
529
    /**
530
     * create a Cache for given table to use it in many places
531
     *
532
     * @param string $tblSrc
533
     */
534
    private function setTableCache($tblSrc)
535
    {
536
        $dat = $this->establishDatabaseAndTable($tblSrc);
537
        if (!isset($this->advCache['tableStructureCache'][$dat[0]][$dat[1]])) {
538
            $this->advCache['workingDatabase']                       = $dat[0];
539
            $this->advCache['tableStructureCache'][$dat[0]][$dat[1]] = $this->getMySQLlistColumns([
540
                'TABLE_SCHEMA' => $dat[0],
541
                'TABLE_NAME'   => $dat[1],
542
            ]);
543
            $this->setTableForeignKeyCache($dat[0], $dat[1]);
544
        }
545
    }
546
547
    private function setTableForeignKeyCache($dbName, $tblName)
548
    {
549
        $frgnKs = $this->getMySQLlistIndexes([
550
            'TABLE_SCHEMA'          => $dbName,
551
            'TABLE_NAME'            => $tblName,
552
            'REFERENCED_TABLE_NAME' => 'NOT NULL',
553
        ]);
554
        if (!is_null($frgnKs)) {
555
            $this->advCache['tableFKs'][$dbName][$tblName] = $frgnKs;
556
            $this->advCache['FKcol'][$dbName][$tblName]    = array_column($frgnKs, 'COLUMN_NAME', 'CONSTRAINT_NAME');
557
        }
558
    }
559
}
560