Permalink
Browse files

SQLite database path may contain spaces if enclosed in quotes.

  • Loading branch information...
Belobrov Andrey
Belobrov Andrey committed Sep 4, 2012
1 parent b82364e commit 392ae75c9d2f438547ce0d621d56c680a32e823b
Showing with 19 additions and 0 deletions.
  1. +19 −0 src/backends/sqlite3/session.cpp
@@ -51,6 +51,25 @@ sqlite3_session_backend::sqlite3_session_backend(
std::string key, val;
std::getline(ssconn, key, '=');
std::getline(ssconn, val, ' ');
if (val.size()>0 && val[0]=='\"')
{
std::string quotedVal = val.erase(0, 1);
if (quotedVal[quotedVal.size()-1] == '\"')
{
quotedVal.erase(val.size()-1);
}
else // space inside value string
{
std::getline(ssconn, val, '\"');
quotedVal = quotedVal + " " + val;
std::getline(ssconn, std::string(), ' ');
}
val = quotedVal;
}
if ("dbname" == key || "db" == key)
{
dbname = val;

0 comments on commit 392ae75

Please sign in to comment.