[Phpmyadmin-devel] Improved notification when attempting to insert invalid data.

Chirayu Chiripal chirayu.chiripal at gmail.com
Tue Jul 29 20:03:57 CEST 2014


On Tue, Jul 29, 2014 at 11:02 PM, Isaac Bennetch <bennetch at gmail.com> wrote:

>
>
> On 7/29/14, 8:16 AM, Chirayu Chiripal wrote:
> > On Tue, Jul 29, 2014 at 1:32 AM, Isaac Bennetch <bennetch at gmail.com
> > <mailto:bennetch at gmail.com>> wrote:
> >
> >     Hi,
> >
> >     On 7/28/14, 1:30 PM, Chirayu Chiripal wrote:
> >     > Hi,
> >     >
> >     > My GSoC task for this week is "Improved notification when
> >     attempting to
> >     > insert invalid data". I would like to know at which places
> >     validation is
> >     > required to be done?
> >
> >     The idea here is basically that if a user attempts to insert data
> that
> >     will be truncated that we'll warn them. Some of this has already been
> >     implemented (for instance, try to insert the text "foo" to a column
> of
> >     type INT(10); the field turns red indicating a problem).
> >
> >     This can be enhanced, though, for instance the following scenarios do
> >     not warn correctly:
> >     * Insert 999 to a TINYINT
> >     * Insert 99999999999 to an INT
> >
> >
> > For integer types we can change our current input type="text" to input
> > type="number" and specify a min and max value using attributes. Or, we
> > still have to add a min and max value attribute and use
> > Javascript/Jquery to validate the field when it loses focus or at keyup
> > event.
>
> I prefer a consistent experience for the user. Even though many browsers
> would properly deal with input type="number", it will give different
> feedback than our custom handling of, say, too many characters in a
> varchar field. So I would like to be consistent and use our own tests
> even for INT columns.
>

Okay, so we will use our own validation.


>
> Note that in multibyte character sets, a single character may take
> several bytes of data to store. I'm not sure whether it's easy to
> correctly count bytes/characters in this case.
>

Yeah, this is an important thing to be taken care of. I am not sure whether
Javascript supports it natively but there should some way to do it. MySQL
documentation says that "MySQL interprets length specifications in
character column definitions in character units." I am not sure that by
character units they mean unicode "code points" or something else.


> Another thought: we should allow the user to continue even if we don't
> think the data they're entering is okay -- the input field should turn
> red, but they should still be allowed to press the submit button and
> allow MySQL to truncate.
>

Sure.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.phpmyadmin.net/pipermail/developers/attachments/20140729/2163794c/attachment.html>


More information about the Developers mailing list