A few whitespace fixups

This commit is contained in:
Geert Janssens 2018-04-17 23:04:18 +02:00
parent 06db9bcf2b
commit 3138229cf6

View File

@ -259,13 +259,13 @@ load_splits_for_transactions (GncSqlBackend* sql_be, std::string selector)
std::string sql("SELECT "); std::string sql("SELECT ");
if (selector.empty()) if (selector.empty())
{ {
sql += SPLIT_TABLE ".* FROM " SPLIT_TABLE " INNER JOIN " sql += SPLIT_TABLE ".* FROM " SPLIT_TABLE " INNER JOIN "
TRANSACTION_TABLE " ON " SPLIT_TABLE "." + sskey + " = " TRANSACTION_TABLE " ON " SPLIT_TABLE "." + sskey + " = "
TRANSACTION_TABLE "." + tpkey; TRANSACTION_TABLE "." + tpkey;
selector = "(SELECT DISTINCT " + tpkey + " FROM " TRANSACTION_TABLE ")"; selector = "(SELECT DISTINCT " + tpkey + " FROM " TRANSACTION_TABLE ")";
} }
else else
sql += " * FROM " SPLIT_TABLE " WHERE " + sskey + " IN " + selector; sql += " * FROM " SPLIT_TABLE " WHERE " + sskey + " IN " + selector;
// Execute the query and load the splits // Execute the query and load the splits
auto stmt = sql_be->create_statement_from_sql(sql); auto stmt = sql_be->create_statement_from_sql(sql);
@ -276,7 +276,7 @@ load_splits_for_transactions (GncSqlBackend* sql_be, std::string selector)
sql = "SELECT DISTINCT "; sql = "SELECT DISTINCT ";
sql += spkey + " FROM " SPLIT_TABLE " WHERE " + sskey + " IN " + selector; sql += spkey + " FROM " SPLIT_TABLE " WHERE " + sskey + " IN " + selector;
gnc_sql_slots_load_for_sql_subquery(sql_be, sql, gnc_sql_slots_load_for_sql_subquery(sql_be, sql,
(BookLookupFn)xaccSplitLookup); (BookLookupFn)xaccSplitLookup);
} }
static Transaction* static Transaction*
@ -350,17 +350,17 @@ query_transactions (GncSqlBackend* sql_be, std::string selector)
std::string sql("SELECT * FROM " TRANSACTION_TABLE); std::string sql("SELECT * FROM " TRANSACTION_TABLE);
if (!selector.empty() && selector[0] == '(') if (!selector.empty() && selector[0] == '(')
sql += " WHERE " + tpkey + " IN " + selector; sql += " WHERE " + tpkey + " IN " + selector;
else if (!selector.empty()) // plain condition else if (!selector.empty()) // plain condition
sql += " WHERE " + selector; sql += " WHERE " + selector;
auto stmt = sql_be->create_statement_from_sql(sql); auto stmt = sql_be->create_statement_from_sql(sql);
auto result = sql_be->execute_select_statement(stmt); auto result = sql_be->execute_select_statement(stmt);
if (result->begin() == result->end()) if (result->begin() == result->end())
{ {
PINFO("Query %s returned no results", sql.c_str()); PINFO("Query %s returned no results", sql.c_str());
return; return;
} }
Transaction* tx; Transaction* tx;
// Load the transactions // Load the transactions
@ -379,7 +379,7 @@ query_transactions (GncSqlBackend* sql_be, std::string selector)
// Load all splits and slots for the transactions // Load all splits and slots for the transactions
if (!instances.empty()) if (!instances.empty())
{ {
const std::string tpkey(tx_col_table[0]->name()); const std::string tpkey(tx_col_table[0]->name());
if (!selector.empty() && (selector[0] != '(')) if (!selector.empty() && (selector[0] != '('))
{ {
auto tselector = std::string ("(SELECT DISTINCT "); auto tselector = std::string ("(SELECT DISTINCT ");