From: Gael Martinez Date: June 23 2012 12:58am Subject: Re: Triggers and column names List-Archive: http://lists.mysql.com/mysql/227733 Message-Id: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary=90e6ba3098265d10c104c3193f49 --90e6ba3098265d10c104c3193f49 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Rick, That is what I ended up doing, a loop reading the description of the table in shell :) Regards Gael On Fri, Jun 22, 2012 at 6:54 PM, Rick James wrote: > Suggest using a script to read information_schema and construct the > TRIGGER. After all, the fields are not going to change from one invocati= on > of the trigger to the next, so don't have the "dynamic" code inside the > trigger. > > > -----Original Message----- > > From: Hal?sz S?ndor [mailto:hsv@stripped] > > Sent: Thursday, June 21, 2012 5:05 PM > > To: mysql > > Subject: Re: Triggers and column names > > > > >>>> 2012/06/21 17:06 -0500, Gael Martinez >>>> > > I'm getting that done today thru a large static trigger script and I > > would like something more dynamic... > > <<<<<<<< > > For that it is needful to look up the table in > > INFORMATION_SCHEMA.COLUMNS, and, yes, you can look up the field names-- > > but then what will you do with the character strings that are the field > > names? use PREPARE and EXECUTE for the comparisons, being ware of NULL? > > > > In MySQL help it is written that for its own purposes MySQL actually > > tracks all the information that you crave, but it nowhere is written > > that a BEFORE-UPDATE trigger can make use of it. Maybe UDF, but I know > > naught about that. > > > > Since BEFORE is called on every attempt, successful or not, maybe AFTER > > would be better. > > > > > > -- > > MySQL General Mailing List > > For list archives: http://lists.mysql.com/mysql > > To unsubscribe: http://lists.mysql.com/mysql > > > -- > MySQL General Mailing List > For list archives: http://lists.mysql.com/mysql > To unsubscribe: http://lists.mysql.com/mysql > > --=20 Ga=EBl Martinez --90e6ba3098265d10c104c3193f49--