Example #1
0
DependenciesJob::DependenciesJob(const std::shared_ptr<QueryMessage> &query, const std::shared_ptr<Project> &project)
    : QueryJob(query, project, QuietJob)
{
    Deserializer deserializer(query->query());
    Path path;
    deserializer >> path >> mArgs;
    mFileId = Location::fileId(path);
}
Example #2
0
FindFileJob::FindFileJob(const std::shared_ptr<QueryMessage> &query, const std::shared_ptr<Project> &project)
    : QueryJob(query, project, ::flags(query->flags()))
{
    const String q = query->query();
    if (!q.isEmpty()) {
        if (query->flags() & QueryMessage::MatchRegex) {
            mRegex = q.ref();
        } else {
            mPattern = q;
        }
    }
}
Example #3
0
 TRecord query(TQuery&& q, single_result_tag)
 {
   using std::to_string; using std::begin; using std::end;
   formatter fmt { };
   const std::string qry = to_string(fix::forward<TQuery>(q), fmt);
   if(0 != _context->query(qry.c_str())) {
     throw std::runtime_error("Could not query database");
   }
   mysql::basic_result res(*_context);
   if(res) {
     return impl::make_record<TRecord>::make(*begin(res));
   }
   throw std::runtime_error("No valid context available");
 }
Example #4
0
IncludeFileJob::IncludeFileJob(const std::shared_ptr<QueryMessage> &query, const std::shared_ptr<Project> &project)
    : QueryJob(query, project)
{
    const uint32_t fileId = Location::fileId(query->currentFile());
    mSource = project->sources(fileId).value(query->buildIndex());
    if (mSource.isNull()) {
        for (const uint32_t dep : project->dependencies(fileId, Project::DependsOnArg)) {
            mSource = project->sources(dep).value(query->buildIndex());
            if (!mSource.isNull())
                break;
        }
    }
    mSymbol = query->query();
}
Example #5
0
 Container query(TQuery&& q, multiple_results_tag)
 {
   using std::to_string; using std::begin; using std::end;
   formatter fmt { };
   const std::string qry = to_string(fix::forward<TQuery>(q), fmt);
   if(0 != _context->query(qry.c_str())) {
     throw std::runtime_error("Could not query database");
   }
   mysql::basic_result res(*_context);
   if(res) {
     Container ret;
     ret.reserve(res.rows());
     std::transform(
       begin(res),
       end(res),
       std::back_inserter(ret),
       [](const basic_row& r) {
         return impl::make_record<TRecord>::make(r);
       }
     );
     return ret;
   }
   throw std::runtime_error("No valid context available");
 }
Example #6
0
ListSymbolsJob::ListSymbolsJob(const std::shared_ptr<QueryMessage> &query, const std::shared_ptr<Project> &proj)
    : QueryJob(query, proj, query->flags() & QueryMessage::ElispList ? elispFlags : defaultFlags),
      string(query->query())
{
}
Example #7
0
StatusJob::StatusJob(const std::shared_ptr<QueryMessage> &q, const std::shared_ptr<Project> &project)
    : QueryJob(q, WriteUnfiltered|QuietJob, project), query(q->query())
{
}
Example #8
0
FindSymbolsJob::FindSymbolsJob(const std::shared_ptr<QueryMessage> &query, const std::shared_ptr<Project> &proj)
    : QueryJob(query, proj, ::jobFlags(query->flags())), string(query->query())
{
}