-
Notifications
You must be signed in to change notification settings - Fork 375
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added more checks for error conditions #965
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
--TEST-- | ||
large types to strings of 1MB size. | ||
--DESCRIPTION-- | ||
This includes a test by providing an invalid php type. | ||
--SKIPIF-- | ||
<?php require('skipif_azure_dw.inc'); ?> | ||
--FILE-- | ||
|
@@ -8,7 +10,7 @@ large types to strings of 1MB size. | |
sqlsrv_configure( 'WarningsReturnAsErrors', 0 ); | ||
sqlsrv_configure( 'LogSeverity', SQLSRV_LOG_SEVERITY_ALL ); | ||
|
||
require( 'MsCommon.inc' ); | ||
require_once( 'MsCommon.inc' ); | ||
|
||
$conn = Connect(); | ||
if( !$conn ) { | ||
|
@@ -59,6 +61,16 @@ large types to strings of 1MB size. | |
die( "sqlsrv_get_field(6) failed." ); | ||
} | ||
|
||
$str = sqlsrv_get_field( $stmt, 0, SQLSRV_PHPTYPE_STRING("UTF") ); | ||
if ($str === false) { | ||
$error = sqlsrv_errors()[0]['message']; | ||
if ($error !== 'Invalid type') { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Invalid type is not very informative... maybe we should reword the message in util.cpp? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree, but it may not be a good idea to modify an old error message since few versions ago. |
||
fatalError('Unexpected error returned'); | ||
} | ||
} else { | ||
echo "Expect sqlsrv_get_field(7) to fail!\n"; | ||
} | ||
|
||
sqlsrv_free_stmt( $stmt ); | ||
sqlsrv_close( $conn ); | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we add a brief note about the error checks in the test description at the beginning of the file? It's added to these pre-existing tests but not mentioned in the test description for all of them.