Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #95596
| References | <871teum9c2.fsf@Equus.decebal.nl> <CAPTjJmqo98J7Uqn=syArxebHX6wFSpA2yVe4TqqRfuoBbFgM0Q@mail.gmail.com> <ibrjta98qvf7s36bmdoqd0cmn49lf6dunb@4ax.com> |
|---|---|
| Date | 2015-08-24 02:22 +1000 |
| Subject | Re: Is this the way to go with SQLite |
| From | Chris Angelico <rosuav@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.37.1440346961.17298.python-list@python.org> (permalink) |
On Mon, Aug 24, 2015 at 2:17 AM, Dennis Lee Bieber <wlfraed@ix.netcom.com> wrote: > SQLite3 supports the non-standard > > INSERT OR REPLACE ... > > (or one can do INSERT OR IGNORE; the OR XXX has a number of values that are > allowed to control behavior... BUT the OR clause only applies if a UNIQUE > constraint would be violated by the INSERT action... So if the field is not > a unique index, no foul is detected) Sure. But that's still the same as MySQL's (equally non-standard) "ON DUPLICATE KEY UPDATE", and various others. It's a way of shoving down a level the common idiom of "do this insert, only if that doesn't work, do this update instead". But that doesn't seem to be what the original code was doing - it was more like "do this insert, but if it's a duplicate based on URL, check if the other fields are the same, and if not... uhh, print something out?", which is far from common. ChrisA
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
Is this the way to go with SQLite Cecil Westerhof <Cecil@decebal.nl> - 2015-08-23 15:18 +0200
Re: Is this the way to go with SQLite Chris Angelico <rosuav@gmail.com> - 2015-08-24 00:03 +1000
Re: Is this the way to go with SQLite Cecil Westerhof <Cecil@decebal.nl> - 2015-08-24 13:00 +0200
Re: Is this the way to go with SQLite Chris Angelico <rosuav@gmail.com> - 2015-08-24 21:26 +1000
Re: Is this the way to go with SQLite Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2015-08-23 12:17 -0400
Re: Is this the way to go with SQLite Chris Angelico <rosuav@gmail.com> - 2015-08-24 02:22 +1000
csiph-web