MySQL Forums
Forum List  »  Triggers

Re: update same table where trigger runs not possible ?
Posted by: Peter Brawley
Date: April 03, 2011 11:39AM

Yes, the limitations in MySQL Views are severe, and there is no sign they'll go away anytime soon, if ever.

One way round them is to save the running sum query result as a temporary table, then show that. A second way is to write a stored procedure which executes the query, perhaps with parameters. A third way is to save such queries to a saved queries table ...

create table saved_queries(
  name VARCHAR(64) NOT NULL DEFAULT '',
  db VARCHAR(64) NOT NULL DEFAULT '',
  user VARCHAR(16) NOT NULL DEFAULT '',
  host VARCHAR(64) NOT NULL DEFAULT '%',
  qry VARCHAR(8192) NOT NULL DEFAULT '',
  last_changed TIMESTAMP,
  PRIMARY KEY(db,name);
);

... and have your app retrieve and run such queries on demand.

PB

Options: Reply• Quote


Subject
Views
Written By
Posted
Re: update same table where trigger runs not possible ?
1429
April 03, 2011 11:39AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.