Example #1
0
int MovieDB::UpdatePath(CString csOldPath , CString csNewPath)
{
	DB db;
	db.Connect();
	CString csSQL;
	csSQL.Format("update MovieTable set Path='%s' where Path='%s'",csNewPath,csOldPath);
    if(db.Execute(csSQL)==FALSE)
	{
		return 0;
	}
	db.DisConnect();
	return 1;
}
Example #2
0
int MovieDB::DeleteMovie(CString csPath)
{
	DB db;
	db.Connect();
	CString csSQL;
	csSQL.Format("delete from MovieTable where Path='%s' ",csPath);
    if(db.Execute(csSQL)==FALSE)
	{
		return 0;
	}
	db.DisConnect();
	return 1;
}
Example #3
0
int MovieDB::InsertMovie(Movie clsMovie)
{
	DB db;
	db.Connect();
	CString csSQL;
	CStringArray csaMaxID;
	db.Select("select top 1 MovieID from MovieTable order by MovieID desc",csaMaxID);	
    db.CloseRecordset();
	csSQL.Format("insert into MovieTable values(,%d,%d,%d,%d,'%s','%s','%s','%s')",atoi(csaMaxID.GetAt(0))+1,
		clsMovie.iTimeLength,clsMovie.iLength,clsMovie.iWidth,clsMovie.CStrYear,clsMovie.CStrMovieType,clsMovie.CStrPath,clsMovie.CStrFileName);
    if(db.Execute(csSQL)==FALSE)
	{
		return 0;
	}
	db.DisConnect();
	return 1;
}
Example #4
0
int main()
{
  HDC1000 hdc1000_1;
  MPL115A2 mpl115a2_1;
  MS5607 ms5607_1;


  DISPLAY d;
  LOG     l;
  DB      db;
  
  

  hdc1000_1.Init();
  mpl115a2_1.Init();
  ms5607_1.Init();

  std::cout << "Hello\nWorld!\n";

  db.Connect();

  if( signal(SIGINT, sig_handler) == SIG_ERR) {
    std::cerr << "sig_handler fail."<<std::endl;
  }


  while(1) {
    std::thread th0(governor);
    //
    std::thread th1([&]{hdc1000_1.Get();});
    std::thread th2([&]{mpl115a2_1.Get();});
    std::thread th3([&]{ms5607_1.Get();});
    //
    l.GetTime();//現在時刻の取得
    //
    th1.join();
    th2.join();
    th3.join();
    //
    l.Write(
      hdc1000_1.Read(0),//Temp
      hdc1000_1.Read(1),//Humi
      mpl115a2_1.Read(1),
      mpl115a2_1.Read(0),
      ms5607_1.Read(1),//
      ms5607_1.Read(0) //Temp
    );
    // 表示
    d.Disp(l);
    // DBインサート
    db.Insert(l);
    //  Wait
    th0.join();
    //  Terminate
    if(sig) {
      std::cout <<"Recieve SIGINT\n";
      db.Disconnect();
      std::cout <<std::flush;
      break;
    }
  }
}