I am getting the following error generated by this module every time cron is run:

PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '%d, auser = auser + %d, nnode = nnode + %d, cnode = cnode + %d, pi = pi + %d, up' at line 2: UPDATE {statspro} SET nuser = nuser + %d, auser = auser + %d, nnode = nnode + %d, cnode = cnode + %d, pi = pi + %d, upi = upi + %d, error = error + %d, uerror = uerror + %d, warning = warning + %d, uwarning = uwarning + %d, emergency = emergency + %d, uemergency = uemergency + %d, alert = alert + %d, ualert = ualert + %d, critical = critical + %d, ucritical = ucritical + %d WHERE day = '%s'; Array ( [0] => 0 [1] => 1 [2] => 1 [3] => 4 [4] => 27 [5] => 27 [6] => 4 [7] => 4 [8] => 33 [9] => 33 [10] => 0 [11] => 0 [12] => 0 [13] => 0 [14] => 0 [15] => 0 [16] => 2013-04-16 ) in StatsPro->store_day() (line 929 of /public_html/sites/all/modules/statspro/statspro.inc).

Any help fixing this would be appreciated.

CommentFileSizeAuthor
#3 statspro-sql_error-1972522-3.patch890 bytesuhkis

Comments

input’s picture

Can confirm this issue

Benone_’s picture

Replace

  TODO Please convert this statement to the D7 database API syntax.
      db_query(
        "UPDATE {statspro} SET
          " . implode(', ', $sql_fields) . "
          WHERE day = '%s'",
        $sql_values
      );

with

$sql_values[] = $date;
	  db_update('statspro')
	    ->fields(array(
		  'nuser' => $sql_fields['nuser'],
		  'auser' => $sql_fields['auser'],
		  'nnode' => $sql_fields['nnode'],
		  'cnode' => $sql_fields['cnode'],
		  'pi' => $sql_fields['pi'],
		  'upi' => $sql_fields['upi'],
		  'error' => $sql_fields['error']
	    ))
		->condition('day', date("Y, n, j"), '=')
		->execute();

in statspro.inc

uhkis’s picture

Issue summary: View changes
Status: Active » Needs review
StatusFileSize
new890 bytes

#2 in patch form

Benone_’s picture

Status: Needs review » Closed (won't fix)