文件名称:mysql C++ API 实现
文件大小:2KB
文件格式:RAR
更新时间:2014-07-03 17:40:15
mysql c++
用c++实现的mysql 访问 /* * test.cpp * * Created on: 2011-3-19 * Author: root * table: * create table users ( * id int(3), * name varchar(20), * password varchar(20) * ); * g++ -I/usr/include/mysql -L /usr/lib/mysql -l mysqlclient -lm */ #include "MySQLDB.h" int main(int argc,char **argv) { MySQLDB db; db.open("localhost","root","net..12","test"); //string sqlbuff="begin; insert into 1;insert into 2; insert into 3 end" db.startTransaction(); if (-1 != db.execute("insert users (id,name,password) values (19,'zhanghw19','pass'),(20,'zhanghw20','pass'),(21,'zhanghw21','pass')")) db.commit(); else db.rollback(); db.close(); return 0; }
【文件预览】:
mysqldb
----test.cpp(698B)
----MySQLDB.h(732B)
----MySQLDB.cpp(2KB)