List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:May 4 2001 2:06am
Subject:Re: Obtaining warnings
View as plain text  
At 9:32 AM -0400 5/3/01, Terry Gliedt wrote:
>My apologies for even needing to ask this question, but I've
>spend hours combing through the docs and have not figured this
>out. :-(
>
>The problem is basically how to obtain warnings and the question
>comes in a couple of flavors:
>
>For example if one does "update tbl set my_int='21.3 a' where
>my_key=4" (where my_int = int(11)) my_int will be set to 21 and a
>warning is generated. Try as I might, I cannot see how to get the
>mysql client to show these to me.
>
>Issuing the same command in PHP4, I can not see an interface
>which will return me an indicator that a warning was generated or
>how to fetch the warning message.
>
>Doing an INSERT where data is converted/truncated apparently
>generates no warnings (as indicated in the mysql client), but
>surely MYSQL will generate a warning when the data is converted.

It doesn't.

>
>Lastly, can I set some flag so that MYSQL is more strict about
>this stuff? Seems to me that my_int=21.3 isn't correct in some
>cases and I should at least get a warning and even better be able
>to force MySQL to reject this as incorrect.

The philosophy is something along the lines of "if you try to insert
garbage into your database, MySQL will convert it as well as possible,
but you deserve what you get." :-)

If you want additional strictness, you'll need to check your data
before you try to toss it into your database.

>
>TIA
>
>--
>=============================================================
>Terry Gliedt     tpg@stripped       http://www.hps.com/~tpg/
>Biostatistics, Univ of Michigan  Personal Email:  tpg@stripped


-- 
Paul DuBois, paul@stripped
Thread
Obtaining warningsTerry Gliedt3 May
  • Re: Obtaining warningsPaul DuBois4 May