Answer the question
In order to leave comments, you need to log in
How to import data from xml file into mysql database?
Hello to all toasts with a crust) I'm Gura, but unfortunately far from being a guru .. There was a need to find another solution.
There is an xml file (epg tv) whose structure is:
<?xml version="1.0" encoding="utf-8" ?><!DOCTYPE tv SYSTEM "...">
<tv generator-info-name="TVH_W/0.751l" generator-info-url="....">
<programme start="20151026074500 +0300" stop="20151026080000 +0300" channel="958">
<title lang="ru">Текст текст текст</title>
</programme>
.
.
.
<programme start="20151026080000 +0300" stop="20151026081000 +0300" channel="958">
<title lang="ru">Текст текст текст </title>
</programme>
</tv>
LOAD XML LOCAL INFILE 'tv.xml'
INTO TABLE test
ROWS IDENTIFIED BY '<programme>'
SET start=DATE_FORMAT(LEFT(start, 14),'%Y-%m-%d %H:%i'),
stop=DATE_FORMAT(LEFT(stop, 14),'%Y-%m-%d %H:%i'), title=SUBSTRING_INDEX(title, ' (', 1);
- but this option generally knocks out the base, I think so because of the amount of information enteredAnswer the question
In order to leave comments, you need to log in
When adding this amount of data, you can temporarily disable indexes so that they do not rebuild each time you add a row. If you make a database dump through mysqldump, you will see the ALTER TABLE ... DISABLE KEYS command before inserting data, after inserting - ALTER TABLE ... DISABLE KEYS.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question