Domanda

Strange behavior with Firebird through PDO.

Environment:

  • On my local machine(Ubuntu 12.04) all works correctly.
  • On remote machine (old Mandriva [kernel 2.6.33.7-server-2mnb])
    only unnamed PDO statements worked...
  • php5.3.14 on both
  • Firebird 2.5 on both

When I tell not worked, I mean:

  • SELECT * FROM Users WHERE username = ? with array($username) - worked
  • SELECT * FROM Users WHERE username = :u with array(':u' => $username) - not

(worked = returns a user with username field equals to $username value)

Questions:

  • Have anybody experience with this behavior?
  • Where should I looking for pdo versions? (I have only PDO Driver for Firebird/InterBase enabled in my phpinfo)

Thanks

Here is my test code:

$user = 'alex';
$pdo = new PDO($dsn, $username, $password);
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$pdo->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
$sql = 'SELECT * FROM Users WHERE username = :u';
$st = $pdo->prepare($sql);
$st->execute(array(':u' => $user));
$rows = $st->fetchAll(PDO::FETCH_ASSOC);
print_r($rows);
È stato utile?

Soluzione

I solve a problem, it was with Mandriva package sources:

urpmi on a remote system has been configured to some local source of 2010 year
Blame on our admin)
I remove this source, reinstall php and pdo from remote package source, and all works now!
I'm happy :)

Thanks to all

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top