dsz1966 2011-06-04 20:44
浏览 63
已采纳

使用外部XML更新/填充mysql数据库的有效方法

I am working on a small app that utilizes a game API, unfortunately the API is not the fastest in the universe. It also only outputs large XML files.

I want to grab one of these files and place it directly into a database, this way it is not being queried from their servers each time a user needs to update something. Instead its querying my local database. I would grab it via a cron job every few hours, thus it shouldn't affect performance.

My question is: What is the most efficient way for me to grab the XML file from their server and update my database with their updated version? [As a note, I am using only PHP for this and want to keep it that way.

Thank you for your assistance!

  • 写回答

1条回答 默认 最新

  • dongou2019 2011-06-04 20:59
    关注

    I would parse the XML-file from their server using something like simpleXML.

    I guess the XML-files have elements which are basically the same with other values? In this case, you'll want to create a PreparedStatement and bind new parameters for every entry. This is the most performant way to do this.

    But if you care mostly about performance, PHP isn't the way to go. You could use Java (for example) to parse the XML-File and write the entry's in your Database. With which language you access the filled database is of no concern.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料