約 4.8MB の文字列があります (BASE64 文字のみを含む、証明済み)。
ただし、このステートメントを使用して文字列をバインドしようとすると:
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);