dqqpf32897 2015-10-05 18:01
浏览 56

使用blob和字符串保存记录

I have a problem inserting a record with 10 fields of MediumBlob and a title. The error occurs when the title is more than 5 characters. I am free to add any images into the blobs. but the error raises when the title become just more than 5 characters... The error is as below:

SQLSTATE[42000]: Syntax error or access violation: 1118 Row size to large (> >8126). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or >ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 >bytes is stored inline

  • 写回答

1条回答 默认 最新

  • duandu2980 2015-10-05 18:07
    关注

    you should show the output of 'show create table 'table_name' but the error also suggests what you can do to fix the problem to be honest

    ALTER TABLE `test`  ROW_FORMAT=DYNAMIC;
    

    In laravel schema builder will not allow to specify the Row format. You need to use a raw db statement after the table creation

    Schema::create("<table name>", function($table) {
        // here you do all columns supported by the schema builder
    });
    
    // once the table is created use a raw query to ALTER it and add the MEDIUMBLOB
    DB::statement("ALTER TABLE <table name> ROW_FORMAT=DYNAMIC");
    
    评论

报告相同问题?

悬赏问题

  • ¥15 深度学习根据CNN网络模型,搭建BP模型并训练MNIST数据集
  • ¥15 lammps拉伸应力应变曲线分析
  • ¥15 C++ 头文件/宏冲突问题解决
  • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
  • ¥50 安卓adb backup备份子用户应用数据失败
  • ¥20 有人能用聚类分析帮我分析一下文本内容嘛
  • ¥15 请问Lammps做复合材料拉伸模拟,应力应变曲线问题
  • ¥30 python代码,帮调试,帮帮忙吧
  • ¥15 #MATLAB仿真#车辆换道路径规划
  • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建