Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #62712
| From | Sibylle Koczian <nulla.epistola@web.de> |
|---|---|
| Subject | Re: How to check the date validity? |
| Date | 2013-12-25 20:03 +0100 |
| References | <CA+FnnTxf1te0s4fmaXfP1wcCQ8esxrfyx3TN-JKizrMTyL-Lsg@mail.gmail.com> <CAPTjJmq_2d5LXKcEEc_85-Wjfh1=q0+uBS7=0YHkQ5dH6ubM=Q@mail.gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.4614.1387998216.18130.python-list@python.org> (permalink) |
Am 24.12.2013 01:39, schrieb Chris Angelico: > On Tue, Dec 24, 2013 at 11:30 AM, Igor Korot<ikorot01@gmail.com> wrote: >> So, my question is: since there is a simple way of inserting >> preformatted string into the datetime field of mySQL, how do I >> validate the date string? > > Well, the easiest way would be to simply attempt the SQL query. If it > comes back with an error, the date wasn't valid. To protect a > transaction against being broken by an error, you can use a SAVEPOINT > - check the database docs. (I've never actually used savepoints in > MySQL, only PostgreSQL, so things may be a bit different. Check the > docs.) > MySQL used to accept wrong date and datetime formats without error messages. Garbage in the database, because validation was (is?) considered the job of "the application". Possibly that has changed, but I'd look into the docs. It isn't PostgreSQL. Greetings Sibylle
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: How to check the date validity? Sibylle Koczian <nulla.epistola@web.de> - 2013-12-25 20:03 +0100
csiph-web