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

when we call stored procedure it gives a response to every second request #150

Open
VijalPatel opened this issue Feb 3, 2023 · 1 comment

Comments

@VijalPatel
Copy link

VijalPatel commented Feb 3, 2023

I am calling stored procedure using mysql client and I am getting responses on every second request.
Please check below code and response.

import { Client } from "https://deno.land/x/[email protected]/mod.ts";
import Dex from "https://deno.land/x/dex/mod.ts";

const database = "mysql";
let dex = Dex({ client: database });

const client = await new Client().connect({
  hostname: "localhost",
  username: "app",
  password: "123456",
  db: "test_db"
});

var query = dex.raw(" CALL test_getDataUsingSP(?, ?, ?, ?); ", [objParam.fromDate, objParam.toDate, objParam.loggedUserId, objParam.userTypeId]).toString();
const response: any = await client.query(query);
console.log(query)
console.log("response length : ", response.length)

Below are the response we got.

CALL APP_getDashboardInspection('2023-01-30', '2023-02-05', 3, 23);
response length :  3
POST /api/getDataUsingSP :- 361ms
 CALL test_getDataUsingSP('2023-01-30', '2023-02-05', 3, 23);
response length :  undefined
POST /api/getDataUsingSP :- 10ms
 CALL test_getDataUsingSP('2023-01-30', '2023-02-05', 3, 23);
response length :  3
POST /api/getDataUsingSP :- 3ms
 CALL test_getDataUsingSP('2023-01-30', '2023-02-05', 3, 23);
response length :  undefined
POST /api/getDataUsingSP :- 1ms
 CALL test_getDataUsingSP('2023-01-30', '2023-02-05', 3, 23);
response length :  3
POST /api/getDataUsingSP :- 2ms
 CALL test_getDataUsingSP('2023-01-30', '2023-02-05', 3, 23);
response length :  undefined
POST /api/getDataUsingSP :- 1ms

Thanks

@suchislife801
Copy link

Unfortunately, the Deno MySQL module does not have built-in support for handling multiple result sets from stored procedures. To work around this limitation, you can split your stored procedure into multiple procedures, each returning a single result set, and then call each of them sequentially in your code.

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

2 participants