| @@ 634-657 (lines=24) @@ | ||
| 631 | * |
|
| 632 | * @return \BfwSql\Actions\AbstractActions |
|
| 633 | */ |
|
| 634 | public function addQuotedColumns(array $columns) |
|
| 635 | { |
|
| 636 | if ($this instanceof Select || $this instanceof Delete) { |
|
| 637 | throw new Exception( |
|
| 638 | 'Sorry, automatic quoted value is not supported into ' |
|
| 639 | .get_called_class().' class', |
|
| 640 | self::ERR_QUOTED_COLUMN_NOT_SUPPORTED |
|
| 641 | ); |
|
| 642 | } |
|
| 643 | ||
| 644 | foreach ($columns as $columnName) { |
|
| 645 | if (isset($this->notQuotedColumns[$columnName])) { |
|
| 646 | throw new Exception( |
|
| 647 | 'The column '.$columnName.' is already declared to be a' |
|
| 648 | .' not quoted value.', |
|
| 649 | self::ERR_COLUMN_ALREADY_DEFINE_NOT_QUOTED |
|
| 650 | ); |
|
| 651 | } |
|
| 652 | ||
| 653 | $this->quotedColumns[$columnName] = true; |
|
| 654 | } |
|
| 655 | ||
| 656 | return $this; |
|
| 657 | } |
|
| 658 | ||
| 659 | /** |
|
| 660 | * Declare columns should not be automatic quoted if value is string. |
|
| @@ 668-691 (lines=24) @@ | ||
| 665 | * |
|
| 666 | * @return \BfwSql\Actions\AbstractActions |
|
| 667 | */ |
|
| 668 | public function addNotQuotedColumns(array $columns) |
|
| 669 | { |
|
| 670 | if ($this instanceof Select || $this instanceof Delete) { |
|
| 671 | throw new Exception( |
|
| 672 | 'Sorry, automatic quoted value is not supported into ' |
|
| 673 | .get_called_class().' class', |
|
| 674 | self::ERR_QUOTED_COLUMN_NOT_SUPPORTED |
|
| 675 | ); |
|
| 676 | } |
|
| 677 | ||
| 678 | foreach ($columns as $columnName) { |
|
| 679 | if (isset($this->quotedColumns[$columnName])) { |
|
| 680 | throw new Exception( |
|
| 681 | 'The column '.$columnName.' is already declared to be a' |
|
| 682 | .' quoted value.', |
|
| 683 | self::ERR_COLUMN_ALREADY_DEFINE_QUOTED |
|
| 684 | ); |
|
| 685 | } |
|
| 686 | ||
| 687 | $this->notQuotedColumns[$columnName] = true; |
|
| 688 | } |
|
| 689 | ||
| 690 | return $this; |
|
| 691 | } |
|
| 692 | ||
| 693 | /** |
|
| 694 | * Quote a value if need, else return the value passed in parameter |
|