-
Notifications
You must be signed in to change notification settings - Fork 934
Add a generic batcher for insert/update/delete statements, usable with PostgreSQL and others #1588
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
Conversation
Can you add automatic flush if the limit is going to be reached? |
This sounds as a good idea. According to wikipedia, the semi-colon is in the SQL standard (quite lame this standard is not public and forces to find "second hand" sources), so why not naming it But for this PR I think we should then not go more far than using it for PostgreSQL. Further enhancements for using it with other DB should in my opinion be done with another PR.
That 2100 limit is likely specific to SQL-Server, so it would have to be something applied only when this batcher is used for SQL-Server. I think it is a good idea, but for a complementary PR aiming at re-using this generic batcher for SQL-Server. |
…d and renamed the batcher to a more universal name
Done with a test added.
Renamed.
I added the character to be configurable on the generic batcher factory.
As I did the proposed changes we could edit the title of this PR or create a new PR and close this one. |
Unfortunately With With I've removed those three from tests and added a list of unsupported clients in the summary of the batcher. |
…imit when sp_prepexec is used.
Indeed it can not, because the question is about "SQL Compact 4.0 Toolbox", which is a client tool (the question title is misleading about this). The |
Generic batcher additions
The batcher is working by concatenating multiple statements with a semicolon. In order to avoid having duplicate parameter names the
IDriver.GenerateCommand
method is used to generate a new command from the current one, where the passedSqlString
is altered so that the parameter names will start from the latest parameter name of the batch command.Update:
As the batcher does not use any PostgeSQL specifics and neither uses any reflection to do its job, it could be renamed to something more generic if desired. The batcher works on SQL Server (tested on 2012), so it can be used where
SqlClientBatchingBatcher
is not available with the limitation of 2100 parameters.