Skip to content

Commit

Permalink
Merge pull request #6 from belobrov-andrey/sqlitedbpathwithspaces
Browse files Browse the repository at this point in the history
SQLite database path may contain spaces if enclosed in quotes.
  • Loading branch information
mloskot committed Sep 28, 2012
2 parents d3b0300 + 392ae75 commit d80b622
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/backends/sqlite3/session.cpp
Expand Up @@ -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;
Expand Down

0 comments on commit d80b622

Please sign in to comment.