易截截图软件、单文件、免安装、纯绿色、仅160KB

mysql connect c++

先前在测试mysql connect c++接口的时候运行其官方提供的例子
21.5.5.6. MySQL Connector/C++ Complete Example 2
The following code shows a complete example of how to use MySQL Connector/C++:
/* Copyright 2008 Sun Microsystems, Inc.
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.
There are special exceptions to the terms and conditions of the GPL
as it is applied to this software. View the full text of the
exception in file EXCEPTIONS-CONNECTOR-C++ in the directory of this
software distribution.
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 Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/* Standard C++ includes */
#include <stdlib.h>
#include <iostream>
/*
Include directly the different
headers from cppconn/ and mysql_driver.h + mysql_util.h
(and mysql_connection.h). This will reduce your build time!
*/
#include "mysql_connection.h"
#include <cppconn/driver.h>
#include <cppconn/exception.h>
#include <cppconn/resultset.h>
#include <cppconn/statement.h>
#include <cppconn/prepared_statement.h>
using namespace std;
int main(void)
{
cout << endl;
cout << "Let's have MySQL count from 10 to 1..." << endl;
try {
sql::Driver *driver;
sql::Connection *con;
sql::Statement *stmt;
sql::ResultSet *res;
sql::PreparedStatement *pstmt;
/* Create a connection */
driver = get_driver_instance();
con = driver->connect("tcp://127.0.0.1:3306", "root", "root");
/* Connect to the


相关文档:

MySQL不能启动服务1067错误

MySQL重新安装的时候出现了问题:Could not start the service MySQL. Error:0,原因是没有对旧的MySQL完全卸载掉。
    在你从电脑里卸载旧的MYSQL数据库服务时,首先先在WINDOWS服务里停掉MYSQL的服务。再到控制面板里的增加删除程序内进行删除,然后手动删除原安装文件,但是你并不能完整的把MYSQL服务删 ......

memcached 与c/c++运用

修改makefile,在LIBS里面加上-lmemcached,比如原来 gcc test.c,现在 gcc test.c -lmemcached。这个库就是libmemcached提供的。
然后添加#include<libmemcached/memcached.h>,这个文件也是libmemcached提供的。
主函数里面需要添加:
    memcached_st *memc;
    uint32_t&nbs ......

开始收集mysql的各种命令

  这里收集各种Mysql的基础知识,为了某些场合的需要,还是舍弃navicat之类的工具乖乖用命令行吧   
(注意有的命令需要分号有的不需要)
一.基本操作
  1.登录
     mysql -u 用户名 -p密码 数据库名
         这里需 ......

(mysql)Foreign key的使用

(1)
外键的使用:
外键的作用,主要有两个:
一个是让数据库自己通过外键来保证数据的完整性和一致性.
如:
有表A,表B中一字段是表A某一字段的外键.当删除表A记录时,表B相应记录会作相应处理(删除/或设置外键列为NULL).但若删除表B记录,表A的记录,则不会受影响!
 
一个就是能够增加ER图的可读性
  &nbs ......

(mysql)临时表的使用

使用临时表的好处:
使用临时表存放中间结果,加速查询,或存放临时结果.
 
(1)
创建临时表很容易,给正常的CREATE TABLE语句加上TEMPORARY关键字:
CREATE TEMPORARY TABLE tmp_table (
name VARCHAR(10) NOT NULL,
value INTEGER NOT NULL
)
 
(2)
临时表将在你连接MySQL期间存在。当你断开时,MySQL ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号