| @@ 437-459 (lines=23) @@ | ||
| 434 | * @param array $ar_config |
|
| 435 | * @return string |
|
| 436 | */ |
|
| 437 | protected function GenSelect($ar_config = array()) |
|
| 438 | { |
|
| 439 | if (is_array($ar_config) && !empty($ar_config)) |
|
| 440 | { |
|
| 441 | // Using parts in $ar_config, not all parts |
|
| 442 | // config value has been set already, here only use it's 'name' |
|
| 443 | $ar = &$ar_config; |
|
| 444 | } |
|
| 445 | else |
|
| 446 | { |
|
| 447 | // Using all parts, by this sequence |
|
| 448 | // http://dev.mysql.com/doc/refman/5.0/en/select.html |
|
| 449 | $ar = array('SELECT', 'FROM', 'WHERE', 'GROUPBY', 'HAVING', |
|
| 450 | 'ORDERBY', 'LIMIT'); |
|
| 451 | } |
|
| 452 | $sql = ''; |
|
| 453 | foreach ($ar as $part => $param) |
|
| 454 | { |
|
| 455 | $part = ucfirst(strtolower($part)); |
|
| 456 | $sql .= $this->{"sSql$part"}; |
|
| 457 | } |
|
| 458 | return $sql; |
|
| 459 | } // end of func GenSelect |
|
| 460 | ||
| 461 | ||
| 462 | /** |
|
| @@ 649-670 (lines=22) @@ | ||
| 646 | * @param array $ar_config |
|
| 647 | * @return string |
|
| 648 | */ |
|
| 649 | protected function GenUpdate($ar_config = array()) |
|
| 650 | { |
|
| 651 | if (is_array($ar_config) && !empty($ar_config)) |
|
| 652 | { |
|
| 653 | // Using parts in $ar_config, not all parts |
|
| 654 | // config value has been set already, here only use it's 'name' |
|
| 655 | $ar = &$ar_config; |
|
| 656 | } |
|
| 657 | else |
|
| 658 | { |
|
| 659 | // Using all parts, by this sequence |
|
| 660 | // http://dev.mysql.com/doc/refman/5.0/en/update.html |
|
| 661 | $ar = array('UPDATE', 'SET', 'WHERE', 'ORDERBY', 'LIMIT'); |
|
| 662 | } |
|
| 663 | $sql = ''; |
|
| 664 | foreach ($ar as $part => $param) |
|
| 665 | { |
|
| 666 | $part = ucfirst(strtolower($part)); |
|
| 667 | $sql .= $this->{"sSql$part"}; |
|
| 668 | } |
|
| 669 | return $sql; |
|
| 670 | } // end of func GenUpdate |
|
| 671 | ||
| 672 | ||
| 673 | /** |
|