All SELECTs work correctly. However, any UPDATE or INSERT, even if it works when it is executed in the mysql query browser, connects to the server when logging in with the same user as PHP, and fails when executing PDO.
As an example:
SELECT * FROM Projects WHERE ssdUserID = :ssdUserID;
works correctly all the time whereas
INSERT INTO Projects SET ssdUserID = :ssdUserID, json = :json;
always executed when PHP is executed, although I add addlashes () for all parameters.
What I call PDO consists of prepared statements:
$connection = new PDO("mysql:host=$mysqlServer;
dbname=$mysqlSchema", $mysqlUser, $mysqlPassword);;
$statement = $connection->prepare($sql);
$result = $statement->execute($parameters);
$ result is always false, and although a commit occurs at the end (for debugging purposes at the moment), there is no update or insertion in the database.
mysql, , sql mysql - , , - , .
, , PDO . , , , , - , , PDO.
, , , json . PDO , VARCHAR, .
- ? - ?
Update:
(http://www.php.net/manual/en/pdo.lobs.php) . inpput , . , ppl, , , .
. :
01 private function __extractResultsEx($statement, $columns)
02 {
03 $data = array();
04 $msg = "query returned ".$statement->rowCount()." rows";
05 $receiverRow = array();
06 $i = 1;
07 foreach ($columns as $column => $type)
08 {
09 $receiverRow[$column] = NULL;
10 $statement->bindColumn($i++, &$receiverRow[$column], $type);
11 }
12 while ($statement->fetch(PDO::FETCH_BOUND))
13 {
14 $row = array();
15 foreach ($columns as $column => $type)
16 $row[$column] = $receiverRow[$column];
17 $data[] = $row;
18 }
19 return $data;
20 }
: ID/PDO:: PARAM_INT, userID/PDO:: PARAM_INT json/PDO:: PARAM_LOB.
, 09, , $receiverRow , , , , .
, 04 $, , while ( 14-17), $statement-fetch() false, no PDO:: FETCH_ ( PDO:: FETCH_OBJ, PDO:: FETCH_BOUND PDO:: FETCH_ASSOC, , , , PDO:: FETCH_BOUND ).
, , , LOB . , , , , , , .
However, one improvement now. The mySQL trace shows the SQL that I am executing. Also, since line 04 is talking about the line that I am expecting, I suppose I'm close to a solution, but it seems like I can't nail it.