getQueryData.php - grey1105/Reports GitHub Wiki

getQueryData.php

Summary of function:

Parameter needed is a mysql query in string format, output is formatted as a JavaScript Object Notation file

Function name to call getJSONData($query) Note, this is within PHP.

Example of a query: 'SELECT count(*) as count FROM [DBName.TableName]' Must be a legitimate MySQL query!

Example of an output: {count: 6597}

Future Updates:

  • Make this function more dynamic(call out to polymorphism) maybe take a different server IP to use this function for multiple MySQL DB calls.
  • Need to create an instance if the $query variable is not a MySQL string, or a string.

Edge Cases

  • A well known edge case for this function is if the $query variable passed is not a MySQL query.
  • If the $query variable is not a string

Function Calls

The following files(scripts) call this function:

  • calendarScripts.js function: getUniqueDates() MySQL call: "SELECT DISTINCT DATE(scan_date) as date from cs_audit.alert_log"
  • queryToChart.js function: renderScanChart() and renderTransmissionChart() MySQL call: "SELECT DISTINCT DATE(scan_date) as date, DATEDIFF(alert_process_date,scan_date) as param2 from cs_audit.v_alert_log" AND "SELECT DISTINCT DATE(scan_date) as date, DATEDIFF(alert_notify_date,alert_process_date) as param2 from cs_audit.v_alert_log"
  • ReportScripts.js function: getDBCount() MySQL call: 'select count(*) count from cs_audit.alert_log;'
  • testingtimes.js function: getTimesArray(date) MySQL call: 'select scan_date from cs_audit.v_alert_log where DATE(scan_date)=" '+ date + '";'

Edge Cases

The date format must be 'MM-DD-YYYY' otherwise this will be an edge case, also worth mentioning that it must be in string format. Because it also uses or API getQueryData, then the call or query must be valid as well.

Function Calls/Dependencies

⚠️ **GitHub.com Fallback** ⚠️