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

Reading sqlexp.Messages #787

Closed
dmzkrsk opened this issue Jul 12, 2023 · 0 comments
Closed

Reading sqlexp.Messages #787

dmzkrsk opened this issue Jul 12, 2023 · 0 comments

Comments

@dmzkrsk
Copy link

dmzkrsk commented Jul 12, 2023

I try to use sqlexp.Messages as it's implemented in #690

I created a test procedure and run it in docker image mcr.microsoft.com/azure-sql-edge:latest

CREATE OR ALTER PROCEDURE procedureWithPrint
AS
BEGIN
  PRINT N'1';
  PRINT N'2';
  SELECT *
  from example
  WHERE id > 7
  ORDER BY ID desc;
  PRINT N'3';
END;

Using an example code in https://github.com/microsoft/go-mssqldb/blob/main/messages_example_test.go#L69 I get only two first prints, since after the SELECT, NextResultSet returns false

If I remove active = rows.NextResultSet() (so active is always true) I get message with 3, but the loop does not break.

When procedure contains no selects:

CREATE OR ALTER PROCEDURE procedureWithPrint
AS
BEGIN
  PRINT N'1';
  PRINT N'2';
  PRINT N'3';
END;

I get all three messages

Am I doing it wrong? What is correct way to get all three messages AND select results AND make the loop to stop?

@dmzkrsk dmzkrsk closed this as completed Jul 12, 2023
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