0

我有一个像

<?xml version="1.0" encoding="UTF-8"?>
<fcd-export>
    <timestep time="21600.00">
        <vehicle id="35092_35092_353" x="15957.04" y="6766.28" angle="-20.81" type="passenger_P_14_1" speed="0.00" pos="4.60" lane="-25585097_0" slope="0.00"/>
        <vehicle id="39328_39328_360" x="17130.05" y="19503.58" angle="10.26" type="passenger_P_14_1" speed="0.00" pos="4.60" lane="23839407#0_0" slope="0.00"/>
        <vehicle id="41136_41136_361" x="9060.15" y="16419.84" angle="-4.45" type="passenger_P_14_1" speed="0.00" pos="4.60" lane="20683992#1_0" slope="0.00"/>
        <vehicle id="44930_44930_362" x="9219.87" y="14016.02" angle="-100.00" type="passenger_P_14_1" speed="0.00" pos="4.60" lane="-157393121#3_0" slope="0.00"/>
        <vehicle id="48989_48989_366" x="14834.41" y="16869.85" angle="-171.25" type="passenger_P_14_1" speed="0.00" pos="4.60" lane="49292083#0_0" slope="0.00"/>
    </timestep>
    <timestep time="21601.00">
        <vehicle id="35092_35092_353" x="15956.44" y="6764.72" angle="-20.81" type="passenger_P_14_1" speed="1.67" pos="6.27" lane="-25585097_0" slope="0.00"/>
        <vehicle id="36884_36884_357" x="7568.78" y="14312.49" angle="89.14" type="passenger_P_14_1" speed="0.00" pos="4.60" lane="75656253_0" slope="0.00"/>
        <vehicle id="39197_39197_360" x="19736.51" y="20503.63" angle="-114.77" type="passenger_P_14_1" speed="0.00" pos="4.60" lane="25413481#0_0" slope="0.00"/>
        <vehicle id="39328_39328_360" x="17130.40" y="19501.65" angle="10.26" type="passenger_P_14_1" speed="1.96" pos="6.56" lane="23839407#0_0" slope="0.00"/>
        <vehicle id="41136_41136_361" x="9059.96" y="16417.31" angle="-4.45" type="passenger_P_14_1" speed="2.54" pos="7.14" lane="20683992#1_0" slope="0.00"/>
        <vehicle id="41383_41383_361" x="17941.36" y="14232.66" angle="100.09" type="passenger_P_14_1" speed="0.00" pos="4.60" lane="42551572#3_0" slope="0.00"/>
        <vehicle id="41720_41720_361" x="17601.61" y="12980.92" angle="68.50" type="passenger_P_14_1" speed="0.00" pos="4.60" lane="132408336#3_0" slope="0.00"/>
        <vehicle id="42276_42276_361" x="5391.08" y="13878.96" angle="79.21" type="passenger_P_14_1" speed="0.00" pos="4.60" lane="135556243#2_0" slope="0.00"/>
        <vehicle id="44930_44930_362" x="9218.45" y="14016.27" angle="-100.00" type="passenger_P_14_1" speed="1.44" pos="6.04" lane="-157393121#3_0" slope="0.00"/>
        <vehicle id="48989_48989_366" x="14834.16" y="16871.66" angle="-171.89" type="passenger_P_14_1" speed="1.83" pos="6.43" lane="49292083#0_0" slope="0.00"/>
    </timestep>
</fcd-export>

我正在尝试使用LOAD XML LOCAL INFILE命令将文件(大小 = 7.4GB)导入 mysql 表。我试图避免自己创建表格的结构..

任何帮助,都会很棒!

4

1 回答 1

0
CREATE TABLE vehicles (
    time    DECIMAL(7,2) NOT NULL,
    id      VARCHAR(255) NOT NULL,
    x       DECIMAL(7,2),
    y       DECIMAL(7,2),
    angle   DECIMAL(5,2),
    type    VARCHAR(255),
    speed   DECIMAL(3,2),
    pos     DECIMAL(3,2),
    lane    VARCHAR(255),
    slope   DECIMAL(3,2),
    PRIMARY KEY(time, id)
);

LOAD XML LOCAL INFILE '/path/to/data.xml'
    INTO TABLE vehicles
    ROWS IDENTIFIED BY '<vehicle>';
于 2013-07-10T13:27:41.580 回答