BOOL CDatabaseDlg2::OnInitDialog() { CDialogEx::OnInitDialog(); m_list.InsertColumn(0,"ID",LVCFMT_LEFT,40); m_list.InsertColumn(1,"源图像名",LVCFMT_LEFT,90); m_list.InsertColumn(2,"源图像路径",LVCFMT_LEFT,120); m_list.InsertColumn(3,"人脸图像名",LVCFMT_LEFT,90); m_list.InsertColumn(4,"人脸图像路径",LVCFMT_LEFT,120); m_list.InsertColumn(5,"生成时间",LVCFMT_LEFT,120); CString cmdStr = "Select * from face order by ID"; ShowDatabase(cmdStr); return TRUE; }
void CDatabaseDlg2::OnBnClickedDeleteFace() { // TODO: 在此添加控件通知处理程序代码 int nIndex; CString id,fpath; CDatabase db; db.Open(NULL, FALSE, FALSE, _T("ODBC;DSN=face;UID=root;PWD=root")); nIndex = m_list.GetNextItem(-1, LVNI_ALL | LVNI_SELECTED); //if(-1 == nIndex) // nIndex = 0; if(-1 != nIndex) { id = m_list.GetItemText(nIndex,0); fpath = m_list.GetItemText(nIndex,4); } else { MessageBox("请选择要删除人脸!"); db.Close(); return; } //删除文件 CFileFind finder; if(finder.FindFile(fpath)) { CFile TempFile; TempFile.Remove(fpath); } CString sql; sql.Format("delete from face where ID=%s", id); db.ExecuteSQL(sql); db.Close(); CString cmdStr = "Select * from face order by ID"; m_sname.SetWindowText(""); m_spath.SetWindowText(""); m_fname.SetWindowText(""); m_fpath.SetWindowText(""); ShowDatabase(cmdStr); MessageBox("删除成功"); }
void CDatabaseDlg2::OnBnClickedAlterFace() { // TODO: 在此添加控件通知处理程序代码 int nIndex; CString sname,spath,fname,fpath,id; CDatabase db; db.Open(NULL, FALSE, FALSE, _T("ODBC;DSN=face;UID=root;PWD=root")); nIndex = m_list.GetNextItem(-1, LVNI_ALL | LVNI_SELECTED); //if(-1 == nIndex) // nIndex = 0; if(-1 == nIndex) { MessageBox("请选择要修改的列"); db.Close(); return; } else { id = m_list.GetItemText(nIndex,0); m_sname.GetWindowText(sname); m_spath.GetWindowText(spath); m_fname.GetWindowText(fname); m_fpath.GetWindowText(fpath); } spath.Replace("\\","\\\\"); fpath.Replace("\\","\\\\"); CString sql; sql.Format("update face set SourceImg='%s' , SourcePath='%s' ,FaceName='%s',FacePath='%s' where ID=%s", sname, spath,fname,fpath,id); db.ExecuteSQL(sql); db.Close(); CString cmdStr = "Select * from face order by ID"; m_sname.SetWindowText(""); m_spath.SetWindowText(""); m_fname.SetWindowText(""); m_fpath.SetWindowText(""); ShowDatabase(cmdStr); MessageBox("修改成功"); }
int MakeMain::Run(int argc, char **argv, char **env) { char *p = getenv("MAKEFLAGS"); if (p) { Variable *v = new Variable("MAKEFLAGS", p, Variable::f_recursive, Variable::o_environ); *VariableContainer::Instance() += v; p = getenv("MAKEOVERRIDES"); if (p) { Variable *v = new Variable("MAKEOVERRIDES", p, Variable::f_recursive, Variable::o_environ); *VariableContainer::Instance() += v; } Eval r(v->GetValue(), false); std::string cmdLine = r.Evaluate(); Dispatch(cmdLine.c_str()); } if (!switchParser.Parse(&argc, argv) || help.GetValue() || help2.GetValue()) { Utils::banner(argv[0]); Utils::usage(argv[0], usageText); } if (dir.GetValue().size()) { cwd = OS::GetWorkingDir(); if (!OS::SetWorkingDir(dir.GetValue())) { std::cout << "Cannot set working dir to: " << dir.GetValue() << std::endl; return 2; } } if (printDir.GetValue()) { std::cout << OS::GetWorkingDir() << std::endl; } if (cancelKeep.GetValue()) { cancelKeep.SetValue(false); keepGoing.SetValue(false); } bool done = false; Eval::Init(); Eval::SetWarnings(warnUndef.GetValue()); while (!done && !Eval::GetErrCount()) { VariableContainer::Instance()->Clear(); RuleContainer::Instance()->Clear(); Include::Instance()->Clear(); Maker::ClearFirstGoal(); LoadEnvironment(env); LoadCmdDefines(); SetVariable("MAKE", argv[0], Variable::o_environ, false); Variable *v = VariableContainer::Instance()->Lookup("SHELL"); if (!v) { v = VariableContainer::Instance()->Lookup("COMSPEC"); if (!v) v = VariableContainer::Instance()->Lookup("ComSpec"); if (v) { std::string val = v->GetValue(); SetVariable("SHELL", val, Variable::o_environ, true); } } std::string goals; for (int i=1; i < argc; i++) { if (goals.size()) goals += " "; goals += argv[i]; } SetVariable("MAKECMDGOALS", goals, Variable::o_command_line, false); SetMakeFlags(); if (restarts) { std::strstream str; std::string temp; str << restarts; str >> temp; SetVariable("MAKE_RESTARTS", temp, Variable::o_command_line, false); } v = VariableContainer::Instance()->Lookup("MAKE_LEVEL"); if (!v) { SetVariable("MAKE_LEVEL", "0", Variable::o_environ, true); } else { std::strstream str; std::string temp; str << v->GetValue(); int n; str >> n; n++; str << n; str >> temp; v->SetValue(temp); } SetVariable(".FEATURES","second-expansion order-only target-specific", Variable::o_environ, false); SetVariable(".DEFAULT_GOAL","", Variable::o_environ, false); SetVariable(".INCLUDE_DIRS",includes.GetValue(), Variable::o_command_line, false); SetVariable("VPATH",includes.GetValue(), Variable::o_environ, false); SetInternalVars(); v = VariableContainer::Instance()->Lookup("MAKEFILES"); if (v) { v->SetExport(true); Include::Instance()->AddFileList(v->GetValue(), true, true); } Rule *rule = new Rule(".SUFFIXES", ".c .o .cpp .nas .asm", "", new Command("", 0), "", 0, false); RuleList *ruleList = new RuleList(".SUFFIXES"); ruleList->Add(rule, false); *RuleContainer::Instance() += ruleList; std::string files = specifiedFiles.GetValue(); if (!files.size()) files = "makefile"; Include::Instance()->AddFileList(files, false, false); SetupImplicit(); RuleContainer::Instance()->SecondaryEval(); done = !Include::Instance()->MakeMakefiles(silent.GetValue()); if (!done) restarts++; } if (showDatabase.GetValue()) ShowDatabase(); int rv = 0; if (Eval::GetErrCount()) { rv = 2; } else { bool xsilent = silent.GetValue(); bool xignore = ignoreErrors.GetValue(); bool xdontrun = displayOnly.GetValue(); bool xtouch = touch.GetValue(); xdontrun |= xtouch || query.GetValue(); xsilent |= xtouch || query.GetValue(); Maker maker(xsilent, xdontrun, xignore, xtouch, rebuild.GetValue(), newFiles.GetValue(), oldFiles.GetValue()); for (int i = 1; i < argc; i++) { maker.AddGoal(argv[i]); } if (maker.CreateDependencyTree()) { rv = maker.RunCommands(keepGoing.GetValue()); if (query.GetValue() && rv == 0) rv = maker.HasCommands() ? 1 : 0; } else { rv = 2; } } if (dir.GetValue().size()) { OS::SetWorkingDir(cwd); } if (printDir.GetValue()) { std::cout << OS::GetWorkingDir() << std::endl; } return rv; }