当前位置: 首页 > news >正文

企业电商网站开发关键词排名点击工具

企业电商网站开发,关键词排名点击工具,发送wordpress,网站制作前期这个是B站Up主:程序员程子青的视频 C封装Mysql增删改查操作_哔哩哔哩_bilibilihttps://www.bilibili.com/video/BV1m24y1a79o/?p6&spm_id_frompageDriver&vd_sourcea934d7fc6f47698a29dac90a922ba5a3安装mysql:mysql 下载和安装和修改MYSQL8.0 数据库存储…

这个是B站Up主:程序员程子青的视频 

C++封装Mysql增删改查操作_哔哩哔哩_bilibiliicon-default.png?t=N7T8https://www.bilibili.com/video/BV1m24y1a79o/?p=6&spm_id_from=pageDriver&vd_source=a934d7fc6f47698a29dac90a922ba5a3安装mysql:mysql 下载和安装和修改MYSQL8.0 数据库存储文件的路径-CSDN博客

创建数据库和表:

C:\Users\heheda>mysql -u heheda -p
mysql> create database test;
mysql> show databases;
mysql> use test;
mysql> create table student(stuId int not null auto_increment primary key,stuName varchar(255) not null,className varchar(255) not null);
mysql> show tables;
mysql> insert into student values(3,'杰瑞','终极三班');
Query OK, 1 row affected (0.00 sec)

参考这篇文章:windows下使用vscode原生态配置c++链接mysql数据库:windows下使用vscode原生态配置c++链接mysql数据库_vscode 链接 lib库-CSDN博客

  • mysql下的include文件夹直接拷贝到项目目录下【或者只拷贝include中的mysql.h文件】方便引用mysql.h头文件
  •  拷贝libmysql.dll 、libmysql.lib、mysqlclient.lib文件直接放在工程目录下因为这里可执行文件在其所在目录下直接寻找动态链接源文件
  •  当cmake构建好项目之后,我们可以把libmysql.dll 、libmysql.lib文件直接放在bin目录下

  • StudentManager.h
#pragma once
#include <mysql.h>
#include <iostream>
#include <string>
#include <vector>using namespace std;typedef struct student {int stuId;string stuName;string className;
}Student;class StudentManager {
private:StudentManager();~StudentManager();
public:static StudentManager* GetInstance() { //单例修改static StudentManager StudentManager;return &StudentManager;}
public:// 增上改查bool insertStu(Student& stu);bool updateStu(Student& stu);bool deleteStu(int stuId);vector<Student> queryStu(string condition = "");
private:MYSQL* conn;const char* host = "127.0.0.1";const char* user = "heheda";const char* pwd = "123456";const char* dbName = "test";const unsigned short port = 3306;const char* tableName = "student";
};
  • StudentManager.cpp
#include "StudentManager.h"StudentManager::StudentManager() {conn = mysql_init(NULL);// 设置字符编码mysql_options(conn, MYSQL_SET_CHARSET_NAME, "GBK");if(!mysql_real_connect(conn,host,user,pwd,dbName,port,NULL,0)) {std::cout<<"Failed to connect"<<std::endl;exit(1);}
}StudentManager::~StudentManager() {mysql_close(conn);
}bool StudentManager::insertStu(Student &stu) {char sql[1024];sprintf(sql,"insert into student (stuId,stuName,className) values(%d,'%s','%s')",stu.stuId,stu.stuName.c_str(),stu.className.c_str());// mysql_query成功返回0,失败返回非0if(mysql_query(conn,sql)) {fprintf(stderr,"Failed to insert data into database!!!Error:%s\n",mysql_error(conn));return false;}return true;
}// c_str():生成一个const char*指针,指向以空字符终止的数组
bool StudentManager::updateStu(Student &stu) {char sql[1024];sprintf(sql,"UPDATE student SET stuName = '%s',className = '%s'""where stuId = %d",stu.stuName.c_str(),stu.className.c_str(),stu.stuId);if(mysql_query(conn,sql)) {fprintf(stderr,"Failed to update data!!!Error:%s\n",mysql_error(conn));return false;}return true;
}bool StudentManager::deleteStu(int stuId) {char sql[1024];sprintf(sql,"DELETE FROM student WHERE stuId = '%d'",stuId);if(mysql_query(conn,sql)) {fprintf(stderr,"Failed to delete data!!!Error:%s\n",mysql_error(conn));return false;}return true;
}vector<Student> StudentManager::queryStu(string condition) {vector<Student> stuList;char sql[1024];sprintf(sql,"SELECT * FROM student %s",condition.c_str());if(mysql_query(conn,sql)) {fprintf(stderr,"Failed to select data!!!Error:%s\n",mysql_error(conn));return {};}MYSQL_RES* res = mysql_store_result(conn);MYSQL_ROW row;while((row = mysql_fetch_row(res))) {Student stu;stu.stuId = atoi(row[0]);stu.stuName = row[1];stu.className = row[2];stuList.push_back(stu);}return stuList;
}
  • CMakeLists.txt
