Skip to content

Commit f77c496

Browse files
committed
correctly inserts image title to database. rearranged open, console output to reduce clutter
1 parent 6fce82e commit f77c496

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/FileManager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ RC2::FileManager::Impl::connect(std::shared_ptr<PGDBConnection> connection, long
151151
long
152152
RC2::FileManager::Impl::insertImage(string fname, string imgNumStr)
153153
{
154-
string title = "";
154+
string title = "NULL";
155155
if (imgNameToTitle_.count(fname) > 0) {
156156
dbConnection_->escapeLiteral(imgNameToTitle_[fname], title);
157157
}

src/RSession.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,7 @@ RC2::RSession::~RSession()
241241
void
242242
RC2::RSession::consoleCallback(const string &text, bool is_error)
243243
{
244+
if (!_impl->open && !is_error) return;
244245
if (stringHasPrefix(text, "rc2.imgstart=")) {
245246
auto imgname = text.substr(13);
246247
boost::algorithm::trim(imgname);
@@ -253,7 +254,7 @@ RC2::RSession::consoleCallback(const string &text, bool is_error)
253254
_impl->currentImageName = "";
254255
return;
255256
}
256-
LOG(INFO) << "write cb: " << text << "(ignore=" << _impl->ignoreOutput << ",vis=" << R_Visible << ",sip=" << _impl->sourceInProgress << ")";
257+
LOG(INFO) << "write cb: " << text << "(ignore=" << _impl->ignoreOutput << ",vis=" << R_Visible << ",sip=" << _impl->sourceInProgress << ",err=" << is_error << ")";
257258
if (_impl->captureStdOut) {
258259
_impl->stdOutCapture += text;
259260
return;
@@ -486,8 +487,6 @@ RC2::RSession::handleOpenCommand(JsonCommand &cmd)
486487
LOG(INFO) << "wd=" << _impl->tmpDir->getPath();
487488
auto connection = make_shared<PGDBConnection>();
488489
connection->connect(connectString.str());
489-
_impl->fileManager->initFileManager(workDir, connection, _impl->wspaceId, _impl->sessionRecId);
490-
bool haveRData = _impl->fileManager->loadRData();
491490
setenv("TMPDIR", workDir.c_str(), 1);
492491
setenv("TEMP", workDir.c_str(), 1);
493492
setenv("R_DEFAULT_DEVICE", "png", 1);
@@ -499,6 +498,8 @@ RC2::RSession::handleOpenCommand(JsonCommand &cmd)
499498
_impl->R->parseEvalQNT("rm(argv)"); //RInside creates this even though we passed NULL
500499
_impl->R->parseEvalQNT("options(device = \"rc2.pngdev\", bitmapType = \"cairo\")");
501500
_impl->R->parseEvalQNT("source(\"" + escape_quotes(ourCodePath) + "\", keep.source=FALSE)");
501+
_impl->fileManager->initFileManager(workDir, connection, _impl->wspaceId, _impl->sessionRecId);
502+
bool haveRData = _impl->fileManager->loadRData();
502503
if (haveRData) {
503504
LOG(INFO) << "loading .RData";
504505
_impl->R->parseEvalQNT("load(\".RData\")");

0 commit comments

Comments
 (0)