src/MySQLReplication/Event/RowEvent/RowEvent.php
public function makeTableMapDTO()
    {
        $data = [];
        $data['table_id'] = $this->binaryDataReader->readTableId();
        $this->binaryDataReader->advance(2);
        $data['schema_length'] = $this->binaryDataReader->readUInt8();
        $data['schema_name'] = $this->binaryDataReader->read($data['schema_length']);

        if (Config::checkDataBasesOnly($data['schema_name'])) {
            return null;
        }

        $this->binaryDataReader->advance(1);
        $data['table_length'] = $this->binaryDataReader->readUInt8();
        $data['table_name'] = $this->binaryDataReader->read($data['table_length']);

        if (Config::checkTablesOnly($data['table_name'])) {
            return null;
        }

        $this->binaryDataReader->advance(1);
        $data['columns_amount'] = $this->binaryDataReader->readCodedBinary();
        $data['column_types'] = $this->binaryDataReader->read($data['columns_amount']);

        if ($this->cache->has($data['table_id'])) {
            return new TableMapDTO($this->eventInfo, $this->cache->get($data['table_id']));
        }

        $this->binaryDataReader->readCodedBinary();

        $columns = $this->repository->getFields($data['schema_name'], $data['table_name']);

        $fields = [];
        // if you drop tables and parse of logs you will get empty scheme
        if (!empty($columns)) {
            $columnLength = strlen($data['column_types']);
            for ($i = 0; $i < $columnLength; ++$i) {
                // this a dirty hack to prevent row events containing columns which have been dropped
                if (!isset($columns[$i])) {
                    $columns[$i] = [
                        'COLUMN_NAME' => 'DROPPED_COLUMN_' . $i,
                        'COLLATION_NAME' => null,
                        'CHARACTER_SET_NAME' => null,
                        'COLUMN_COMMENT' => null,
                        'COLUMN_TYPE' => 'BLOB',
                        'COLUMN_KEY' => ''
                    ];

                    $type = ConstFieldType::IGNORE;
                } else {
                    $type = ord($data['column_types'][$i]);
                }

                $fields[$i] = Columns::parse($type, $columns[$i], $this->binaryDataReader);
            }
        }

        $tableMap = new TableMap(
            $data['schema_name'],
            $data['table_name'],
            $data['table_id'],
            $data['columns_amount'],
            $fields
        );

        $this->cache->set($data['table_id'], $tableMap);

        return new TableMapDTO($this->eventInfo, $tableMap);
    }
public function makeTableMapDTO()
    {
        $data = [];
        $data['table_id'] = $this->binaryDataReader->readTableId();
        $this->binaryDataReader->advance(2);
        $data['schema_length'] = $this->binaryDataReader->readUInt8();
        $data['schema_name'] = $this->binaryDataReader->read($data['schema_length']);

        if (Config::checkDataBasesOnly($data['schema_name'])) {
            return null;
        }

        $this->binaryDataReader->advance(1);
        $data['table_length'] = $this->binaryDataReader->readUInt8();
        $data['table_name'] = $this->binaryDataReader->read($data['table_length']);

        if (Config::checkTablesOnly($data['table_name'])) {
            return null;
        }

        $this->binaryDataReader->advance(1);
        $data['columns_amount'] = $this->binaryDataReader->readCodedBinary();
        $data['column_types'] = $this->binaryDataReader->read($data['columns_amount']);

        if ($this->cache->has($data['table_id'])) {
            return new TableMapDTO($this->eventInfo, $this->cache->get($data['table_id']));
        }

        $this->binaryDataReader->readCodedBinary();

        $columns = $this->repository->getFields($data['schema_name'], $data['table_name']);

        $fields = [];
        // if you drop tables and parse of logs you will get empty scheme
        if (!empty($columns)) {
            $columnLength = strlen($data['column_types']);
            for ($i = 0; $i < $columnLength; ++$i) {
                // this a dirty hack to prevent row events containing columns which have been dropped
                if (!isset($columns[$i])) {
                    $columns[$i] = [
                        'COLUMN_NAME' => 'DROPPED_COLUMN_' . $i,
                        'COLLATION_NAME' => null,
                        'CHARACTER_SET_NAME' => null,
                        'COLUMN_COMMENT' => null,
                        'COLUMN_TYPE' => 'BLOB',
                        'COLUMN_KEY' => ''
                    ];

                    $type = ConstFieldType::IGNORE;
                } else {
                    $type = ord($data['column_types'][$i]);
                }

                $fields[$i] = Columns::parse($type, $columns[$i], $this->binaryDataReader);
            }
        }

        $tableMap = new TableMap(
            $data['schema_name'],
            $data['table_name'],
            $data['table_id'],
            $data['columns_amount'],
            $fields
        );

        $this->cache->set($data['table_id'], $tableMap);

        return new TableMapDTO($this->eventInfo, $tableMap);
    }
