ID:               37285
 Comment by:       smlerman at gmail dot com
 Reported By:      vldi at yahoo dot com
 Status:           Assigned
 Bug Type:         PDO related
 Operating System: Suse 10
 PHP Version:      5CVS-2006-05-02 (snap)
 Assigned To:      wez
 New Comment:

Well, I found the problem with my code.

$stmt->bindValue(':something', $some_array, PDO::PARAM_INT);

Obviously, trying to bind an array as an integer doesn't work too well.
Some type of error message/exception would be nice to see though.


Previous Comments:
------------------------------------------------------------------------

[2006-05-04 14:59:14] smlerman at gmail dot com

5.1.2 using MySQL.

This also appears to be a problem with prepared queries.
$stmt->execute() returns false, but no exception is raised. Both
$db->errorInfo() and $stmt->errorInfo() show no error (code '00000').
The database log shows the query being prepared, but doesn't show the
execution attempt.

$res = $stmt->execute();
echo "<pre>"; var_dump($res, $stmt->errorInfo(), $db->errorInfo());
echo "</pre>";

bool(false)
array(1) {
  [0]=>
  string(5) "00000"
}
array(1) {
  [0]=>
  string(5) "00000"
}

------------------------------------------------------------------------

[2006-05-02 21:05:00] vldi at yahoo dot com

Description:
------------
PDO does not raise the exception when SQL fails.
Config is: './configure' '--prefix=/usr/local/php5' '--with-openssl'
'--with-kerberos' '--with-zlib' '--with-bz2' '--enable-calendar'
'--with-curl' '--with-curlwrappers' '--enable-exif' '--enable-ftp'
'--with-gettext' '--with-ldap' '--with-ldap-sasl'
'--with-mssql=/usr/local/freetds' '--with-mysql' '--with-mysql-sock'
'--with-mysqli' '--with-unixODBC=/usr' '--with-pdo-mysql'
'--with-pdo-odbc=unixODBC,/usr' '--enable-sockets' '--enable-sysvmsg'
'--enable-sysvsem' '--enable-sysvshm' '--with-xsl' '--with-pear'
'--disable-cgi' '--with-apxs2=/usr/local/apache2/bin/apxs'
'--with-config-file-path=/etc/php.ini' '--enable-debug'

Reproduce code:
---------------
<html><body>
<?php
        $dsn =
'DRIVER=FreeTDS;SERVERNAME=server1;DATABASE=testdb;UID=user1;';
        $dbuser='foolproof';
        $dbpassword='';
        $dbh = null;
        try {
                $dbh = new PDO('odbc:'.$dsn, $dbuser, $dbpassword );
                if ( ! $dbh )  {
                        print "<p>No DBH</p></body></html>";
                        die();
                };
                $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
                $dbh->exec("
                        create procedure pdotest
                        @param_in int = null,
                        @param_out int output
                        as
                        set @param_out = @param_in
                        go
                ");
        } catch ( PDOException $e ) {
                print "<p>Failed: ".$e->getMessage()."</p></body></html>";
                die();
        }
?>
<p>Succedeed</p>
</body></html>

Expected result:
----------------
Expect to either see the new  procedure created, or exception raised.

Actual result:
--------------
The page displays "Succeesed", yet no procedure created in the
database.


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=37285&edit=1

Reply via email to