protected function loadPrefixes(phpMorphy_Dict_Source_Normalized_Ancodes $source, $context, $dictId) { $stmt = $this->engine->prepareInsert('prefixes', array('dict_id', 'id', 'prefix_no', 'prefix')); $map = $context->getPrefixesMap(); foreach ($source->getPrefixes() as $prefix_set) { $no = 0; $prefix_set_id = $this->engine->getExplicitAutoincrementValue(); foreach ($prefix_set->getPrefixes() as $prefix) { $stmt->execute(array($dictId, $prefix_set_id, $no, $this->trim($prefix, 16))); if (!isset($prefix_set_id)) { $prefix_set_id = $this->engine->getLastInsertId('prefixes'); } $no++; } if (!isset($prefix_set_id)) { throw new phpMorphy_Dict_Writer_Sql_Exception("New prefix set without id"); } $map->register($prefix_set->getId(), $prefix_set_id); } }