@@ -6,6 +6,9 @@ discard block |
||
| 6 | 6 | define('MYSQL_CLIENT_INTERACTIVE', MYSQLI_CLIENT_INTERACTIVE); |
| 7 | 7 | define('MYSQL_CLIENT_SSL', MYSQLI_CLIENT_SSL); |
| 8 | 8 | |
| 9 | + /** |
|
| 10 | + * @param string $hostname |
|
| 11 | + */ |
|
| 9 | 12 | function mysql_connect( |
| 10 | 13 | $hostname = null, |
| 11 | 14 | $username = null, |
@@ -239,6 +242,9 @@ discard block |
||
| 239 | 242 | return mysqli_fetch_array($result); |
| 240 | 243 | } |
| 241 | 244 | |
| 245 | + /** |
|
| 246 | + * @param mysqli_result $result |
|
| 247 | + */ |
|
| 242 | 248 | function mysql_fetch_assoc($result) /* : array|null */ |
| 243 | 249 | { |
| 244 | 250 | if (\Dshafik\MySQL::checkValidResult($result, __FUNCTION__)) { |
@@ -510,6 +516,9 @@ discard block |
||
| 510 | 516 | static public $last_connection = null; |
| 511 | 517 | static public $connections = []; |
| 512 | 518 | |
| 519 | + /** |
|
| 520 | + * @param string $func |
|
| 521 | + */ |
|
| 513 | 522 | static public function getConnection($link = null, $func = null) |
| 514 | 523 | { |
| 515 | 524 | if ($link !== null) { |
@@ -528,6 +537,9 @@ discard block |
||
| 528 | 537 | return static::$last_connection; |
| 529 | 538 | } |
| 530 | 539 | |
| 540 | + /** |
|
| 541 | + * @param string $what |
|
| 542 | + */ |
|
| 531 | 543 | static public function mysql_field_info(\mysqli_result $result, $field, $what) |
| 532 | 544 | { |
| 533 | 545 | if (!\mysqli_data_seek($result, $field)) { |
@@ -604,6 +616,9 @@ discard block |
||
| 604 | 616 | return false; |
| 605 | 617 | } |
| 606 | 618 | |
| 619 | + /** |
|
| 620 | + * @param string $function |
|
| 621 | + */ |
|
| 607 | 622 | static function checkValidResult($result, $function) |
| 608 | 623 | { |
| 609 | 624 | if (!($result instanceof \mysqli_result)) { |
@@ -615,6 +630,9 @@ discard block |
||
| 615 | 630 | } |
| 616 | 631 | } |
| 617 | 632 | |
| 633 | + /** |
|
| 634 | + * @param string|null $what |
|
| 635 | + */ |
|
| 618 | 636 | protected static function getFieldLength($what, $type) |
| 619 | 637 | { |
| 620 | 638 | if (is_numeric($what)) { |
@@ -657,6 +675,9 @@ discard block |
||
| 657 | 675 | } |
| 658 | 676 | } |
| 659 | 677 | |
| 678 | + /** |
|
| 679 | + * @param string|null $what |
|
| 680 | + */ |
|
| 660 | 681 | protected static function getFieldType($what) |
| 661 | 682 | { |
| 662 | 683 | switch (strtolower($what)) { |
@@ -560,7 +560,7 @@ |
||
| 560 | 560 | $matches[$what] = null; |
| 561 | 561 | } |
| 562 | 562 | if ($what == 'length') { |
| 563 | - return static::getFieldLength($matches[$what], $field['Type']); |
|
| 563 | + return static::getFieldLength($matches[$what], $field['Type']); |
|
| 564 | 564 | } |
| 565 | 565 | return static::getFieldType($matches[$what]); |
| 566 | 566 | case "flags": |
@@ -637,7 +637,7 @@ discard block |
||
| 637 | 637 | } |
| 638 | 638 | |
| 639 | 639 | if (strtolower(substr($type, 0, 3)) == "set") { |
| 640 | - return (int)strlen($what) |
|
| 640 | + return (int) strlen($what) |
|
| 641 | 641 | - 2 // Remove open and closing quotes |
| 642 | 642 | - substr_count($what, "'") // Remove quotes |
| 643 | 643 | + substr_count($what, "'''") // Re-add escaped quotes |
@@ -648,7 +648,7 @@ discard block |
||
| 648 | 648 | ) |
| 649 | 649 | / 2 // We have two quotes per value |
| 650 | 650 | ) |
| 651 | - - 1; // But we have one less comma than values |
|
| 651 | + - 1; // But we have one less comma than values |
|
| 652 | 652 | } |
| 653 | 653 | |
| 654 | 654 | if (strtolower(substr($type, 0, 4) == "enum")) { |