views:

1134

answers:

2

I'm trying to do an INSERT into a mysql db and it fails when any of the values are longer than 898 characters. Is there somewhere to get or, better, set this maximum value? I'll hack the string into chunks and store 'em in separate rows if I must, but I'd like to be able to insert up to 2k at a time.

I'm guessing this is php issue as using LONGTEXT or BLOB fields should be more than enough space in the db.

Thanks.

A: 

I'm assuming this is a varchar column you're trying to insert into? If so, I assume the maximum length has been set to 898 or 900 or something like that.

In MySQL 5 the total row size can be up to 65,536 bytes so a varchar can be defined to whatever size keeps the total row size under that.

If you need larger use text (65,536) or longtext (4 billion?).

cletus
I've said in my question that I'm using LONGTEXT and BLOB fields.
Maximillian
+1  A: 

Side Note:

When you get into working with large blobs and text columns, you need to watch out for the MySQL max_allowed_packet variable. I believe it defaults to at least 1M.

gahooa