[BLAST_ANAWARE] HVGUI - SQL queries

From: Adrian T Sindile (asindile@cisunix.unh.edu)
Date: Wed Dec 03 2003 - 16:34:31 EST


Hi, Adam!
To answer your questions and at the same time, to have a record of this,
so that people can refer back to it:

To insert a new row in the LAD_HV table, for example, the HVGUI should use
a query like:
---------------------------------------------------------------------------
insert into LAD_HV values ("L15_R14D", 1, 13, 10, NULL, NULL, -1570, -700,
-650, 200, 200, now());
---------------------------------------------------------------------------

To get the latest HV value to display for people on shift, the query
should be:
---------------------------------------------------------------------------
select * from LAD_HV where LadHvId="L15_R14D" order by HvDateTime desc
LIMIT 1;
---------------------------------------------------------------------------

To get a HV value from a specific date (for example, before October 2003),
the query should be:
---------------------------------------------------------------------------
select * from LAD_HV where LadHvId="L15_R14D" AND
HvDateTime<20031000000000 order by HvDateTime desc LIMIT 1;
---------------------------------------------------------------------------

The problem with MySQl is that it does not implement the SQL standard
exactly (I heard that not even the latest MySQL version does not do it,
so our ancient version on blast05 even less)... so the above queries might
seem weird to people used to standard SQL. Anyway, I tried them out and
they produced the desired results.
Hope this helps - have fun!

Adrian

-------------------------------
Adrian Sindile
Research Assistant
Nuclear Physics Group
University of New Hampshire
phone: (603)862-1691
FAX: (603)862-2998
email: asindile@alberti.unh.edu
http://einstein.unh.edu/~adrian/



This archive was generated by hypermail 2.1.2 : Mon Feb 24 2014 - 14:07:30 EST