// testsqlite3.cpp : 定义控制台应用程序的入口点。 // #include "stdafx.h" #include "testsqlite3.h" // #ifdef _DEBUG // #define new DEBUG_NEW // #endif #include #include "..\\SQLite3\\sqlite3.h" #pragma comment(lib, "SQLite3.lib") #include "StringProcess.h" #include "DataImpl.h" #include "TaskInfoMessage.pb.h" // 唯一的应用程序对象 CWinApp theApp; using namespace std; static int callback(void *NotUsed, int argc, char **argv, char **azColName) { int i; for(i=0; i vValues; for ( int i = 1; i <= nRow; i++ ) { for(int j = 0; jOpen()) { if (0) {// 插入数据; satdDatabase::complieServer tagServer; tagServer.set_server("192.168.1.1"); tagServer.set_user("home"); tagServer.set_password("password99999"); CDataImpl::GetInstance()->InsertComplieServer(tagServer); // 查询数据; satdDatabase::listServer list; int nRow = CDataImpl::GetInstance()->QueryComplieServer(list); for (int i = 0; i < list.servers_size(); i++) { satdDatabase::complieServer ser = list.servers(i); OutputDebugString(ser.server().c_str()); OutputDebugString("\n"); OutputDebugString(ser.user().c_str()); OutputDebugString("\n"); OutputDebugString(ser.password().c_str()); OutputDebugString("\n"); } } if (0) { satdDatabase::model tagModel; tagModel.set_name("set_name"); tagModel.set_softsuffix("set_softsuffix"); satdDatabase::listEndFlag* pflags = tagModel.mutable_flags(); pflags->add_terminator("end1"); pflags->add_terminator("end2"); pflags->add_terminator("end3"); pflags->add_terminator("end4"); pflags->add_terminator("end5"); satdDatabase::modelContent *pMc = tagModel.mutable_content(); pMc->set_complietime("set_complietime"); pMc->set_projectmodel("set_projectmodel"); pMc->set_productname("set_productname"); pMc->set_svndir("set_svndir"); pMc->set_command("set_command"); pMc->set_projectname("set_projectname"); pMc->set_projectsn("set_projectsn"); pMc->set_softver("set_softver"); pMc->set_svnver("set_svnver"); pMc->set_projectid("set_projectid"); pMc->set_zone("set_zone"); pMc->set_uistyle("set_uistyle"); pMc->set_compliefiledir("set_compliefiledir"); pMc->set_username("set_username"); pMc->set_time("set_time"); CDataImpl::GetInstance()->InsertAutoComplieModel(tagModel); // 查询; satdDatabase::listModel models; CDataImpl::GetInstance()->QueryAutoComplieModel(models); for ( int i = 0; i < models.models_size(); i++ ) { satdDatabase::model md = models.models(i); OutputDebugString(md.name().c_str()); OutputDebugString("\n"); OutputDebugString(md.softsuffix().c_str()); OutputDebugString("\n"); pflags = md.mutable_flags(); for ( int j = 0; j < md.mutable_flags()->terminator_size(); j++) { OutputDebugString(pflags->terminator(j).c_str()); OutputDebugString("\n"); } pMc = md.mutable_content(); OutputDebugString(pMc->compliefiledir().c_str()); OutputDebugString("\n"); OutputDebugString(pMc->projectmodel().c_str()); OutputDebugString("\n"); OutputDebugString(pMc->productname().c_str()); OutputDebugString("\n"); OutputDebugString(pMc->svndir().c_str()); OutputDebugString("\n"); OutputDebugString(pMc->command().c_str()); OutputDebugString("\n"); OutputDebugString(pMc->projectname().c_str()); OutputDebugString("\n"); OutputDebugString(pMc->projectsn().c_str()); OutputDebugString("\n"); OutputDebugString(pMc->softver().c_str()); OutputDebugString("\n"); OutputDebugString(pMc->projectid().c_str()); OutputDebugString("\n"); OutputDebugString(pMc->zone().c_str()); OutputDebugString("\n"); OutputDebugString(pMc->uistyle().c_str()); OutputDebugString("\n"); OutputDebugString(pMc->compliefiledir().c_str()); OutputDebugString("\n"); OutputDebugString(pMc->username().c_str()); OutputDebugString("\n"); OutputDebugString(pMc->time().c_str()); OutputDebugString("\n"); } } if (0) { satdDatabase::model tagModel; tagModel.set_name("set_name"); tagModel.set_softsuffix("set_softsuffix__dddddd"); satdDatabase::listEndFlag* pflags = tagModel.mutable_flags(); pflags->add_terminator("end111"); pflags->add_terminator("end222"); pflags->add_terminator("end333"); pflags->add_terminator("end444"); pflags->add_terminator("end555"); satdDatabase::modelContent *pMc = tagModel.mutable_content(); pMc->set_complietime("set_complietimedddd"); pMc->set_projectmodel("set_projectmodelddd"); pMc->set_productname("set_productnameddd"); pMc->set_svndir("set_svndidddr"); pMc->set_command("set_commadddnd"); pMc->set_projectname("set_projectnameddd"); pMc->set_projectsn("set_projectsnddd"); pMc->set_softver("set_softverddd"); pMc->set_svnver("set_svnverddd"); pMc->set_projectid("set_projectidddd"); pMc->set_zone("set_zoneddd"); pMc->set_uistyle("set_uistyleddd"); pMc->set_compliefiledir("set_compliefiledirddd"); pMc->set_username("set_username"); pMc->set_time("set_time"); CDataImpl::GetInstance()->UpdateAutoCompliteModel(tagModel); // 查询; satdDatabase::listModel models; CDataImpl::GetInstance()->QueryAutoComplieModel(models); for (int i = 0; i < models.models_size(); i++) { satdDatabase::model md = models.models(i); OutputDebugString(md.name().c_str()); OutputDebugString("\n"); OutputDebugString(md.softsuffix().c_str()); OutputDebugString("\n"); pflags = md.mutable_flags(); for (int j = 0; j < md.mutable_flags()->terminator_size(); j++) { OutputDebugString(pflags->terminator(j).c_str()); OutputDebugString("\n"); } pMc = md.mutable_content(); OutputDebugString(pMc->compliefiledir().c_str()); OutputDebugString("\n"); OutputDebugString(pMc->projectmodel().c_str()); OutputDebugString("\n"); OutputDebugString(pMc->productname().c_str()); OutputDebugString("\n"); OutputDebugString(pMc->svndir().c_str()); OutputDebugString("\n"); OutputDebugString(pMc->command().c_str()); OutputDebugString("\n"); OutputDebugString(pMc->projectname().c_str()); OutputDebugString("\n"); OutputDebugString(pMc->projectsn().c_str()); OutputDebugString("\n"); OutputDebugString(pMc->softver().c_str()); OutputDebugString("\n"); OutputDebugString(pMc->projectid().c_str()); OutputDebugString("\n"); OutputDebugString(pMc->zone().c_str()); OutputDebugString("\n"); OutputDebugString(pMc->uistyle().c_str()); OutputDebugString("\n"); OutputDebugString(pMc->compliefiledir().c_str()); OutputDebugString("\n"); OutputDebugString(pMc->username().c_str()); OutputDebugString("\n"); OutputDebugString(pMc->time().c_str()); OutputDebugString("\n"); } } if (1) { CDataImpl::GetInstance()->ExecteSQL("delete from model where name = 'set_name'"); } } #endif //getchar(); system("pause"); } return nRetCode; }