" %s "
};
+const char *to_unix_timestamp[] = {
+ /* MySQL */
+ "UNIX_TIMESTAMP(%s)",
+ /* PostgreSQL */
+ "EXTRACT(EPOCH FROM %s)",
+ /* SQLite */
+ "strftime('%%s', %s)"
+};
+
const char *expires_in[] = {
/* MySQL */
"(GREATEST(0, CAST(UNIX_TIMESTAMP(LastWritten) + Media.VolRetention AS SIGNED) - UNIX_TIMESTAMP(NOW())))",
extern const char CATS_IMP_EXP *create_temp_new_basefile[];
extern const char CATS_IMP_EXP *del_MAC;
extern const char CATS_IMP_EXP *drop_deltabs[];
+extern const char CATS_IMP_EXP *to_unix_timestamp[];
extern const char CATS_IMP_EXP *expired_volumes[];
extern const char CATS_IMP_EXP *fill_jobhisto;
extern const char CATS_IMP_EXP *get_restore_objects;
where.c_str(),
rec->order ? "DESC" : "ASC",
str_limit.c_str());
+
+ } else if (type == JSON_LIST) {
+ Mmsg(tmp2, to_unix_timestamp[bdb_get_type_index()], "EventsTime");
+ Mmsg(cmd,
+ "SELECT EventsTime AS Time, %s AS UnixTime, EventsCode AS Code, EventsDaemon AS Daemon, EventsRef AS Ref, EventsType AS Type, EventsSource AS Source, EventsText AS Events "
+ "FROM Events "
+ "%s ORDER BY Events.EventsTime %s %s",
+ tmp2.c_str(),
+ where.c_str(),
+ rec->order ? "DESC" : "ASC",
+ str_limit.c_str());
+
} else {
Mmsg(cmd,
"SELECT EventsTime AS Time, EventsCode AS Code, EventsDaemon AS Daemon, EventsRef AS Ref, EventsType AS Type, EventsSource AS Source, EventsText AS Events "