-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
WIP added db insert ignore support #1868
Conversation
A couple of things here:
|
e16056f
to
57833f1
Compare
Hi, thanks your reply. I saw that you abstract methods which are the same for most databases in the BaseBuilder Class. But the insertIgnore statement is a little bit different for mysql and sqlite. Should i still create these methods in the basebuilder class but for example with empty function body or should i just create the methods in the builder class of mysql,sqlite,.. ? Should i also create new protected methods _insertIgnore(), _insertBatchIgnore() or just new methods for the main public methods?
|
Perhaps a better way is to make a new |
57833f1
to
8bd9ae9
Compare
Yes think so too ;) |
Yes, I'm fine with the changes. They look good. And you reset $ignoreInsert after the inserts, too - so great! Please update docs and add a test for it. |
Yes, but first i have a little question. I found out that the ignore statement is not just valid for insert statements in case of mysql and sqlite. Here in short which driver supports the ignore statement in select, insert, ... |
I'm fine with the idea in general, but it has to work in a broader way, where each database can modify the query as needed. For example. INSERT IGNORE is supported in Postgres 9.5+ through ON CONFLICT DO NOTHING|UPDATE. Other databases may need similar additions when added. So, when coming up with a solution, please keep that in mind, and get it working in Postgres. |
I think tests are kinda useless in that case @lonnieezell ,because the ignore statement is individual per Driver. This is also why there is no check for the DBDriver in case of the Replace Test, because the specification for the Replace query of sqlite is made in the driver builder class. ('INSERT OR REPLACE' instead of just 'REPLACE). |
We have live database tests that run on Travis in each of the databases, so the tests aren't worthless, and they make sure it works with the actual database in a real-world situation. |
docs are missing before a merge is possible ? |
@lonnieezell What do you think ? |
@tada5hi I'm not great with Coveralls but it looks to me like this PR is failing because it thinks you changed a lot more than you did because of all the random spacing changes. Could you revert changes to files that weren't actual code changes (e.g. system/Common.php and system/Debug/Toolbar/Views/toolbarloader.js.php) and merge the current |
Looks good to me, except for the _insert and _insertBatch methods in Postgre/Builder ... those don't seem related to this PR at all. |
I think the content of this one is good, but it has lingered and now needs conflict resolution and maybe some cleanup. @tada5hi are you still available and willing to touch it up a bit? I think we're really close. |
sorry @MGatner missed that mention. |
No worries! Could you glance at #2446 and make sure it's still all good, in your opinion? |
loooks good ;) |
Each pull request should address a single issue, and have a meaningful title.
Description
Added required insert ignore support for sqlite3 and mysql.
Checklist: