PHP  
 PHP_HEAD
downloads | QA | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
 

Test Failure Report for ext/odbc/tests/bug73448.phpt ('Bug #73448 odbc_errormsg returns trash, always 513 bytes')

Script

1: <?php
2:
3:
include 'config.inc';
4:
5:
$conn odbc_connect($dsn$user$pass);
6:
7:
$sqlCommandList = array(
8:     
"/* empty batch is without error */",
9:     
"/* non existent procedure xy */ execute xy",
10:     
"/* empty batch,error message is not empty */",
11:     
"/* valid select with result */ select * from sys.sysobjects",
12:     
"/* another erroneous query */ SELECT * FROM zwiebelfleisch",
13:     
"/* valid select with result */ select * from sys.sysobjects",
14: );
15:
16: foreach (
$sqlCommandList as $exampleNumber => $sql) {
17:     
$r = @odbc_exec($conn$sql);
18:
19:     if (
false === $r) {
20:         
$e odbc_errormsg($conn);
21:         
$n odbc_error($conn);
22:
23:         
var_dump($sql$n$estrlen($e));    
24:         echo 
"\n";
25:     }
26:
27:     if (
$r) {
28:         
odbc_free_result($r);
29:     }
30:
31: }
32:
33:
odbc_close($conn);
34:
?>
35:
==DONE==
36:

Expected

string(42) "/* non existent procedure xy */ execute xy"
string(5) "37000"
string(84) "[Microsoft][ODBC SQL Server Driver][SQL Server]Could not find stored procedure 'xy'."
int(84)

string(58) "/* another erroneous query */ SELECT * FROM zwiebelfleisch"
string(5) "S0002"
string(84) "[Microsoft][ODBC SQL Server Driver][SQL Server]Invalid object name 'zwiebelfleisch'."
int(84)

==DONE==

Output

string(42) "/* non existent procedure xy */ execute xy"
string(5) "S1000"
string(105) "[unixODBC][MySQL][ODBC 5.1 Driver][mysqld-5.1.73]Unknown prepared statement handler (xy) given to EXECUTE"
int(105)

string(59) "/* valid select with result */ select * from sys.sysobjects"
string(5) "S1000"
string(124) "[unixODBC][MySQL][ODBC 5.1 Driver][mysqld-5.1.73]SELECT command denied to user 'odbcUser'@'localhost' for table 'sysobjects'"
int(124)

string(58) "/* another erroneous query */ SELECT * FROM zwiebelfleisch"
string(5) "S0002"
string(92) "[unixODBC][MySQL][ODBC 5.1 Driver][mysqld-5.1.73]Table 'odbcDB.zwiebelfleisch' doesn't exist"
int(92)

string(59) "/* valid select with result */ select * from sys.sysobjects"
string(5) "S1000"
string(124) "[unixODBC][MySQL][ODBC 5.1 Driver][mysqld-5.1.73]SELECT command denied to user 'odbcUser'@'localhost' for table 'sysobjects'"
int(124)

==DONE==

Diff

002+ string(5) "S1000"
003+ string(105) "[unixODBC][MySQL][ODBC 5.1 Driver][mysqld-5.1.73]Unknown prepared statement handler (xy) given to EXECUTE"
004+ int(105)
005+ 
006+ string(59) "/* valid select with result */ select * from sys.sysobjects"
007+ string(5) "S1000"
008+ string(124) "[unixODBC][MySQL][ODBC 5.1 Driver][mysqld-5.1.73]SELECT command denied to user 'odbcUser'@'localhost' for table 'sysobjects'"
009+ int(124)
002- string(5) "37000"
003- string(84) "[Microsoft][ODBC SQL Server Driver][SQL Server]Could not find stored procedure 'xy'."
004- int(84)
008- string(84) "[Microsoft][ODBC SQL Server Driver][SQL Server]Invalid object name 'zwiebelfleisch'."
009- int(84)
013+ string(92) "[unixODBC][MySQL][ODBC 5.1 Driver][mysqld-5.1.73]Table 'odbcDB.zwiebelfleisch' doesn't exist"
014+ int(92)
015+ 
016+ string(59) "/* valid select with result */ select * from sys.sysobjects"
017+ string(5) "S1000"
018+ string(124) "[unixODBC][MySQL][ODBC 5.1 Driver][mysqld-5.1.73]SELECT command denied to user 'odbcUser'@'localhost' for table 'sysobjects'"
019+ int(124)

 

Generated at Sat, 09 Sep 2017 03:10:54 +0000 (12 days ago)

Copyright © 2005-2017 The PHP Group
All rights reserved.