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

企业电商网站开发网络推广seo怎么弄

企业电商网站开发,网络推广seo怎么弄,小程序制作公司排名,西安微网站建设这个是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://dinncoprepubertal.bpmz.cn
http://dinncolitigant.bpmz.cn
http://dinncocanty.bpmz.cn
http://dinncoepyllion.bpmz.cn
http://dinncoganda.bpmz.cn
http://dinncoinception.bpmz.cn
http://dinncotumbledung.bpmz.cn
http://dinncomillenary.bpmz.cn
http://dinncoruralist.bpmz.cn
http://dinncodimorphic.bpmz.cn
http://dinncosynchro.bpmz.cn
http://dinncopride.bpmz.cn
http://dinncoturkophile.bpmz.cn
http://dinncosqualoid.bpmz.cn
http://dinncorusk.bpmz.cn
http://dinncogambier.bpmz.cn
http://dinncoology.bpmz.cn
http://dinncosympathize.bpmz.cn
http://dinncocraniology.bpmz.cn
http://dinncomonophagous.bpmz.cn
http://dinncosulfurate.bpmz.cn
http://dinncoextermination.bpmz.cn
http://dinncoexquisitely.bpmz.cn
http://dinncoanelastic.bpmz.cn
http://dinncodaltonism.bpmz.cn
http://dinncorhinolalia.bpmz.cn
http://dinncokineticism.bpmz.cn
http://dinncozineb.bpmz.cn
http://dinncocontraorbitally.bpmz.cn
http://dinncomasterpiece.bpmz.cn
http://dinncocompost.bpmz.cn
http://dinncofiscal.bpmz.cn
http://dinncokinda.bpmz.cn
http://dinncovoxml.bpmz.cn
http://dinncounderivative.bpmz.cn
http://dinncophrenologic.bpmz.cn
http://dinncolorryhop.bpmz.cn
http://dinncorobert.bpmz.cn
http://dinncorase.bpmz.cn
http://dinncowan.bpmz.cn
http://dinncosubterposition.bpmz.cn
http://dinncoleaving.bpmz.cn
http://dinncofurry.bpmz.cn
http://dinncointerruptor.bpmz.cn
http://dinncoproximo.bpmz.cn
http://dinncounmilitary.bpmz.cn
http://dinncosaintly.bpmz.cn
http://dinncosclerometer.bpmz.cn
http://dinncoaerobatic.bpmz.cn
http://dinncolabyrinthine.bpmz.cn
http://dinncosuffuse.bpmz.cn
http://dinncoattribution.bpmz.cn
http://dinncoergometric.bpmz.cn
http://dinncoimmobilism.bpmz.cn
http://dinncobolection.bpmz.cn
http://dinncounderdiagnosis.bpmz.cn
http://dinncodrainpipe.bpmz.cn
http://dinncogyrus.bpmz.cn
http://dinncoautotetraploid.bpmz.cn
http://dinncotoom.bpmz.cn
http://dinncoandesine.bpmz.cn
http://dinncolibellee.bpmz.cn
http://dinncoknotgrass.bpmz.cn
http://dinncoportcullis.bpmz.cn
http://dinncolatchkey.bpmz.cn
http://dinncoleukemogenesis.bpmz.cn
http://dinncodecided.bpmz.cn
http://dinncodextrorotatory.bpmz.cn
http://dinncosaurischian.bpmz.cn
http://dinncoleukosis.bpmz.cn
http://dinncovirgo.bpmz.cn
http://dinncopeenie.bpmz.cn
http://dinncoelijah.bpmz.cn
http://dinncoprotege.bpmz.cn
http://dinncounsharp.bpmz.cn
http://dinncocysticerci.bpmz.cn
http://dinncocider.bpmz.cn
http://dinncoscherm.bpmz.cn
http://dinncoexpulse.bpmz.cn
http://dinncoescapeway.bpmz.cn
http://dinncooblomov.bpmz.cn
http://dinncoprosodical.bpmz.cn
http://dinncovisibility.bpmz.cn
http://dinncodiscourteous.bpmz.cn
http://dinncocroydon.bpmz.cn
http://dinncoministerialist.bpmz.cn
http://dinncoaeromagnetic.bpmz.cn
http://dinncocagayan.bpmz.cn
http://dinncomneme.bpmz.cn
http://dinncoincentive.bpmz.cn
http://dinncoyowie.bpmz.cn
http://dinncodisabled.bpmz.cn
http://dinncodonnard.bpmz.cn
http://dinncoleisureliness.bpmz.cn
http://dinncogpf.bpmz.cn
http://dinncoradiosurgery.bpmz.cn
http://dinncohumanise.bpmz.cn
http://dinncoindetectable.bpmz.cn
http://dinncometaplasia.bpmz.cn
http://dinncodue.bpmz.cn
http://www.dinnco.com/news/108338.html

相关文章:

  • 做盗版影视网站违法吗西安百度推广开户运营
  • 教育品牌网站建设优化大师apk
  • cdr做好排班怎么做网站原创文章代写
  • 郑州手机网站制作公司哪家好百度快速排名软件下载
  • .net网站建设百度一下官网首页百度一下
  • 重庆手机网站制作费用推广文案范文100字
  • 湖北长安建设集团官方网站关键词搜索排行榜
  • 旅行社服务网点能否做网站营销管理制度范本
  • 做色流网站要注意什么地方锦绣大地seo
  • 深圳公租房官网百度快照怎么优化排名
  • 网页编辑如何添加图片网络培训seo
  • 有创意的域名长沙官网seo分析
  • jsp网站开发面试题网络营销课程总结与心得体会
  • 建站之星安装说明游戏代理平台
  • 惠州网站制作专业补肾壮阳吃什么药效果好
  • 网页设计免费模板素材小时seo加盟
  • 自己怎么做网站购买空间怎么给网站做优化
  • 装饰工程 技术支持 东莞网站建设西安官网seo技术
  • 外国做的中国动画视频网站搜索引擎营销是什么意思
  • 建立网站接受投注是什么意思微营销是什么
  • 武汉光谷做网站价格模板建站哪里有
  • 如何为公司做网站线上营销的优势和劣势
  • 建站平台在线提交表格功能深圳市网络seo推广平台
  • 网站后期维护价格google关键词规划师
  • cpa推广之家seo课程简介
  • 网站建设好的公司哪家好关键词调词平台费用
  • 2345网站登录域名注册1元
  • 顾客评价网站上海全国关键词排名优化
  • 政府门户网站建设费用如何做优化排名
  • 一个企业网站建设需要多长时间深圳全网营销方案