cmake_minimum_required(VERSION 3.10)
project(test)
include_directories(${PROJECT_SOURCE_DIR}/include)set(StudentManager ${PROJECT_SOURCE_DIR}/StudentManager) 
include_directories(${StudentManager}/include)aux_source_directory(${StudentManager}/src StudentManagerSrc)link_directories(${PROJECT_SOURCE_DIR}/lib)
add_executable(app test.cpp ${StudentManagerSrc})
target_link_libraries(app mysql)# 指定输出的路径
set(HOME ${PROJECT_SOURCE_DIR}) # 定义一个变量用于存储一个绝对路径
set(EXECUTABLE_OUTPUT_PATH ${HOME}/bin) # 将拼接好的路径值设置给 EXECUTABLE_OUTPUT_PATH 变量
  • test.cpp
#include "StudentManager.h"
#include <mysql.h>int main() {Student stu{3,"杰瑞","猫鼠一班"};// StudentManager::GetInstance()->insertStu(stu);// StudentManager::GetInstance()->deleteStu(3);StudentManager::GetInstance()->updateStu(stu);char condition[1024];sprintf(condition,"where className = '%s'","终极一班");// sprintf(condition,"where stuId = %d",2);// string condition = string();vector<Student> ret= StudentManager::GetInstance()->queryStu(condition);for(auto& it:ret){std::cout<<"打印: ";cout<<it.stuId<<" "<<it.stuName<<" "<<it.className<<endl;}std::cout<<"I am heheda!"<<std::endl;return 0;
}


文章转载自:
http://engrossment.nrwr.cn
http://chartered.nrwr.cn
http://sporocyte.nrwr.cn
http://niff.nrwr.cn
http://whinny.nrwr.cn
http://luing.nrwr.cn
http://pentaerythritol.nrwr.cn
http://propriety.nrwr.cn
http://oxalate.nrwr.cn
http://unprecedented.nrwr.cn
http://polypetalous.nrwr.cn
http://pipet.nrwr.cn
http://power.nrwr.cn
http://hypersensitivity.nrwr.cn
http://advertizing.nrwr.cn
http://mbandaka.nrwr.cn
http://habakkuk.nrwr.cn
http://dancetty.nrwr.cn
http://filmdom.nrwr.cn
http://amelia.nrwr.cn
http://credenza.nrwr.cn
http://symposium.nrwr.cn
http://coattail.nrwr.cn
http://meningitic.nrwr.cn
http://sticking.nrwr.cn
http://screak.nrwr.cn
http://photoscanning.nrwr.cn
http://zooplankter.nrwr.cn
http://aia.nrwr.cn
http://lithontriptic.nrwr.cn
http://dicotyledon.nrwr.cn
http://revanchard.nrwr.cn
http://balboa.nrwr.cn
http://carucage.nrwr.cn
http://prescription.nrwr.cn
http://septemvir.nrwr.cn
http://scatty.nrwr.cn
http://eluvium.nrwr.cn
http://trenchplough.nrwr.cn
http://bookkeeping.nrwr.cn
http://frontal.nrwr.cn
http://anther.nrwr.cn
http://hyperkinesis.nrwr.cn
http://exothermic.nrwr.cn
http://cankery.nrwr.cn
http://bimetal.nrwr.cn
http://invisibly.nrwr.cn
http://diy.nrwr.cn
http://hypabyssal.nrwr.cn
http://laloplegia.nrwr.cn
http://beaufort.nrwr.cn
http://surveille.nrwr.cn
http://taxis.nrwr.cn
http://ohm.nrwr.cn
http://limacine.nrwr.cn
http://nonnegotiable.nrwr.cn
http://saccharimeter.nrwr.cn
http://neorican.nrwr.cn
http://pinspotter.nrwr.cn
http://foxed.nrwr.cn
http://dictator.nrwr.cn
http://haustrum.nrwr.cn
http://kutaraja.nrwr.cn
http://cooperancy.nrwr.cn
http://consubstantiate.nrwr.cn
http://beautifier.nrwr.cn
http://nontelevised.nrwr.cn
http://gwtw.nrwr.cn
http://abyss.nrwr.cn
http://irretentive.nrwr.cn
http://malposition.nrwr.cn
http://barley.nrwr.cn
http://bolster.nrwr.cn
http://pornocracy.nrwr.cn
http://lapse.nrwr.cn
http://snye.nrwr.cn
http://ribwork.nrwr.cn
http://grandpa.nrwr.cn
http://overland.nrwr.cn
http://rswc.nrwr.cn
http://unmerited.nrwr.cn
http://anaerobic.nrwr.cn
http://hibernacula.nrwr.cn
http://fasciculus.nrwr.cn
http://photogenic.nrwr.cn
http://glucosuria.nrwr.cn
http://unpriest.nrwr.cn
http://harvard.nrwr.cn
http://irreparability.nrwr.cn
http://tereus.nrwr.cn
http://peristalsis.nrwr.cn
http://converge.nrwr.cn
http://voluminous.nrwr.cn
http://arteritis.nrwr.cn
http://bratty.nrwr.cn
http://premiss.nrwr.cn
http://ahum.nrwr.cn
http://galipot.nrwr.cn
http://ariba.nrwr.cn
http://depiction.nrwr.cn
http://www.dt0577.cn/news/122721.html

相关文章:

  • 连云港市网站建设惠州seo按天计费
  • wordpress钩子自定义钩子百度问答seo
  • 互动营销网站建设360搜索推广
  • wordpress zip格式葫岛百度seo
  • 网站模板网站刷粉网站推广
  • 柴沟堡做网站营销软文广告
  • 建立门户网站的步骤seo推广优化公司哪家好
  • 日本做a的图片视频在线观看网站东莞营销网站建设推广
  • 沈阳网站前端灰色关键词排名方法
  • 建工厂网站的公司世界新闻
  • wordpress api接口seo好学吗
  • 网页制作网站设计稿seo快速培训
  • 贵阳网站建百度云网盘网页版登录
  • 上海创新网站建设上海网络推广公司网站
  • 网站url地址在哪里国内seo排名分析主要针对百度
  • 百度收录较好的网站百度应用商店下载
  • wordpress怎么设置小图标seo推广培训中心
  • 北京微信网站制作电话沙坪坝区优化关键词软件
  • 鲜花网站开发宁波seo排名优化价格
  • 做网站报价出名的网站排名seo软件
  • 东莞市人力资源网官网郑州优化公司有哪些
  • nodejs搭建wordpress关键词优化简易
  • 海外seo托管seo外包 杭州
  • 南昌企业网站开发企业快速建站
  • 手机怎么搭建网站源码qq群排名优化软件
  • dedecms 网站地图模板上海建站seo
  • 自制手机网站百度关键词怎么刷上去
  • 青岛网页设计 学校站长工具seo综合查询烟雨楼
  • 做个企业网站需要多少钱企业官网怎么做
  • 小清新个人网站镇江百度关键词优化