MySQL通过将Blob数据分成几部分来检索 [英] MySQL retrieving blob data by dividing it into pieces

查看:86
本文介绍了MySQL通过将Blob数据分成几部分来检索的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否有可能通过php从MySQL服务器中检索绘图数据.例如,我有一个视频文件存储在数据库中.我不想等待下载整个文件来播放它.例如,在youtube中,您无需等待整个文件被下载.收到头几秒钟后便开始播放.

I wonder if it's possible to retrieve the plot data from MySQL server via php by pieces. For example I have a video file stored in the database. I don't want to wait for the whole file to be downloaded to play it. For example in youtube, you don't need to wait for the whole file to be downloaded. It starts to play as soon as first few seconds are received.

我正在做一个迅速的项目,我需要从数据库中下载视频文件并进行播放.我知道如何整体下载它,但我需要和平下载并在后台下载时播放.

Im working on a swift project where I need to download video file from my database and play it. I know how can I download it as whole but I need to download it by peaces and play it while downloading it at the background.

推荐答案

您可以使用 SUBSTR .

SELECT SUBSTR(blobColumn, 1, 5000) AS first500bytes
FROM yourTable
WHERE <conditions>

然后下一个查询可以返回 SUBSTR(blobColumn,5001,5000)以获取下一个块,依此类推.

Then the next query can return SUBSTR(blobColumn, 5001, 5000) to get the next block, and so on.

这篇关于MySQL通过将Blob数据分成几部分来检索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