1、简介:
服务端环境:linux,实现访问Mysql数据库的功能(c语言实现)
客户端环境:windows+vs2008,实现访问服务端查询数据库(MFC实现)
2、头文件定义:
文件:mysql_opt.h
代码:
struct ns__stBayonetCar
{
char* bId;
char* bTime;
char* eTime;
};
{
char* bId;
char* bTime;
char* eTime;
};
struct ns__stBayonetCarResponse
{
int count;
char* bId;
};
{
int count;
char* bId;
};
struct stBayonetCarRes
{
struct ns__stBayonetCarResponse info;
};
{
struct ns__stBayonetCarResponse info;
};
struct ns__stBayonet
{
char* bId;
};
{
char* bId;
};
struct stBayonetRes
{
int __size;
struct ns__stBayonet** __ptr;
};
{
int __size;
struct ns__stBayonet** __ptr;
};
int ns__connect_mysql(char* host, char* user, char* pwd, char** rst);
int ns__close_mysql(int* rst);
int ns__get_bayonet_count(int* rst);
int ns__get_bayonetcar_count(int* rst);
int ns__close_mysql(int* rst);
int ns__get_bayonet_count(int* rst);
int ns__get_bayonetcar_count(int* rst);
int ns__get_bayonetcar_bytime(struct ns__stBayonetCar* stIn, struct stBayonetCarRes* stOut);
int ns__get_bayonet(struct stBayonetRes* stOut);
int ns__get_bayonet(struct stBayonetRes* stOut);
3、使用gsoap生成客户端与服务端所需要的文件
(1)命令:./soapcpp2 -c -x web.h (其中,soapcpp2是安装gsoap目录bin文件夹下(linux环境,windows同样可以找到))
(2)客户端所需文件:
mysql_opt.nsmap、soapH.h、stdsoap2.h、soapStub.h、soapC.c、soapClient.c、stdsoap2.cpp
(3)服务端所需文件:
mysql_opt.nsmap、soapH.h、stdsoap2.h、soapStub.h、soapC.c、soapServer.c、stdsoap2.c
4、工程下载
(1)客户端:https://download.csdn.net/download/u013613158/10533158
(2)服务端:https://download.csdn.net/download/u013613158/10533143