📄 update.h
字号:
#ifndef _UPDATE_H
#define _UPDATE_H
#include "common.h"
int update(const char* update_path)
{
ifstream in;
in.open(update_path);
if (!in.is_open())
{
cerr<<"can't open the file\n";
return 0;//can't open the file
}
string create_cmd="",temp;
bool right=false;// check the format
while(getline(in,temp))create_cmd+=" "+temp;//get all the string in the create file
//cout<<create_cmd;
in.close();
string::const_iterator beg = create_cmd.begin();
string::const_iterator end = create_cmd.end();
smatch result;
const string total("\\s*update\\s+(\\w+)\\s+set\\s+(\\w+)\\s*=\\s*(\\w+)\\s*where\\s*(\\w+)\\s*=\\s*(\\w+)\\s+(\\w+)\\s+(\\w+)\\s*=\\s*(\\w+)\\s*$");
regex reg(total);
string table_name,set_column_name,set_column_value,condition,column_1,column_1_value;
string column_2,column_2_value;
while(regex_search(beg, end, result, reg))
{
table_name = result[1].str();
set_column_name = result[2].str();
set_column_value = result[3].str();
column_1 = result[4].str();
column_1_value = result[5].str();
condition = result[6].str();
column_2 = result[7].str();
column_2_value = result[8].str();
cout<<table_name<<set_column_name<<set_column_value<<column_1<<"\n";
cout<<column_1_value<<condition<<column_2<<column_2_value<<"\n";
beg = result[0].second;
right=true;
}
return 1;
}
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -