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

Stored Procedure - Set based [CORE2549] #2959

Closed
firebird-automations opened this issue Jul 7, 2009 · 6 comments
Closed

Stored Procedure - Set based [CORE2549] #2959

firebird-automations opened this issue Jul 7, 2009 · 6 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: sqlguru (sqlguru)

Duplicates CORE2079
Duplicates CORE2080

Firebird is based off the relational model, RDMS are based of the relational model, SQL is based off the relational model so why is it that CRUD based stored procedures still have sequential row-by-row processing instead of a set based solution?

SQL-92 defines table value constructors and SQL 2008 implemented it (although very poorly). The solution would be to have table types based of a table which could be CRUD against and used as OUTPUT parameters in stored procedures.

Here is an example:

CREATE TABLE members
(
mem_username VARCHAR(25) NOT NULL, mem_email VARCHAR(25), mem_password VARCHAR(25), PRIMARY KEY(mem_username)
);

CREATE STORED PROCEDURE create_members
@members members
AS
BEGIN
INSERT INTO members
SELECT mem_username, mem_email, mem_password FROM @members;
END

To use this stored procedure:
DECLARE @members members;
INSERT INTO @members ( ('user1', 'user1email', 'user1pass'), ('user2', 'user2email', 'user2pass'), ('user3', 'user3email', 'user3pass') );
EXECUTE create_members @members;

The syntax above is for SQL Server, but you get the point.

The .NET adapter for Firebird would somehow need to pass a DataTable into the stored procedure. I'm not sure how SQL Server 2008 and the SQLClient provider for .NET does it.

@firebird-automations
Copy link
Collaborator Author

Commented by: @asfernandes

Better syntaxes IMO:

declare members type of table members;

execute procedure create_members (members);

insert into table(members) select ...

@firebird-automations
Copy link
Collaborator Author

Commented by: @cincuranet

This is same as CORE2079 and CORE2080.

@firebird-automations
Copy link
Collaborator Author

Modified by: @asfernandes

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Duplicate [ 3 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @asfernandes

Link: This issue duplicates CORE2079 [ CORE2079 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @asfernandes

Link: This issue duplicates CORE2080 [ CORE2080 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pcisar

status: Resolved [ 5 ] => Closed [ 6 ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant