易截截图软件、单文件、免安装、纯绿色、仅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 errno: 150 错误 外键

ERROR 1005 (HY000): Can't create table '  ****.frm' (errno: 150)
我是从以下几个方面解决了此问题:
1、确保参照的表和字段是存在的;
2、组成外键的字段要求被索引(主要是外键那个字段要求在其他表中是主键);
3、外键关联的两表或多表要求都是INNODB类型的表;
4、字段类型(说明)要一样`itemId` varchar( ......

C/C++面试题六(经典) 【转】

1.求下面函数的返回值(微软)
int func(x)
{
    int countx = 0;
    while(x)
    {
          countx ++;
          x = x&(x-1);
     } ......

mysql 错误总结

Can't open the mysql.plugin table. Please run mysql_upgrade to create it
当碰到这样的错误是没有初始化mysql数据库,可以运行如下脚本就可以解决
cd /opt/mysql-5.1.46
cd scripts/
./mysql_install_db --user=mysql --datadir=/usr/local/mysql/var/
运行如下的代码就可以解决上述问题 ......

开始收集mysql的各种命令

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

(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号