bug73448.phpt 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. --TEST--
  2. Bug #73448 odbc_errormsg returns trash, always 513 bytes
  3. --EXTENSIONS--
  4. odbc
  5. --SKIPIF--
  6. <?php include 'skipif.inc'; ?>
  7. --FILE--
  8. <?php
  9. include 'config.inc';
  10. $conn = odbc_connect($dsn, $user, $pass);
  11. $sqlCommandList = array(
  12. "/* empty batch is without error */",
  13. "/* non existent procedure xy */ execute xy",
  14. "/* empty batch,error message is not empty */",
  15. "/* valid select with result */ select * from sys.sysobjects",
  16. "/* another erroneous query */ SELECT * FROM zwiebelfleisch",
  17. "/* valid select with result */ select * from sys.sysobjects",
  18. );
  19. foreach ($sqlCommandList as $exampleNumber => $sql) {
  20. $r = @odbc_exec($conn, $sql);
  21. if (false === $r) {
  22. $e = odbc_errormsg($conn);
  23. $n = odbc_error($conn);
  24. var_dump($sql, $n, $e);
  25. echo "\n";
  26. }
  27. if ($r) {
  28. odbc_free_result($r);
  29. }
  30. }
  31. odbc_close($conn);
  32. ?>
  33. --EXPECTF--
  34. string(42) "/* non existent procedure xy */ execute xy"
  35. string(5) "37000"
  36. string(%d) "[Microsoft][%s][SQL Server]Could not find stored procedure 'xy'."
  37. string(58) "/* another erroneous query */ SELECT * FROM zwiebelfleisch"
  38. string(5) "S0002"
  39. string(%d) "[Microsoft][%s][SQL Server]Invalid object name 'zwiebelfleisch'."