Skip to content
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

Issue 228. sqlsrv ClientBufferMaxKBSize setting - positive integer. #254

Merged
merged 1 commit into from
Jan 25, 2017

Conversation

v-dareck
Copy link
Contributor

In sqlsrv check that ClientBufferMaxKBSize is a positive integer.
Add new tests for sqlsrv and pdo.

@v-dareck v-dareck requested a review from yitam January 25, 2017 21:54
Copy link
Contributor

@yitam yitam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good except again I wonder why a new database is needed for each test

@@ -592,7 +592,7 @@ PHP_FUNCTION( sqlsrv_configure )

zend_long buffered_query_limit = Z_LVAL_P( value_z );

CHECK_CUSTOM_ERROR( buffered_query_limit < 0, error_ctx, SQLSRV_ERROR_INVALID_BUFFER_LIMIT, _FN_ ) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we update the MSDN doc to specify that buffer size limit must be positive? Just a suggestion.

echo ("Number of rows: $numRows\n");

$size = 3;
$stmt = $conn->prepare("SELECT * FROM ".$dbName.".[dbo].[php_test_table_2]", array(constant('PDO::ATTR_CURSOR') => PDO::CURSOR_SCROLL,PDO::SQLSRV_ATTR_CURSOR_SCROLL_TYPE => PDO::SQLSRV_CURSOR_BUFFERED,PDO::SQLSRV_ATTR_CLIENT_BUFFER_MAX_KB_SIZE=> $size));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please explain why the buffer sizes are different for table 1 and table 2

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the data retrieval is different for varchar(max) and varchar(1000).
A slightly bigger buffer is needed for varchar(max) to work even if inserted data is the same.

fetchData($conn, $dbName.".[dbo].[php_test_table_2]", $size); // this should return 0 rows.
// set client buffer size to 2KB
$size = 2;
fetchData($conn, $dbName.".[dbo].[php_test_table_1]", $size); // this should return 1 row.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the client buffer size requirement 2KB due to UTF-8 char set? It's not clear in this test alone

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The total column length is > 1024 since it's varchar(1036).

@v-dareck v-dareck deleted the github228_clientbuffermaxkbsize branch January 26, 2017 22:44
@Hadis-Fard
Copy link

Please merge this code into 'merged-codebase' branch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants