# MySQL - INSERT blob or long text



## snorkytheweasel (May 3, 2006)

How do I INSERT a blob or a long text string (up to 64KB) into a blob field or text field?


----------



## MMJ (Oct 15, 2006)

What's wrong with a regular insert?

What are you currently trying?


----------



## snorkytheweasel (May 3, 2006)

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.


----------

