ceMySQL.h Cross-platform C++ programming with wxWidgets
Using MySQL Database with C++ on Various Platforms Including ARM Single Board Computers
For this example, by using MySQL Workbench, we will create a database called 'mytest' and a table called 'mytable' in the MySQL server that is to be connected and used.
A class module for MySQL Connector C++ called ceMySQL is implemented in
ceMySQL.h (https://github.com/yan9a/odroid/blob/master/database-mysql/ceMySQL.h) and
ceMySQL.cpp (https://github.com/yan9a/odroid/blob/master/database-mysql/ceMySQL.cpp).
ceMySQL class is used in the wxWidgets example program,
wxmysql.cpp (https://github.com/yan9a/odroid/blob/master/database-mysql/wxmysql.cpp),
to demonstrate select, insert, update, and delete operations. The commands in the script file wxmysql-bar.sh (Listing 4), can be used to build and run the program.
g++ wxmysql.cpp ceMySQL.cpp -std=c++11 \ `wx-config --cxxflags --libs` \ -I /usr/local/mysql/connector-c++-8.0/include \ -L /usr/local/mysql/connector-c++-8.0/lib64 \ -lmysqlcppconn8 -o wxmysql ./wxmysqlListing 4. Commands to build and run MySQL Connector C++ 8.0 wxWidgets
The GUI of the program and its output are shown in Figure 2.
No comments:
Post a Comment
Comments are moderated and don't be surprised if your comment does not appear promptly.