#include #include #include "SDDAS_types.h" #include "libdb.h" #ifdef ALL_DB #include "libserverWrap.h" #endif int get_first_vidf_times (SDDAS_ULONG data_key, SDDAS_SHORT *btime_yr, SDDAS_SHORT *btime_day, SDDAS_ULONG *btime_msec) { #ifdef ALL_DB if (dbGetDatabaseType () == SwRI) { return (SwRI_get_first_vidf_times (data_key, btime_yr, btime_day, btime_msec)); } else { #endif char query_str [1024]; DB_RESULT *result; DB_ROW row; int ret_val = ALL_OKAY; sprintf (query_str, "SELECT b_yr, b_day, b_msec FROM v_entries WHERE data_key=%ld LIMIT 1;", (long) data_key); if ((result = (DB_RESULT *) dbQueryStore (query_str)) != NULL) { while ((row = (DB_ROW) dbFetchRow (result))) { *btime_yr = (SDDAS_SHORT) atoi (row [0]); *btime_day = (SDDAS_SHORT) atoi (row [1]); *btime_msec = (SDDAS_ULONG) atoi (row [2]); } if (dbNumberRows (result) == 0) ret_val = -1; dbFreeResult (result); } else ret_val = -1; return (ret_val); #ifdef ALL_DB } #endif }