#include #include //used by string #include //Used for UART #include //Used for UART #include //Used for UART #include //used by mysql #include //used by mysql int uart0_filestream=1; MYSQL *conn; // the connection MYSQL_RES *res; // the results MYSQL_ROW row; // the results row (line by line) unsigned char rx_buffer[1024]; // Read up to 255 characters from the port if they are there unsigned char tmp_buffer[1024]; // rx_buffer duomenis suraso tvarkingai int rx_length,ctpaketas; int pirmas=0; void setupUART(); void LocalWork(); int ReadUART(); void paketas(); const char *server="localhost"; const char *user="ziogas"; const char *password="ziogas"; const char *database="ziogas"; MYSQL mysql; int main() { setupUART(); printf("Pradzia\n"); ctpaketas=0; mysql_init(&mysql); conn=mysql_real_connect(&mysql, server, user, password, database, 0, 0, 0); for (;;) { LocalWork(); } close(uart0_filestream); mysql_free_result(res); mysql_close(conn); return 0; } void LocalWork() { int rxb=ReadUART(); if (rxb!=-1) { char qstr[255]; for (int i=0; i