MySQL Lists are EOL. Please join:

List:General Discussion« Previous MessageNext Message »
From:Harry Brueckner Date:March 17 1999 3:33pm
Subject:Re: C-API
View as plain text  
Michael Widenius <monty@stripped> wrote:
> >>>>> "Harry" == Harry Brueckner <brueckner@stripped>
> writes:
> Harry> I have a question regarding the C-API or maybe even MySQL itself.
> Harry> I would like to detect if my application hits the border of a column
> e.g. if a
> Harry> field is defined as tinyint and the application tries to insert a value
> > 127.
> Harry> MySQL cuts off this value and inserts/updates it as 127 but it would be
> nice if
> Harry> there would be a way to detect that something went wrong.
> Harry> Proofreading every statement isnt a very fast way to check if a value
> was cut
> Harry> off or not. :-)
> I could provide a 'SET SQL_option' for INSERT statments to handle this.
> Which one would you prefere:
> - All warnings are treated as errors.  In this case MySQL could say
>  'Illegal value 'xxx' for column 'xxx'"
> - That one should be able to get a 'mysql_info' results even for
>   single line inserts.
> Any other options?

With the mysql_info solution it might be a little difficult to report the
fieldname and the value properly so in my opinion an error message (and not
updating the data) will solve everything quite nicely.
I'm not 100% sure if it's good to completely refuse to update such a record but
I guess that in like 99% of the cases the data would be corrupted after the
update process anyway. :-)


  PGP fingerprint: B9 EE 83 0C 1F 48 54 50  9F A7 7A 00 6C 94 36 02
  PGP public key available by fingering harry@stripped

C-APIHarry Brueckner17 Mar
  • C-APIMichael Widenius17 Mar
    • Re: C-APIHarry Brueckner17 Mar