We have had a PHP script using pdo code with a mySQL database all hosted on our ISP standard LAMP stack without any issues after running for weeks. Boss wants to deploy to Google App Engine and CloudSQL. CloudSQL is populated with same data. Ran it from the GAE dev implementation on the local machine pointing at mySQL and CloudSQL, and it works fine in both cases.
Upon deploying PHP code to GAE in the cloud and changing the pdo connection string to accommodate GAE-to-CloudSQL connection we get the following error:
Fatal error: Call to a member function fetchColumn() on a non-object...
include 'database.php'; //pdo connection with try|catch confirming connection.
$pdo = Database::connect(); //No problems here. We have connection object.
$sql = "SELECT Count(CatalogID) FROM Catalog";
$rows = $pdo->query($sql)->fetchColumn(); //This is the line that throws the error.
Why does GAE handle differently?
Any solutions? (I would strongly prefer to not call rowCount() against a 'Select CatalogID from Catalog;'. There are too many records to bring back. Seems inefficient.)