-
Notifications
You must be signed in to change notification settings - Fork 374
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
add error handling for fetching stream with always encrypted #621
Conversation
Codecov Report
@@ Coverage Diff @@
## dev #621 +/- ##
==========================================
- Coverage 77.17% 77.15% -0.02%
==========================================
Files 25 25
Lines 7308 7315 +7
==========================================
+ Hits 5640 5644 +4
- Misses 1668 1671 +3
Continue to review full report at Codecov.
|
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.
Done my first round
source/shared/core_stmt.cpp
Outdated
@@ -1711,6 +1711,9 @@ void core_get_field_common( _Inout_ sqlsrv_stmt* stmt, _In_ SQLUSMALLINT field_i | |||
// for how these fields are used. | |||
case SQLSRV_PHPTYPE_STREAM: | |||
{ | |||
CHECK_CUSTOM_ERROR(stmt->conn->ce_option.enabled, stmt, SQLSRV_ERROR_ENCRYPTED_STREAM_FETCH) { | |||
throw core::CoreException(); | |||
} | |||
|
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.
please fix the spacing
{ | ||
SQLSRV_ERROR_ENCRYPTED_STREAM_FETCH, | ||
{ IMSSP, (SQLCHAR*) "Connection with Column Encryption enabled does not support fetching stream. Please fetch the data as a string.", -84, false } | ||
}, | ||
{ UINT_MAX, {} } |
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.
Do we have to add this error in PDO when it doesn't support returning streams?
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.
Since the error is thrown in the core code, it needs to be here to compile.
|
||
$tableName = "test_max_fields"; | ||
dropTable($conn, $tableName); | ||
AE\createTable($conn, $tableName, array(new AE\ColumnMeta("varchar(max)", "varchar_max_col"))); |
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.
there's no need to drop table here because createTable will do it :)
} else { | ||
fatalError("Error in getting stream!"); | ||
} | ||
} |
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.
perhaps simplify this checking because $stream is expected to fail with AE?
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.
use PHP_STREAM_BUFFER_SIZE?
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.
@yitam But the test should work without AE too right?
@lilgreenbird where did you get that constant from? somehow when I put it in the test it returns undefined constant
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.
I just thought you could check if AE is enabled first and expected it to fail with the correct message?
Otherwise, it should pass with the results matched?
#615
This change is