Hi All,
I am just trying out mysql++ for the first time (fantastic bit of code) and
I think I have discovered a small bug.
When creating tables with the ssql macro sql_create - It isnt quoting the
table name Option as mysql expect its to be.
Versions:
mysql++: mysql++-3.0.9
mysql: 5.1.34-log
gcc: version 4.4.0 (GCC)
kernel: 2.6.29.2
Table def:
CREATE TABLE `Option` (
`PKey` int(11) NOT NULL,
PRIMARY KEY (`PKey`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
Code:
<plusplus@stripped>#include <mysql++.h>
#include <ssqls.h>
#include <iostream>
sql_create_1(Option, 1, 0, mysqlpp::sql_int, PKey)
int main(int argc, char *argv[])
{
if(argc>1)
Option::table("`Option`");
try
{
mysqlpp::Connection conn("test", "localhost", "adrianc");
Option opt(23);
mysqlpp::Query query=conn.query();
query.insert(opt);
query.exec();
}
catch(const std::exception &e)
{
std::cout << "EXCEPTION: " << e.what() << '\n';
}
return 0;
}
Results
dluadrianc:/home/adrianc/tmp> g++ bug.cc -I/usr/local/include/mysql
-I/usr/local/include/mysql++ -L/usr/local/lib -lmysqlpp
dluadrianc:/home/adrianc/tmp> a.out
EXCEPTION: 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
'Option (PKey) VALUES (23)' at line 1
dluadrianc:/home/adrianc/tmp> a.out 1
dluadrianc:/home/adrianc/tmp>
Adrian Cornish