Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #62712

Re: How to check the date validity?

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'broken': 0.04; 'messages.': 0.05; 'mysql,': 0.07; 'string': 0.09; 'postgresql,': 0.09; 'postgresql.': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:How': 0.10; '24,': 0.16; 'docs.': 0.16; 'garbage': 0.16; 'igor': 0.16; 'inserting': 0.16; 'received:188.174': 0.16; 'received:80.91.229.3': 0.16; 'received :mnet-online.de': 0.16; 'received:plane.gmane.org': 0.16; 'valid.': 0.16; 'wrote:': 0.18; 'bit': 0.19; 'header:User- Agent:1': 0.23; 'error': 0.23; 'question': 0.24; 'possibly': 0.26; 'header:X-Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'chris': 0.29; 'am,': 0.29; 'database,': 0.30; 'dec': 0.30; '"the': 0.34; 'subject:the': 0.34; "i'd": 0.34; 'transaction': 0.35; 'but': 0.35; 'there': 0.35; 'subject:?': 0.36; 'wrong': 0.37; 'so,': 0.37; 'being': 0.38; 'easiest': 0.38; 'to:addr :python-list': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'how': 0.40; 'simply': 0.61; 'simple': 0.61; 'back': 0.62; 'field': 0.63; 'greetings': 0.72; 'protect': 0.79; 'different.': 0.84; 'subject:check': 0.84; '2013': 0.98
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Sibylle Koczian <nulla.epistola@web.de>
Subject Re: How to check the date validity?
Date Wed, 25 Dec 2013 20:03:22 +0100
References <CA+FnnTxf1te0s4fmaXfP1wcCQ8esxrfyx3TN-JKizrMTyL-Lsg@mail.gmail.com> <CAPTjJmq_2d5LXKcEEc_85-Wjfh1=q0+uBS7=0YHkQ5dH6ubM=Q@mail.gmail.com>
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-Gmane-NNTP-Posting-Host ppp-188-174-81-189.dynamic.mnet-online.de
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:12.0) Gecko/20120428 Thunderbird/12.0.1
In-Reply-To <CAPTjJmq_2d5LXKcEEc_85-Wjfh1=q0+uBS7=0YHkQ5dH6ubM=Q@mail.gmail.com>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.4614.1387998216.18130.python-list@python.org> (permalink)
Lines 24
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1387998216 news.xs4all.nl 2911 [2001:888:2000:d::a6]:39616
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:62712

Show key headers only | View raw


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


Thread

Re: How to check the date validity? Sibylle Koczian <nulla.epistola@web.de> - 2013-12-25 20:03 +0100

csiph-web