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

[BUG] Returning only partial results for db queries #742

Closed
AmaliMatharaarachchi opened this issue May 11, 2022 · 1 comment
Closed

[BUG] Returning only partial results for db queries #742

AmaliMatharaarachchi opened this issue May 11, 2022 · 1 comment

Comments

@AmaliMatharaarachchi
Copy link

Describe the bug
Let's say query1 should return 40 result rows.
But it returns only a partial set of the results (e.g. sometimes 8 results only) when timeout context is given.

To Reproduce
I

func withTimeout() {
	var d1 int
	cont, cancel := context.WithTimeout(context.Background(), time.Duration(300)*time.Minute)
	defer cancel()
	row, err := DB.QueryContext(cont, query1)
	if err == nil {
		for {
			if !row.Next() {
				logger.log("No more data")
				break
			} else {
				row.Scan(&d1)
				logger.log(d1)
			}
		}
	} 
}
func withoutTimeout() {
	var d1 int
	row, err := DB.QueryContext(context.Background(), query1)
	if err == nil {
		for {
			if !row.Next() {
				logger.log("No more data")
				break
			} else {
				row.Scan(&d1)
				logger.log(d1)
			}
		}
	} 
}

withTimeout() prints only some records.
withoutTimeout() prints all 40 records.

Note that even we give a large value for the timeout (e.g. 300 min), it still has not work.

Further technical details

SQL Server version: run in docker from mcr.microsoft.com/mssql/server:2019-latest
Operating system: Docker container
version: github.com/denisenkom/go-mssqldb v0.12.0

@AmaliMatharaarachchi
Copy link
Author

duplicate of #743

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

No branches or pull requests

1 participant