Skip to content

Commit 9b511cc

Browse files
committed
data_export: Debugging
1 parent 6338ce0 commit 9b511cc

File tree

2 files changed

+4
-63
lines changed

2 files changed

+4
-63
lines changed

metadata_writer_inventory_conn.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,10 @@ static int32_t md_inventory_execute_insert_update(struct md_writer_sqlite *mws,
104104
return SQLITE_ERROR;
105105
}
106106

107+
if (mce->network_provider) {
108+
META_PRINT_SYSLOG(mws->parent, LOG_INFO, "WE HAVE NETWORK PROVIDER %u\n", mce->network_provider);
109+
}
110+
107111
if (mce->network_provider &&
108112
sqlite3_bind_int(stmt, 18, mce->network_provider)) {
109113
META_PRINT_SYSLOG(mws->parent, LOG_ERR, "Failed to bind network provider\n");

metadata_writer_sqlite.h

Lines changed: 0 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -236,69 +236,6 @@
236236

237237
#define DELETE_SYSTEM_TABLE "DELETE FROM RebootEvent"
238238

239-
//This statement is a static version of what the .dump command does. A dynamic
240-
//version would query the master table to get tables and then PRAGMA to get
241-
//rows. The actualy query is simpler than it looks. It seems SQLite supports
242-
//prepending/appending random text to the result of a query, and that is what we
243-
//do here. quote() gives a quoted string of the row content, suitable for
244-
//inclusion in another SQL query. The || is string concation. So, the query
245-
//queries for all columns, and each row is prefixed with some string
246-
#define DUMP_EVENTS "SELECT \"INSERT IGNORE INTO NetworkEvent"\
247-
"(NodeId,BootCount,BootMultiplier,Timestamp,"\
248-
"Sequence,L3SessionId,L4SessionId,DeviceId,"\
249-
"DeviceTypeId,NetworkAddress,NetworkAddressFamily,"\
250-
"EventType,EventParam,EventValue) "\
251-
"VALUES(\" "\
252-
"|| quote(\"NodeId\"), quote(\"SessionId\"),"\
253-
"quote(\"SessionIdMultip\"),quote(\"Timestamp\"), "\
254-
"quote(\"Sequence\"), quote(\"L3SessionId\"), "\
255-
"quote(\"L4SessionId\"), quote(\"InterfaceId\"), "\
256-
"quote(\"InterfaceType\"), quote(\"NetworkAddress\"), "\
257-
"quote(\"NetworkAddressFamily\"), quote(\"EventType\"), "\
258-
"quote(\"EventParam\"), quote(\"EventValue\") "\
259-
"|| \")\" FROM \"NetworkEvent\" WHERE Timestamp>=? ORDER BY Timestamp;"
260-
261-
#define DUMP_UPDATES "SELECT \"REPLACE INTO NetworkUpdate"\
262-
"(NodeId,BootCount,BootMultiplier,L3SessionId,"\
263-
"L4SessionId,DeviceId,NetworkAddress,DeviceTypeId,"\
264-
"Timestamp,Sequence,EventValueStr,"\
265-
"ServerTimestamp) VALUES(\" ||"\
266-
"quote(\"NodeId\"), quote(\"SessionId\"),"\
267-
"quote(\"SessionIdMultip\"), quote(\"L3SessionId\"),"\
268-
"quote(\"L4SessionId\"), quote(\"InterfaceId\"),"\
269-
"quote(\"NetworkAddress\"), quote(\"InterfaceType\"),"\
270-
"quote(\"Timestamp\"), quote(\"Sequence\"), "\
271-
"quote(\"EventValueStr\") ||"\
272-
"\", Now())\" FROM \"NetworkUpdates\" WHERE "\
273-
"Timestamp>=? ORDER BY Timestamp;"
274-
275-
#define DUMP_GPS "SELECT \"REPLACE INTO GpsUpdates" \
276-
"(NodeId,BootCount,BootMultiplier"\
277-
",Timestamp,Sequence,Latitude,Longitude" \
278-
",Altitude,Speed,SatelliteCount) VALUES(\" "\
279-
"|| quote(\"NodeId\"), quote(\"BootCount\"), "\
280-
"quote(\"BootMultiplier\"), quote(\"Timestamp\"), "\
281-
"quote(\"Sequence\"), quote(\"Latitude\"), "\
282-
"quote(\"Longitude\"), quote(\"Altitude\"), "\
283-
"quote(\"Speed\"), quote(\"SatelliteCount\") "\
284-
"|| \")\" FROM \"GpsUpdate\" ORDER BY Timestamp;"
285-
286-
#define DUMP_MONITOR "SELECT \"REPLACE INTO MonitorEvents" \
287-
"(NodeId,Timestamp,Sequence,Boottime) VALUES(\" "\
288-
"|| quote(\"NodeId\"), quote(\"Timestamp\"), "\
289-
"quote(\"Sequence\"), quote(\"Boottime\") "\
290-
"|| \")\" FROM \"MonitorEvents\" ORDER BY Timestamp;"
291-
292-
#define DUMP_USAGE "SELECT \"INSERT INTO DataUse" \
293-
"(DeviceId,SimCardIccid,SimCardImsi,Timestamp,RxData,TxData) VALUES(\" "\
294-
"|| quote(\"DeviceId\"), quote(\"SimCardIccid\"), " \
295-
"quote(\"SimCardImsi\") || \",FROM_UNIXTIME(\" "\
296-
"|| quote(\"Timestamp\") || \"),\" || "\
297-
"quote(\"RxData\"), quote(\"TxData\") "\
298-
"|| \") ON DUPLICATE KEY UPDATE RxData=RxData+\"" \
299-
"|| quote(\"RxData\") || \", TxData=TxData+\"" \
300-
"|| quote(\"TxData\") FROM \"DataUse\";"
301-
302239
//Define statements for JSON export
303240
#define DUMP_EVENTS_JSON "SELECT * FROM NetworkEvent WHERE Timestamp>=? ORDER BY TimeStamp"
304241

0 commit comments

Comments
 (0)