private function prepareGetSelectRegister()
    {
        $table_descriptor = $this->getStorageDescriptor();

        $fragment = new CNabuPHPMethodBuilder($this, 'getSelectRegister');
        $fragment->addComment('Gets SELECT sentence to load a single register from the storage.');
        $fragment->addComment('@return string Return the sentence.');

        if ($table_descriptor->hasPrimaryConstraint()) {
            $part_if = '';
            $part_where = array();
            foreach ($table_descriptor->getPrimaryConstraintFieldNames() as $field_name) {
                list($if, $where) = $this->buildSelectRegisterFragment($field_name);
                if (strlen($if) > 0 && strlen($where) > 0) {
                    $part_if .= (strlen($part_if) === 0 ? '' : ' && ') . $if;
                    $part_where[] = $where;
                }
            }

            $output = array(
                        "return ($part_if)",
                        "    ? \$this->buildSentence(",
                        "            'select * '",
                        "            . 'from $this->table_name '"
            );

            $c = 0;
            foreach ($part_where as $where) {
                $output[] = ($c++ === 0
                        ? "           . \"where $where \""
                        : "             . \"and $where \"");
            }
            $output[] = "      )";
            $output[] = "    : null;";

            $fragment->addFragment($output);
        }

        $this->addFragment($fragment);
    }
private function prepareGetSelectRegister()
    {
        $table_descriptor = $this->getStorageDescriptor();

        $fragment = new CNabuPHPMethodBuilder($this, 'getSelectRegister');
        $fragment->addComment('Gets SELECT sentence to load a single register from the storage.');
        $fragment->addComment('@return string Return the sentence.');

        if ($table_descriptor->hasPrimaryConstraint()) {
            $part_if = '';
            $part_where = array();
            foreach ($table_descriptor->getPrimaryConstraintFieldNames() as $field_name) {
                list($if, $where) = $this->buildSelectRegisterFragment($field_name);
                if (strlen($if) > 0 && strlen($where) > 0) {
                    $part_if .= (strlen($part_if) === 0 ? '' : ' && ') . $if;
                    $part_where[] = $where;
                }
            }

            $output = array(
                        "return ($part_if)",
                        "    ? \$this->buildSentence(",
                        "            'select * '",
                        "            . 'from $this->table_name '"
            );

            $c = 0;
            foreach ($part_where as $where) {
                $output[] = ($c++ === 0
                        ? "           . \"where $where \""
                        : "             . \"and $where \"");
            }
            $output[] = "      )";
            $output[] = "    : null;";

            $fragment->addFragment($output);
        }

        $this->addFragment($fragment);
    }
private function prepareGetSelectRegister ( ) { $ table_descriptor = $ this -> getStorageDescriptor ( ) ; $ fragment = new CNabuPHPMethodBuilder ( $ this , 'getSelectRegister' ) ; $ fragment -> addComment ( 'Gets SELECT sentence to load a single register from the storage.' ) ; $ fragment -> addComment ( '@return string Return the sentence.' ) ; if ( $ table_descriptor -> hasPrimaryConstraint ( ) ) { $ part_if = '' ; $ part_where = array ( ) ; foreach ( $ table_descriptor -> getPrimaryConstraintFieldNames ( ) as $ field_name ) { list ( $ if , $ where ) = $ this -> buildSelectRegisterFragment ( $ field_name ) ; if ( strlen ( $ if ) > 0 && strlen ( $ where ) > 0 ) { $ part_if .= ( strlen ( $ part_if ) === 0 ? '' : ' && ' ) . $ if ; $ part_where [ ] = $ where ; } } $ output = array ( "return ($part_if)" , "    ? \$this->buildSentence(" , "            'select * '" , "            . 'from $this->table_name '" ) ; $ c = 0 ; foreach ( $ part_where as $ where ) { $ output [ ] = ( $ c ++ === 0 ? "           . \"where $where \"" : "             . \"and $where \"" ) ; } $ output [ ] = "      )" ; $ output [ ] = "    : null;" ; $ fragment -> addFragment ( $ output ) ; } $ this -> addFragment ( $ fragment ) ; }
Prepares the getSelectRegister method
Prepares the getSelectRegister method