Skip to content

Conversation

rohkhann
Copy link
Contributor

@rohkhann rohkhann commented Jun 18, 2024

Why make this change?

This change is to give the user the option to decide how much data they want to be able to load into the application memory on the execution of a stored procedure. The restriction is put in place by limiting the amount of data that can be returned by the stored procedure.

What is this change?

This changes edits the stored procedure read logic to stream results from the db. Based on the type of data returned by a column, the appropriate read data streaming function is used (GetBytes, GetChars etc). Only large object types require explicitly streaming from the db (https://learn.microsoft.com/en-us/sql/t-sql/data-types/data-types-transact-sql?view=sql-server-ver16). Currently the large object types we support map to either string objects (for example: nvarchar, varchar, ntext) or byte[] objects (for example: Image)

For stored procedure, we get the information about the result set of the stored procedure and create dbResultSetRows which go into our data table. To create these rows, we read column by column from the dbDataReader. The columnIndex is got from the columnName which can be retrieved from resultset info of the stored procedure. Hence while streaming, we need to specify the ordinal of the column we want to read.

How was this tested?

unit tests added.

@rohkhann
Copy link
Contributor Author

/azp run

@rohkhann
Copy link
Contributor Author

/azp run

@rohkhann rohkhann marked this pull request as draft June 18, 2024 00:48
@rohkhann
Copy link
Contributor Author

/azp run

@rohkhann
Copy link
Contributor Author

/azp run

@rohkhann
Copy link
Contributor Author

/azp run

@rohkhann
Copy link
Contributor Author

/azp run

@rohkhann
Copy link
Contributor Author

/azp run

@rohkhann
Copy link
Contributor Author

/azp run

@rohkhann rohkhann marked this pull request as ready for review June 18, 2024 18:20
@rohkhann
Copy link
Contributor Author

/azp run

@rohkhann
Copy link
Contributor Author

/azp run

@rohkhann
Copy link
Contributor Author

/azp run

@rohkhann
Copy link
Contributor Author

/azp run

@rohkhann
Copy link
Contributor Author

/azp run

Copy link
Contributor

@seantleonard seantleonard left a comment

Choose a reason for hiding this comment

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

just some questions and nits about elaborating on data type names and units of measurement.

rohkhann and others added 3 commits June 19, 2024 12:20
Co-authored-by: Sean Leonard <sean.leonard@microsoft.com>
@rohkhann
Copy link
Contributor Author

/azp run

1 similar comment
@rohkhann
Copy link
Contributor Author

/azp run

@rohkhann rohkhann requested a review from seantleonard June 19, 2024 23:44
@rohkhann rohkhann enabled auto-merge (squash) June 19, 2024 23:56
@rohkhann rohkhann merged commit 4554d0c into main Jun 20, 2024
@rohkhann rohkhann deleted the dev/rohkhann/EnforceDataStreamingLimitsStoredProcedure branch June 20, 2024 00:29
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