aboutsummaryrefslogtreecommitdiffstats
path: root/SQLiteStudio3/sqlitestudiocli/commands/clicommandsql.cpp
diff options
context:
space:
mode:
authorLibravatarUnit 193 <unit193@ubuntu.com>2017-02-09 04:37:26 -0500
committerLibravatarUnit 193 <unit193@ubuntu.com>2017-02-09 04:37:26 -0500
commitc9d6debf9015b7853c3e061bbc64a555d85e2fcd (patch)
tree53341bc57ae9fbad2beb5b6c08d97a68bee0ec8e /SQLiteStudio3/sqlitestudiocli/commands/clicommandsql.cpp
parentd5caba2b1f36dc3b92fa705a06097d0597fa2ddd (diff)
parentd9aa870e5d509cc7309ab82dd102a937ab58613a (diff)
Merge tag 'upstream/3.1.1+dfsg1'
Upstream version 3.1.1+dfsg1 # gpg: Signature made Thu 09 Feb 2017 04:37:24 AM EST # gpg: using RSA key 5001E1B09AA3744B # gpg: issuer "unit193@ubuntu.com" # gpg: Good signature from "Unit 193 <unit193@ubuntu.com>" [unknown] # gpg: aka "Unit 193 <unit193@gmail.com>" [unknown] # gpg: WARNING: This key is not certified with a trusted signature! # gpg: There is no indication that the signature belongs to the owner. # Primary key fingerprint: 8DB3 E586 865D 2B4A 2B18 5A5C 5001 E1B0 9AA3 744B
Diffstat (limited to 'SQLiteStudio3/sqlitestudiocli/commands/clicommandsql.cpp')
-rw-r--r--SQLiteStudio3/sqlitestudiocli/commands/clicommandsql.cpp19
1 files changed, 8 insertions, 11 deletions
diff --git a/SQLiteStudio3/sqlitestudiocli/commands/clicommandsql.cpp b/SQLiteStudio3/sqlitestudiocli/commands/clicommandsql.cpp
index 3f2c4b3..7ae78e5 100644
--- a/SQLiteStudio3/sqlitestudiocli/commands/clicommandsql.cpp
+++ b/SQLiteStudio3/sqlitestudiocli/commands/clicommandsql.cpp
@@ -88,7 +88,6 @@ void CliCommandSql::defineSyntax()
void CliCommandSql::printResultsClassic(QueryExecutor* executor, SqlQueryPtr results)
{
- int metaColumns = executor->getMetaColumnCount();
int resultColumnCount = executor->getResultColumns().size();
// Columns
@@ -105,7 +104,7 @@ void CliCommandSql::printResultsClassic(QueryExecutor* executor, SqlQueryPtr res
{
row = results->next();
i = 0;
- values = row->valueList().mid(metaColumns);
+ values = row->valueList().mid(0, resultColumnCount);
foreach (QVariant value, values)
{
qOut << getValueString(value);
@@ -124,7 +123,6 @@ void CliCommandSql::printResultsFixed(QueryExecutor* executor, SqlQueryPtr resul
{
QList<QueryExecutor::ResultColumnPtr> resultColumns = executor->getResultColumns();
int resultColumnsCount = resultColumns.size();
- int metaColumns = executor->getMetaColumnCount();
int termCols = getCliColumns();
int baseColWidth = termCols / resultColumns.size() - 1;
@@ -157,7 +155,7 @@ void CliCommandSql::printResultsFixed(QueryExecutor* executor, SqlQueryPtr resul
// Data
while (results->hasNext())
- printColumnDataRow(widths, results->next(), metaColumns);
+ printColumnDataRow(widths, results->next(), resultColumnsCount);
qOut.flush();
}
@@ -181,7 +179,6 @@ void CliCommandSql::printResultsColumns(QueryExecutor* executor, SqlQueryPtr res
// Preload data (we will calculate column widths basing on real values)
QList<SqlResultsRowPtr> allRows = results->getAll();
- int metaColumns = executor->getMetaColumnCount();
// Get widths of each column in every data row, remember the longest ones
QList<SortedColumnWidth*> columnWidths;
@@ -199,7 +196,7 @@ void CliCommandSql::printResultsColumns(QueryExecutor* executor, SqlQueryPtr res
{
for (int i = 0; i < resultColumnsCount; i++)
{
- dataLength = row->value(metaColumns + i).toString().length();
+ dataLength = row->value(i).toString().length();
columnWidths[i]->setMinDataWidth(dataLength);
}
}
@@ -232,7 +229,7 @@ void CliCommandSql::printResultsColumns(QueryExecutor* executor, SqlQueryPtr res
printColumnHeader(finalWidths, headerNames);
foreach (SqlResultsRowPtr row, allRows)
- printColumnDataRow(finalWidths, row, metaColumns);
+ printColumnDataRow(finalWidths, row, resultColumnsCount);
qOut.flush();
}
@@ -240,7 +237,7 @@ void CliCommandSql::printResultsColumns(QueryExecutor* executor, SqlQueryPtr res
void CliCommandSql::printResultsRowByRow(QueryExecutor* executor, SqlQueryPtr results)
{
// Columns
- int metaColumns = executor->getMetaColumnCount();
+ int resultColumnCount = executor->getResultColumns().size();
int colWidth = 0;
foreach (const QueryExecutor::ResultColumnPtr& resCol, executor->getResultColumns())
{
@@ -265,7 +262,7 @@ void CliCommandSql::printResultsRowByRow(QueryExecutor* executor, SqlQueryPtr re
i = 0;
rowCntString = " " + rowCntTemplate.arg(rowCnt) + " ";
qOut << center(rowCntString, termWidth - 1, '-') << "\n";
- foreach (QVariant value, row->valueList().mid(metaColumns))
+ foreach (QVariant value, row->valueList().mid(0, resultColumnCount))
{
qOut << columns[i] + ": " + getValueString(value) << "\n";
i++;
@@ -379,11 +376,11 @@ void CliCommandSql::printColumnHeader(const QList<int>& widths, const QStringLis
qOut << line.join("+");
}
-void CliCommandSql::printColumnDataRow(const QList<int>& widths, const SqlResultsRowPtr& row, int rowIdOffset)
+void CliCommandSql::printColumnDataRow(const QList<int>& widths, const SqlResultsRowPtr& row, int resultColumnCount)
{
int i = 0;
QStringList line;
- foreach (const QVariant& value, row->valueList().mid(rowIdOffset))
+ foreach (const QVariant& value, row->valueList().mid(0, resultColumnCount))
{
line << pad(getValueString(value).left(widths[i]), widths[i], ' ');
i++;