List:General Discussion« Previous MessageNext Message »
From:Ashley M. Kirchner Date:December 28 2006 7:48pm
Subject:Re: [MySQL] Re: Filling blanks on SELECT
View as plain text  
Dan Nelson wrote:
> If not, you'll probably have to read the records and store them in an
> array indexed by minute.  Then when you're done reading from mysql,
> walk the array from 0 to 59 and write out each element.  That way
> you're guaranteed 60 output rows.
>   
    Eh, did something different.  Now I'm opening the db, inserting a 
time stamp whenever the script runs, which is every minute.  At the end 
of the data gathering routine, it will go back and update that record 
for that time stamp.  If for some reason gathering data fails, it simply 
won't update the db after that, but at least there's a time stamp with 
empty data points there.  Of course, this doesn't solve the problem if 
the machine itself goes down, but hey, there's only so much one can do.

    This now allows me to still get 60 record returned, regardless of 
records being blank (or NULL) or not.  The graphing program will do the 
rest.

-- 
W | It's not a bug - it's an undocumented feature.
  +--------------------------------------------------------------------
  Ashley M. Kirchner <mailto:ashley@stripped>   .   303.442.6410 x130
  IT Director / SysAdmin / Websmith             .     800.441.3873 x130
  Photo Craft Imaging                       .     3550 Arapahoe Ave. #6
  http://www.pcraft.com ..... .  .    .       Boulder, CO 80303, U.S.A.

Thread
Filling blanks on SELECTAshley M. Kirchner28 Dec
  • Re: Filling blanks on SELECTChris White28 Dec
    • Re: [MySQL] Re: Filling blanks on SELECTAshley M. Kirchner28 Dec
      • Re: [MySQL] Re: Filling blanks on SELECTDan Nelson28 Dec
        • Re: [MySQL] Re: Filling blanks on SELECTAshley M. Kirchner28 Dec
        • SQL syntaxScott Yamahata29 Dec
          • Re: SQL syntaxViSolve DB Team29 Dec
          • Re: SQL syntaxViSolve DB Team29 Dec
          • Re: SQL syntaxJoerg Bruehe29 Dec
          • Re: SQL syntaxRhino31 Dec