I have a function that collects data and puts it into an object. It then converts this object into a json string, and places it into a table. It takes about 30 seconds to do it.
Now, this json string is fairly big (roughly 36mb or so).
But when I execute the query, nothing gets put into the table, and I don't get any errors.
So I did some debugging, and the code now looks like this:
function __construct($total, $allActions, $employees, $branches, $companies, $departments, $lastUpdated, $update = false)
{
echo "Made it to constructor. Update: ".json_encode($update);
global $conn;
$this->Total = $total;
$this->AllActions = $allActions;
$this->Employees = $employees;
$this->Branches = $branches;
$this->Companies = $companies;
$this->Departments = $departments;
$this->LastUpdated = $lastUpdated;
if($update) {
try {
$query = $conn->prepare("INSERT INTO actionplansummarydata_new (json, last_updated) VALUES (?, ?)");
echo "Prepared query.";
if($query->bind_param('ss', json_encode($this), $this->LastUpdated->format("Y-m-d H:i:s"))) {
echo "Bound parameters.";
if ($query->execute()) {
echo "Executed query.";
} else {
echo "Error inserting summary: " . $query->error;
}
} else {
echo "Error binding query: " . $query->error;
}
} catch(Exception $ex) {
echo "Exception: ".$ex->getMessage();
}
}
}
Now, when this is executed, this is the response I get on the page:
Made it to constructor. Update: truePrepared query.Bound parameters.
But I have an if statement here:
if ($query->execute()) {
echo "Executed query.";
} else {
echo "Error inserting summary: " . $query->error;
}
Neither of these gets echoed to the page, nor do I get any exceptions.
I'm completely baffled.
The server is MariaDB 10.4, the json field in the database is longtext, so it should be able to store it.