Jump to content

INSERT large text and BLOBs into fields


snorky

Recommended Posts

How to INSERT

  • large amounts of text, e.g., up to 64K
  • blobs of any size

A regular insert would seem to be the way to do it, but I'm puzzled as to how to manage inserting 64 kb of text. Maybe I could do the following, but it looks like trouble waiting to happen.

 

insert into tablename
(lname,fname,location,message,picture,language,beverage)
values("Smith","Jane","New York City","[b][i]beginning of text ... 30k more words ... end of text[/i][/b]","","Pepsi-Cola");

 

Inserting binary data has me stumped completely. Can I use a file path/name instead of text as in

 

insert into tablename
(lname,fname,location,picture,language,beverage)
values("Smith","Jane","New York City",/public_html/images/person.jpg,"","Pepsi-Cola");

 

If so, that would also resolve the insert-big-text problem.

  • If the size of inserted file > column length is the file truncated or does it crash the server?
  • Is there a max length of the query?
  • Is there a buffer that holds the characters in the query? If so, is the buffer size adjustable? Does overflowing the buffer crash anything?

I can't find any of this in the mysql documentation, and haven't found a coherent article that addresses these questions in a context that I can understand. Of course, the key to getting a good answer is to ask a good question. Hence, my predicament. Yet, this must be a very common issue.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.