易截截图软件、单文件、免安装、纯绿色、仅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


相关文档:

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

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

开始收集mysql的各种命令

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

php+mysql分页


分页功能的实现是每种WEB开发语言必须要实现的功能。PHP也好,JSP也罢。我准备用两个方法来阐述PHP+MYSQL实现分页的功能。
 
一、分页程序的原理
分页程序有两个非常重要的参数:每页显示几条记录($pagesize)和当前是第几页($page)。有了这两个参数就可以很方便的写出分页程序,我们以MySql数据库作为数据源, ......

(mysql)Foreign key的使用

(1)
外键的使用:
外键的作用,主要有两个:
一个是让数据库自己通过外键来保证数据的完整性和一致性.
如:
有表A,表B中一字段是表A某一字段的外键.当删除表A记录时,表B相应记录会作相应处理(删除/或设置外键列为NULL).但若删除表B记录,表A的记录,则不会受影响!
 
一个就是能够增加ER图的可读性
  &nbs ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号