Skip to content

Commit

Permalink
correctly inserts image title to database. rearranged open, console o…
Browse files Browse the repository at this point in the history
…utput to reduce clutter
  • Loading branch information
mlilback committed Mar 28, 2017
1 parent 6fce82e commit f77c496
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/FileManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ RC2::FileManager::Impl::connect(std::shared_ptr<PGDBConnection> connection, long
long
RC2::FileManager::Impl::insertImage(string fname, string imgNumStr)
{
string title = "";
string title = "NULL";
if (imgNameToTitle_.count(fname) > 0) {
dbConnection_->escapeLiteral(imgNameToTitle_[fname], title);
}
Expand Down
7 changes: 4 additions & 3 deletions src/RSession.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ RC2::RSession::~RSession()
void
RC2::RSession::consoleCallback(const string &text, bool is_error)
{
if (!_impl->open && !is_error) return;
if (stringHasPrefix(text, "rc2.imgstart=")) {
auto imgname = text.substr(13);
boost::algorithm::trim(imgname);
Expand All @@ -253,7 +254,7 @@ RC2::RSession::consoleCallback(const string &text, bool is_error)
_impl->currentImageName = "";
return;
}
LOG(INFO) << "write cb: " << text << "(ignore=" << _impl->ignoreOutput << ",vis=" << R_Visible << ",sip=" << _impl->sourceInProgress << ")";
LOG(INFO) << "write cb: " << text << "(ignore=" << _impl->ignoreOutput << ",vis=" << R_Visible << ",sip=" << _impl->sourceInProgress << ",err=" << is_error << ")";
if (_impl->captureStdOut) {
_impl->stdOutCapture += text;
return;
Expand Down Expand Up @@ -486,8 +487,6 @@ RC2::RSession::handleOpenCommand(JsonCommand &cmd)
LOG(INFO) << "wd=" << _impl->tmpDir->getPath();
auto connection = make_shared<PGDBConnection>();
connection->connect(connectString.str());
_impl->fileManager->initFileManager(workDir, connection, _impl->wspaceId, _impl->sessionRecId);
bool haveRData = _impl->fileManager->loadRData();
setenv("TMPDIR", workDir.c_str(), 1);
setenv("TEMP", workDir.c_str(), 1);
setenv("R_DEFAULT_DEVICE", "png", 1);
Expand All @@ -499,6 +498,8 @@ RC2::RSession::handleOpenCommand(JsonCommand &cmd)
_impl->R->parseEvalQNT("rm(argv)"); //RInside creates this even though we passed NULL
_impl->R->parseEvalQNT("options(device = \"rc2.pngdev\", bitmapType = \"cairo\")");
_impl->R->parseEvalQNT("source(\"" + escape_quotes(ourCodePath) + "\", keep.source=FALSE)");
_impl->fileManager->initFileManager(workDir, connection, _impl->wspaceId, _impl->sessionRecId);
bool haveRData = _impl->fileManager->loadRData();
if (haveRData) {
LOG(INFO) << "loading .RData";
_impl->R->parseEvalQNT("load(\".RData\")");
Expand Down

0 comments on commit f77c496

Please sign in to comment.