А просит “MySQL_Row.h”
MySQL_Row.h должно идти внутри MySQL_Connection.
Серьёзно?
А как я об этом узнаю?
У Вас ни программы ни схемы - только принтскрин.
Принтскрин в тухас.
Читайте как вставлять … программы.
А то лох-лохом.
не вижу разницы между тем чтобы скопировать код и вставить, либо более компактно отправить его скрином
#include <Ethernet.h>
#include <MySQL_Connection.h>
#include <MySQL_Cursor.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <MFRC522.h>
#include <MySQL_Row>
// RFID Pins
#define SS_PIN 10
#define RST_PIN 9
MFRC522 rfid(SS_PIN, RST_PIN);
String readRFID() {
if (rfid.PICC_IsNewCardPresent() && rfid.PICC_ReadCardSerial()) {
String content = "";
for (byte i = 0; i < rfid.uid.size; i++) {
content.concat(String(rfid.uid.uidByte[i] < 0x10 ? "0" : ""));
content.concat(String(rfid.uid.uidByte[i], HEX));
}
rfid.PICC_HaltA();
return content;
}
return "";
}
// Ethernet Pins
byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
EthernetClient client;
// MySQL Credentials
char server[] = "example.com";
char user[] = "username";
char password[] = "password";
char database[] = "attendance";
// LCD Pins
LiquidCrystal_I2C lcd(0x27, 16, 2);
// Function to get name from database
String getName(String rfid) {
String query = "SELECT name FROM users WHERE rfid = '" + rfid + "'";
MySQL_Connection conn = MySQL_Connection((Client *)&client);
if (conn.connect(IPAddress(127, 0, 0, 1), 3306, "root", "Ars58040766!!")) {
MySQL_Cursor *cursor = new MySQL_Cursor(&conn);
cursor->execute(query.c_str());
MySQL_Row row = cursor->getRow();
String name = row.getString(0);
delete cursor;
return name;
}
return "";
}
А номера строк, а копирование и исправление?
Компилируется?
Вот тут библиотека
Про MySQL_Row в примерах не слова.
Откуда программу скопирастили? Оттуда и спрашивайте.
нет, не компилируется
MySQL_Row.h
является заголовочным файлом библиотеки MySQL Connector/C++
, предназначенной для подключения к MySQL из C++ приложений. Этот файл содержит определение класса MySQL_Row
, который представляет собой строку таблицы MySQL и обеспечивает доступ к данным в этой строке. Он используется в коде для получения результата запроса в виде набора строк. Если вы используете библиотеку MySQL Connector/C++
в своем проекте, вы можете найти заголовочный файл MySQL_Row.h
в директории установки библиотеки.
А нам глаза ломать?
#include <MySQL_Row.h>
ГДЕ???
/*
Copyright (c) 2012, 2016 Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
MySQL_Connection.h - Library for communicating with a MySQL Server over
Ethernet. (formerly mysql.h)
This header file defines a connection class for connecting to a MySQL
server.
Change History:
Version 1.0.0a Created by Dr. Charles A. Bell, April 2012.
Version 1.0.0b Updated by Dr. Charles A. Bell, October 2013.
Version 1.0.1b Updated by Dr. Charles A. Bell, February 2014.
Version 1.0.2b Updated by Dr. Charles A. Bell, April 2014.
Version 1.0.3rc Updated by Dr. Charles A. Bell, March 2015.
Version 1.0.4ga Updated by Dr. Charles A. Bell, July 2015.
Version 1.1.0a Created by Dr. Charles A. Bell, January 2016.
Version 1.1.1a Created by Dr. Charles A. Bell, January 2016.
Version 1.1.2b Created by Dr. Charles A. Bell, November 2016.
Version 1.2.0 Created by Dr. Charles A. Bell, March 2020.
*/
#ifndef MYSQL_CONNECTION_H
#define MYSQL_CONNECTION_H
#include <MySQL_Packet.h>
class MySQL_Connection : public MySQL_Packet {
public:
MySQL_Connection(Client *client_instance) :
MySQL_Packet(client_instance) {}
boolean connect(IPAddress server, int port, char *user, char *password,
char *db=NULL);
int connected() { return client->connected(); }
const char *version() { return MYSQL_VERSION_STR; }
void close();
};
#endif
Вы кидаете MySQL Connector ARDUINO, а я вам говорю за MySQL Connector/C++
А я проверял с MySQL/C…
Ссылочку на класс не приложите?
@arsenij6666, у вас в скетче не определен MySQL_Row, его определение находится в файле MySQL_Row.h. В чем проблема подключить этот файл?
в том что внимательней читайте, он подключен