?
Solved

Update Partial Blob

Posted on 2010-01-12
1
Medium Priority
?
405 Views
Last Modified: 2012-05-08
Good afternoon,
Ok this is a strange one, and before anyone states it I know it isnt realy best practise to store files in databases, but it makes life soo much easier for this issue, belive me.

Is it possible to copy a record with a blob filed, and then update part of the second blob.

The idea is to hold a file in the database, copy that file, and instead of transfering the entire files again, only update the parts of the file that has changed. So once the transaction has completed the second file can be downlaoded in it entirity and the file will be complete.

I hope Ive explained it ok, I know its a very weird question, but I need to solve this problem, and this is the best idea I have soo far.

Thank you
insert into files(`myblob`) VALUES (Select `myBlob` from `myTable` where `blobID`=27);

update `myTable` SET `mybob` = mid(`myBlob`,27,5,'myNEWDATA') where `blobID`=27;

So 27 is the start of the blob that needs updating, 5 is the length of the update, and myNEWDATA is the newData from the new file.

Open in new window

0
Comment
Question by:tonelm54
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 

Accepted Solution

by:
tonelm54 earned 0 total points
ID: 26295884
Ive found a solution, so just for reference the SQL code is:-
update `myTable` set `myBlobField` = REPLACE(`myBlobField`, 'oldData', 'newDat');

Open in new window

0

Featured Post

Get MySQL database support online, now!

At Percona’s web store you can order your MySQL database support needs in minutes. No hassles, no fuss, just pick and click. Pay online with a credit card.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As a database administrator, you may need to audit your table(s) to determine whether the data types are optimal for your real-world data needs.  This Article is intended to be a resource for such a task. Preface The other day, I was involved …
This post looks at MongoDB and MySQL, and covers high-level MongoDB strengths, weaknesses, features, and uses from the perspective of an SQL user.
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question