Ejemplo n.º 1
0
 void CKeyword::removeKeyword(const int keywordId)
 {
    //delete keyword
    auto qDelete = m_databaseRequester->newQuery();
    qDelete.DeleteFrom(CKeywordTable::getTableName()).
           Where(CKeywordTable::getIdColumnName(), CQUERY_OP_EQUAL, keywordId);
    if (m_databaseRequester->queryStatement(qDelete) <= 0)
       throw shared::exception::CEmptyResult("No lines affected");
 }
Ejemplo n.º 2
0
void API::Switcher(SqlCommand* command){
  SqlCommandType command_type = command->command_type();
  Info info;
  // typedef std::chrono::high_resolution_clock Clock;
  // typedef std::chrono::milliseconds milliseconds;
  // Clock::time_point t0 = Clock::now();
  switch(command_type){
    case kSqlInvalid: { info = Info("Invalid Command, Please check your syntax."); break; }
    case kSqlCreateTable: { info = CreateTable(dynamic_cast<SqlCommandCreateTable *>(command)); break; }
    case kSqlCreateIndex: { info = CreateIndex(dynamic_cast<SqlCommandCreateIndex *>(command)); break; }
    case kSqlDeleteFrom: { info = DeleteFrom(dynamic_cast<SqlCommandDeleteFrom *>(command)); break; }
    case kSqlDropTable: { info = DropTable(dynamic_cast<SqlCommandDropTable *>(command)); break; }
    case kSqlDropIndex: { info = DropIndex(dynamic_cast<SqlCommandDropIndex *>(command)); break; }
    case kSqlInsertInto: { info = InsertInto(dynamic_cast<SqlCommandInsertInto *>(command)); break; }
    case kSqlSelectFrom: { info = SelectFrom(dynamic_cast<SqlCommandSelectFrom *>(command));break; }
  }
  info.PrintInfo();
  // Clock::time_point t1 = Clock::now();
  // milliseconds ms = std::chrono::duration_cast<milliseconds>(t1 - t0);
  // std::cout<<"time used:"<<ms.count()<<" ms."<<std::endl;
}
Ejemplo n.º 3
0
void CBaseRecordVector::Clear() 
  { DeleteFrom(0); }