我有一个大约4.8mb的字符串(只包含base64个karakter,proven)。
但是,当我尝试使用以下语句绑定字符串时:
sqlPrepared_userdb_test->setString(1, Content); //Content is approximately 4.8MB
mysql返回:
Incorrect string value: '\xF7/\x00\x00\xF0...' for column 'Content' at row 1 (error code: 1366, State: HY000)
但是,当我将内容字符串直接包含在查询(内联)中时,插入成功。我使用的内联查询(跳过了中间部分内容):
INSERT INTO Test (Content) Values('ajHEHAU......8837x=='); //Content is approximately 4.8MB
为什么绑定失败,但内联完全相同的字符串成功?
编辑:
Log("Inserting content!", false, "Debug");
for (auto& Char : Content) {
if (Char >= 'a' && Char <= 'z') {
}
else if (Char >= 'A' && Char <= 'Z') {
}
else if (Char >= '0' && Char <= '9') {
}
else if (Char == '+') {
}
else if (Char == '/') {
}
else if (Char == '=') {
}
else {
string Message = "Char in content: ";
Message += Char;
Message += " is not allowed!";
Error(Message);
// NO ERROR REPORTED HERE. CONTENT STRING SEEMS GOOD
}
}
try {
sqlPrepared_userdb_test = mysqli_userdb->prepareStatement("INSERT INTO Test (Content) VALUES(?)");
sqlPrepared_userdb_test->setString(1, Content);
sqlPrepared_userdb_test->executeUpdate();
}
catch (sql::SQLException &e) {
Message = "Database test error: ";
Message += e.what();
Message += " (error code: ";
Message += IntToString(e.getErrorCode());
Message += ", State: ";
Message += e.getSQLState();
Message += ")";
Log(Message, false, "Error");
Error("Database");
// CATCH TRIGGERS
}
outfile.close();
sqlPrepared_userdb->setString(ParamOffset++, Content);
暂无答案!
目前还没有任何答案,快来回答吧!