protected static function _updateRecord($tableName)
    {
        //kod rekordu
        $recordCode = '<?php' . "\n\n" .
            'namespace ' . self::_getNamespace($tableName) . ";\n\n" .
            'class ' . ($className = self::_getNamePrefix($tableName) . 'Record') . ' extends \Mmi\Orm\Record' .
            "\n{" .
            "\n\n" .
            '}' . "\n";
        //ścieżka do pliku
        $path = self::_mkdirRecursive(self::_getPathPrefix($tableName)) . '/' . $className . '.php';
        //wczytanie istniejącego rekordu
        if (file_exists($path)) {
            $recordCode = file_get_contents($path);
        }
        //odczyt struktury tabeli
        $structure = DbConnector::getTableStructure($tableName);
        //błędna struktrura lub brak
        if (empty($structure)) {
            throw new rmException('\Mmi\Orm\Builder: no table found, or table invalid: ' . $tableName);
        }
        $variableString = "\n";
        //generowanie pól rekordu
        foreach ($structure as $fieldName => $fieldDetails) {
            $variables[] = Convert::underscoreToCamelcase($fieldName);
            $variableString .= self::INDENT . 'public $' . Convert::underscoreToCamelcase($fieldName) . ";\n";
        }
        //sprawdzanie istnienia pól rekordu
        if (preg_match_all('/' . self::INDENT . 'public \$([a-zA-Z0-9\_]+)[\;|\s\=]/', $recordCode, $codeVariables) && isset($codeVariables[1])) {
            //za dużo względem bazy
            $diffRecord = array_diff($codeVariables[1], $variables);
            //brakujące względem DB
            $diffDb = array_diff($variables, $codeVariables[1]);
            //pola się nie zgadzają
            if (!empty($diffRecord) || !empty($diffDb)) {
                throw new OrmException('RECORD for: "' . $tableName . '" has invalid fields: ' . implode(', ', $diffRecord) . ', and missing: ' . implode(',', $diffDb));
            }
            return;
        }
        $recordCode = preg_replace('/(class ' . $className . ' extends [\\a-zA-Z0-9]+\n\{?\r?\n?)/', '$1' . $variableString, $recordCode);
        //zapis pliku
        file_put_contents($path, $recordCode);
    }