The Data Charmer: Sort of triggers on SELECT
Monday, October 20th, 2008Array-ne Legion reviews, in order.Comic Books: Legion of Super-Heroes #1 Legion of Super-Heroes #2Legion of Super-Heroes #3Legion of Super-Heroes #4Legion of Super-Heroes #5Legion of Super-Heroes #6Legion of Super-Heroes #7Legion of Super-Heroes #8Legion of Super-Heroes #9Legion of Super-Heroes #10Legion of Super-Heroes #11Legion of Super-Heroes #12Legion of Super-Heroes #13Legion of Super-Heroes #14Legion of Super-Heroes #15Supergirl and the Legion of Super-Heroes #16Supergirl and the Legion of Super-Heroes #17Supergirl and the Legion of Super-Heroes #18Supergirl and the Legion of Super-Heroes #19Supergirl and the Legion of Super-Heroes #20Supergirl and the Legion of Super-Heroes #21Supergirl and the Legion of Super-Heroes #22Supergirl and the Legion of Super-Heroes #23Supergirl and the Legion of Super-Heroes #24Supergirl and the Legion of Super-Heroes #25Supergirl and the Legion of Super-Heroes #26Supergirl and the Legion of Super-Heroes #27Supergirl and the Legion of Super-Heroes #28Supergirl and the Legion of Super-Heroes #29Supergirl and the Legion of Super-Heroes #30Supergirl and the Legion of Super-Heroes #31Supergirl and the Legion of Super-Heroes #32Supergirl and the Legion of Super-Heroes #33Supergirl and the Legion of Super-Heroes #34Supergirl and the Legion of Super-Heroes #35Supergirl and the Legion of Super-Heroes #36Legion of Super-Heroes #37Legion of Super-Heroes #38Legion of Super-Heroes #39Legion of Super-Heroes #40Legion of Super-Heroes #41Legion of Super-Heroes #42Legion of Super-Heroes #43Legion of Super-Heroes #44Legion of Super-Heroes #45Legion of Super-Heroes #46Action Comics #858Action Comics #859Action Comics #860Action Comics #861Action Comics #862Action Comics #863Final Crisis: Legion of 3 Worlds #1Final Crisis: Legion of 3 Worlds #2Legion of Super-Heroes in the 31st Century #1Legion of Super-Heroes in the 31st Century #2Legion of Super-Heroes in the 31st Century #3Legion of Super-Heroes in the 31st Century #4Legion of Super-Heroes in the 31st Century #5Legion of Super-Heroes in the 31st Century #6Legion of Super-Heroes in the 31st Century #7Legion of Super-Heroes in the 31st Century #8Legion of Super-Heroes in the 31st Century #9Legion of Super-Heroes in the 31st Century #10Legion of Super-Heroes in the 31st Century #11Legion of Super-Heroes in the 31st Century #12Legion of Super-Heroes in the 31st Century #13Legion of Super-Heroes in the 31st Century #14Legion of Super-Heroes in the 31st Century #15Legion of Super-Heroes in the 31st Century #16Legion of Super-Heroes in the 31st Century #17Legion of Super-Heroes in the 31st Century #18Legion of Super-Heroes in the 31st Century #19Animated Series:Superman and the Legion of Super Heroes #1-1Superman and the Legion of Super Heroes #1-2Superman and the Legion of Super Heroes #1-3Superman and the Legion of Super Heroes #1-4Superman and the Legion of Super Heroes #1-5Superman and the Legion of Super Heroes #1-6Superman and the Legion of Super Heroes #1-7Superman and the Legion of Super Heroes #1-8Superman and the Legion of Super Heroes #1-9Superman and the Legion of Super Heroes #1-10Superman and the Legion of Super Heroes #1-11Superman and the Legion of Super Heroes #1-12Superman and the Legion of Super Heroes #1-13Legion of Super Heroes #2-1Legion of Super Heroes #2-2Legion of Super Heroes #2-3Legion of Super Heroes #2-4Legion of Super Heroes #2-5Legion of Super Heroes #2-6Legion of Super Heroes #2-7: NotLegion of Super Heroes #2-8: NotLegion of Super Heroes #2-9 Plus Catching UpLegion of Super Heroes #2-10Legion of Super Heroes #2-11Legion of Super Heroes #2-12Legion of Super Heroes #2-13Labels: Site/Legion Info
link
-ne WT 73 degrees Caught 2 bass, One fish about 1 lb, one fish 2 1/2 lb on a ratl trap (red craw).
link
-ne Fished about three hours this afternoon. Caught 3 fish, one on a CT, one on a crankbait, and one on a Ratl Trap all about 1 to 1 1/2 lb.
link
-ne Dancing With the Devils in the Dominican Republic By SETH KUGELThe New York TimesA SMALL, pothole-laden city in the central valley ofthe Dominican Republic, anchored by aconcrete-pillared, irregularly shaped cathedral whosedecidedly ugly look takes some time to grow on you, LaVega isn’t high on the to-do list of most travelers.There are no beaches, a few tolerable hotels, someunremarkable restaurants and, for 11 months of theyear, no real reason to go there.But that changes in February, when Carnaval comes totown. Then, the quiet streets of La Vega are crowdedwith visitors who seem to double the population of200,000, the clubs fill with deafening music thatkeeps their customers dancing until almost dawn, and -most notably - grotesquely beautiful, intricatelydecorated, jingle-bell-draped demons race through thestreets of the jam-packed town every Sunday, whippinganyone who dares to get in their way with reinforcedcow bladders that carry a surprisingly nasty sting.It is a month peppered with street concerts thatattract the country’s big music stars; of days and nights filled with music - the blaring brass of merengue, the tinny guitar of bachata, both played at absurdly highvolumes on huge portable speakers - that acts as akind of nonstop soundtrack to the surreal events that unfold as Carnaval gathers steam.Carnaval takes place on each weekend of February, with parades on Sundays, culminating with the largest one, on Feb. 27, Dominican Independence Day. But none rivals that of LaVega, and, in fact, many other cities send representatives there on the 27th to march alongside that town’s famed diablos cojuelos - horned, fanged, winged creatures whose outfits are created inramshackle workshops by people who have been honingthis skill for years.The legendary Dominican singer Fernandito Villalona summed up the experience in a Spanish-language merengue that you’ll hear repeatedly if you go to LaVega:When February comes, everything is happiness, Dance in the street by night, dance in the street by day …Historians trace such carnival celebrations (carnaval, in Spanish) as far back as pagan Rome and even ancient Egypt, but the modern incarnation emerged from Catholic traditions that came with colonialism andwere deeply influenced by African slaves. While local partygoers in their teens and 20’s rule the streets and the clubs - witness the beer-swilling, high-decibel gathering Friday night atthe Parque de los Estudiantes, a pocket park at a busy intersection - their parents and grandparents are equally enthusiastic participants in the celebrations. The next day, she turned 4.I arrived in La Vega on a Friday afternoon, and encountered a typical, humming Dominican town, full of boisterous, friendly people - many of whom were gathered in the town square, where some kids shined shoes and others chased pigeons while a nearby vendor sold coconut sweets for 5 pesos apiece.Using my cellphone (a worker at the local Verizonoffice had helped me temporarily reprogram it with alocal number - very convenient), I called Mayobanex Mota, the nephew of an acquaintance of a friend of mine in New York, hoping to get some advice on what to do in La Vega. Many of the Carnaval costume-making teams - groups with names like the Broncos, theBuddies, the Ants and the Scorpions - set up cuevas,or caves, which serve as gathering places for theirfriends, staging grounds for the parade on Sunday and ground zero for the after-party.
link
The one for which we want a log– We’ll make it simple for example’s sake– —————————————————-CREATE TABLE books (book_id INT NOT NULL primary key,title VARCHAR(40),pages INT,price DECIMAL(5,2),author_id INT NOT NULL,KEY (author_id),– FOREIGN KEY (author_id) REFERENCES authors (author_id) ON DELETE CASCADE) ENGINE = InnoDB;– —————————————————— The counter.– It will hold one row only, with a running counter– —————————————————-CREATE TABLE db_counter (id int(11) NOT NULL default ‘0′,counter bigint(20) default ‘0′,PRIMARY KEY (id)) ENGINE=MyISAM;– —————————————————— The detail log.– each row will have info about who accessed the table– and when.– —————————————————-CREATE TABLE db_log (ts timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,user varchar(20) NOT NULL,operation enum(’select’,'insert’,'update’,'delete’) default ’select’,KEY user_ts (user,ts),KEY ts (ts)) ENGINE=MyISAM;These last two tables will hold the access information we need.Before we go on, some sintactic sugar to ensure taht our counter will have just one row:CREATE TRIGGER counter_insert before INSERT on db_counterfor each row set new.id = 1;CREATE TRIGGER counter_update before UPDATE on db_counterfor each row set new.id = 1;And a few triggers to record the DML for books (it would be silly to record allreads and to neglect the writes):CREATE TRIGGER book_insert after INSERT on booksfor each row set @BOOKCOUNT = get_counter(’insert’);CREATE TRIGGER book_delete after DELETE on booksfor each row set @BOOKCOUNT = get_counter(’delete’);CREATE TRIGGER book_update after UPDATE on booksfor each row set @BOOKCOUNT = get_counter(’update’);We are ready to create our function.delimiter //drop function if exists get_counter //create function get_counter( oper varchar(10) )returns intdeterministicbeginif ( ( select count(*) from db_counter ) > 0 ) thenupdate db_counter set counter = counter 1;elseinsert into db_counter (counter) values (1);end if;insert into db_log (ts, user, operation) values (NULL, user(), oper);return (select counter from db_counter where id = 1);end //delimiter ;Finally, we create an updatable view for table books.CREATE VIEW mybooks as SELECT * from books WHERE get_counter() > 0;An that’s it.
link