【发布时间】:2016-03-22 12:19:36
【问题描述】:
我只能在字符串包含 523264 个字符时发送数据。帮助!
include("conn.php");
$stmt = $conn->prepare("INSERT INTO json_t (json_string) VALUES (?)");
$null = NULL;
$stmt->bind_param("b",$null);
$stmt->send_long_data(0, $json_to_save);
$stmt->execute();
$stmt->close();
$conn->close();
我试过了,但还是一样的错误
"执行准备好的语句时出错。行大小太大 (> 8126)。 将某些列更改为 TEXT 或 BLOB 或使用 ROW_FORMAT=DYNAMIC 或 ROW_FORMAT=COMPRESSED 可能会有所帮助。在当前行格式中,BLOB 前缀为 768 字节是内联存储的。”
请帮忙。
$stmt = $conn->prepare("INSERT INTO json_t (json_string) VALUES (?)");
$null = NULL;
$stmt->bind_param("b",$null);
$max_allowed_packet = 100000;
if (!$stmt->bind_param('b', $null))
die("Error binding parameters. {$stmt->error}\n");
echo "<br/><br/>";
foreach(str_split($v, $max_allowed_packet) as $packet )
if (!$stmt->send_long_data(0, $packet))
die("Error sending long packet. {$stmt->error}\n");
echo "<br/><br/>";
if (!$stmt->execute())
die("Error executing prepared statement. {$stmt->error}\n");
OK 问题解决了。我将引擎更改为 MyISAM。
【问题讨论】:
-
执行准备好的语句时出错。行大小太大 (> 8126)。将某些列更改为 TEXT 或 BLOB 或使用 ROW_FORMAT=DYNAMIC 或 ROW_FORMAT=COMPRESSED 可能会有所帮助。在当前行格式中,768 字节的 BLOB 前缀被内联存储。