public function makeTableMapDTO ( ) { $ data = [ ] ; $ data [ 'table_id' ] = $ this -> binaryDataReader -> readTableId ( ) ; $ this -> binaryDataReader -> advance ( 2 ) ; $ data [ 'schema_length' ] = $ this -> binaryDataReader -> readUInt8 ( ) ; $ data [ 'schema_name' ] = $ this -> binaryDataReader -> read ( $ data [ 'schema_length' ] ) ; if ( Config :: checkDataBasesOnly ( $ data [ 'schema_name' ] ) ) { return null ; } $ this -> binaryDataReader -> advance ( 1 ) ; $ data [ 'table_length' ] = $ this -> binaryDataReader -> readUInt8 ( ) ; $ data [ 'table_name' ] = $ this -> binaryDataReader -> read ( $ data [ 'table_length' ] ) ; if ( Config :: checkTablesOnly ( $ data [ 'table_name' ] ) ) { return null ; } $ this -> binaryDataReader -> advance ( 1 ) ; $ data [ 'columns_amount' ] = $ this -> binaryDataReader -> readCodedBinary ( ) ; $ data [ 'column_types' ] = $ this -> binaryDataReader -> read ( $ data [ 'columns_amount' ] ) ; if ( $ this -> cache -> has ( $ data [ 'table_id' ] ) ) { return new TableMapDTO ( $ this -> eventInfo , $ this -> cache -> get ( $ data [ 'table_id' ] ) ) ; } $ this -> binaryDataReader -> readCodedBinary ( ) ; $ columns = $ this -> repository -> getFields ( $ data [ 'schema_name' ] , $ data [ 'table_name' ] ) ; $ fields = [ ] ; // if you drop tables and parse of logs you will get empty scheme if ( ! empty ( $ columns ) ) { $ columnLength = strlen ( $ data [ 'column_types' ] ) ; for ( $ i = 0 ; $ i < $ columnLength ; ++ $ i ) { // this a dirty hack to prevent row events containing columns which have been dropped if ( ! isset ( $ columns [ $ i ] ) ) { $ columns [ $ i ] = [ 'COLUMN_NAME' => 'DROPPED_COLUMN_' . $ i , 'COLLATION_NAME' => null , 'CHARACTER_SET_NAME' => null , 'COLUMN_COMMENT' => null , 'COLUMN_TYPE' => 'BLOB' , 'COLUMN_KEY' => '' ] ; $ type = ConstFieldType :: IGNORE ; } else { $ type = ord ( $ data [ 'column_types' ] [ $ i ] ) ; } $ fields [ $ i ] = Columns :: parse ( $ type , $ columns [ $ i ] , $ this -> binaryDataReader ) ; } } $ tableMap = new TableMap ( $ data [ 'schema_name' ] , $ data [ 'table_name' ] , $ data [ 'table_id' ] , $ data [ 'columns_amount' ] , $ fields ) ; $ this -> cache -> set ( $ data [ 'table_id' ] , $ tableMap ) ; return new TableMapDTO ( $ this -> eventInfo , $ tableMap ) ; }
This describe the structure of a table.
It's send before a change append on a table.
A end user of the lib should have no usage of this

@return TableMapDTO
@throws \Psr\SimpleCache\InvalidArgumentException
@throws BinaryDataReaderException
This describe the structure of a table . It s send before a change append on a table . A end user of the lib should have no usage of this