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

[database] reporting stored procedures/prepared statements #1491

Open
lmolkova opened this issue Oct 17, 2024 · 3 comments
Open

[database] reporting stored procedures/prepared statements #1491

lmolkova opened this issue Oct 17, 2024 · 3 comments
Assignees
Labels

Comments

@lmolkova
Copy link
Contributor

See #1482 (comment)

E.g. query like CALL procedure-name should result in the following attributes:

db.query.text = "CALL procedure-name"
db.operation.name = "CALL"
db.collection.name = "procedure-name"

We should document that collection name can contain stored procedure/prepared statement name

@lmolkova
Copy link
Contributor Author

lmolkova commented Oct 25, 2024

Discussed at DB SIG call, decided to rename collection to target and wider its scope.

Related:

@trask
Copy link
Member

trask commented Nov 10, 2024

if we don't go ahead with #1527, we may also consider introducing something like db.stored_procedure.name

I don't think I've worked with "named" prepared statements, do you have an example of that? thanks

@matt-hensley
Copy link

Microsoft SQL Server returns an integer handle that isn't worth recording IMO. I believe SQLite does something similar.

MySQL, MariaDB, and PostgresSQL support named prepared statements. Invocation is similar to stored procedures.

MySQL and MariaDB

mysql> PREPARE stmt1 FROM 'SELECT SQRT(POW(?,2) + POW(?,2)) AS hypotenuse';
mysql> SET @a = 3;
mysql> SET @b = 4;
mysql> EXECUTE stmt1 USING @a, @b;
+------------+
| hypotenuse |
+------------+
|          5 |
+------------+
mysql> DEALLOCATE PREPARE stmt1;

PostgreSQL

PREPARE fooplan (int, text, bool, numeric) AS
    INSERT INTO foo VALUES($1, $2, $3, $4);
EXECUTE fooplan(1, 'Hunter Valley', 't', 200.00);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: In Progress
Development

Successfully merging a pull request may close this issue.

4 participants