dbTable::_tag_open PHP Method

_tag_open() public method

XML Callback to process start elements. Elements currently processed are: INDEX, DROP, FIELD, KEY, NOTNULL, AUTOINCREMENT & DEFAULT.
public _tag_open ( &$parser, $tag, $attributes )
    function _tag_open(&$parser, $tag, $attributes)
    {
        $this->currentElement = strtoupper($tag);
        switch ($this->currentElement) {
            case 'INDEX':
                if (!isset($attributes['PLATFORM']) or $this->supportedPlatform($attributes['PLATFORM'])) {
                    xml_set_object($parser, $this->addIndex($attributes));
                }
                break;
            case 'DATA':
                if (!isset($attributes['PLATFORM']) or $this->supportedPlatform($attributes['PLATFORM'])) {
                    xml_set_object($parser, $this->addData($attributes));
                }
                break;
            case 'DROP':
                $this->drop();
                break;
            case 'FIELD':
                // Add a field
                $fieldName = $attributes['NAME'];
                $fieldType = $attributes['TYPE'];
                $fieldSize = isset($attributes['SIZE']) ? $attributes['SIZE'] : NULL;
                $fieldOpts = isset($attributes['OPTS']) ? $attributes['OPTS'] : NULL;
                $this->addField($fieldName, $fieldType, $fieldSize, $fieldOpts);
                break;
            case 'KEY':
            case 'NOTNULL':
            case 'AUTOINCREMENT':
                // Add a field option
                $this->addFieldOpt($this->current_field, $this->currentElement);
                break;
            case 'DEFAULT':
                // Add a field option to the table object
                // Work around ADOdb datadict issue that misinterprets empty strings.
                if ($attributes['VALUE'] == '') {
                    $attributes['VALUE'] = " '' ";
                }
                $this->addFieldOpt($this->current_field, $this->currentElement, $attributes['VALUE']);
                break;
            case 'DEFDATE':
            case 'DEFTIMESTAMP':
                // Add a field option to the table object
                $this->addFieldOpt($this->current_field, $this->currentElement);
                break;
            default:
                // print_r( array( $tag, $attributes ) );
        }
    }