Skip to content
This repository was archived by the owner on Jan 29, 2023. It is now read-only.
This repository was archived by the owner on Jan 29, 2023. It is now read-only.

ESP32 Insert did, SELECT not #30

@Tinkerpete

Description

@Tinkerpete

When i repace the SELECT Statement in the statementStr with the INSERT it works. But with the SELECT the 'query_mem.execute' fails. Any ideas?

void runQuery() {
  Serial.print("Connecting to SQL... ");
  IPAddress ip;
  ip.fromString(dbaddress);
  int len = dbuser.length() + 1;
  char dbuserArray[len];
  dbuser.toCharArray(dbuserArray, len);
  len = dbpassword.length() + 1;
  char dbpasswordArray[len];
  dbpassword.toCharArray(dbpasswordArray, len);
  if (conn.connectNonBlocking(ip, 3306, dbuserArray, dbpasswordArray) != RESULT_FAIL) {
    MySQL_Query query_mem = MySQL_Query(&conn);
    // INSERT INTO dbbridge.bluetti (device_type, serial_number, arm_version, dsp_version, dc_input_power, ac_input_power, ac_output_power, dc_output_power, power_generation, total_battery_percent, ac_output_on, dc_output_on) VALUES (17744, 18535, 10689, 10586, 0, 255, 276, 0, 37, 80, 1, 0);
    String statementStr = "SELECT dc_input_power FROM bluetti LIMIT 5";
    if (query_mem.execute(statementStr.c_str())) {
      Serial.println("connected.");
    } else {
      MYSQL_DISPLAY("Querying error ~");
    }
  } else {
    Serial.println("failed.");
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions