Solar_Sql_Adapter::_checkIdentifierPart PHP 메소드

_checkIdentifierPart() 보호된 메소드

Checks one part of a dotted identifier (schema.table, database.table, etc). Throws an exception on failure.
protected _checkIdentifierPart ( string $type, string $name, string $part ) : void
$type string The identifier type (table, index, etc).
$name string The full identifier name (with dots, if any).
$part string The part of the name that we're checking.
리턴 void
    protected function _checkIdentifierPart($type, $name, $part)
    {
        // validate identifier length
        $len = strlen($part);
        if ($len < 1 || $len > $this->_maxlen) {
            throw $this->_exception('ERR_IDENTIFIER_LENGTH', array('type' => $type, 'name' => $name, 'part' => $part, 'min' => 1, 'max' => $this->_maxlen, 'len' => $len));
        }
        // only a-z, 0-9, and _ are allowed in words.
        // must start with a letter, not a number or underscore.
        $regex = '/^[a-z][a-z0-9_]*$/';
        if (!preg_match($regex, $name)) {
            throw $this->_exception('ERR_IDENTIFIER_CHARS', array('type' => $type, 'name' => $name, 'part' => $part, 'regex' => $regex));
        }
    }