Skip to content
This repository was archived by the owner on Jan 3, 2021. It is now read-only.

Commit f275214

Browse files
committed
Merge pull request #36 from dbcli/eliangcs/fix-negative-rows
Fix #35: "-1 rows"
2 parents 9769016 + 682bacd commit f275214

4 files changed

Lines changed: 19 additions & 2 deletions

File tree

tests/features/crud_table.feature

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,15 @@ Feature: manipulate tables:
5757
and we wait for time prompt
5858
and we wait for prompt
5959
then wee see unicode result in file
60+
61+
Scenario: select 0 rows
62+
Given we have vcli installed
63+
when we run vcli without arguments
64+
and we wait for prompt
65+
and we create schema
66+
then we see schema created
67+
when we create table
68+
then we see table created
69+
70+
when we select from table
71+
then we see 0 rows

tests/features/specials.feature

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
Feature: Special commands
22

3-
@wip
43
Scenario: run refresh command
54
Given we have vcli installed
65
when we run vcli without arguments

tests/features/steps/step_definitions.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,11 @@ def step_see_data_deleted(context):
324324
_expect(context, r'0\s*\|', timeout=1)
325325

326326

327+
@then('we see 0 rows')
328+
def step_see_0_rows(context):
329+
_expect(context, '(0 rows)', timeout=1)
330+
331+
327332
@then('we see result in file')
328333
def step_see_result_in_file(context):
329334
assert os.path.exists(context.temp_filename)

vcli/main.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,8 @@ def prompt_tokens(cli):
311311
if cur.rowcount == 1:
312312
write_output(output, '(1 row)')
313313
elif headers:
314-
write_output(output, '(%d rows)' % cur.rowcount)
314+
rowcount = max(cur.rowcount, 0)
315+
write_output(output, '(%d rows)' % rowcount)
315316
if document.text.startswith('\\') and cur.rowcount == 0:
316317
stdout_output = ['No matching relations found.']
317318

0 commit comments

Comments
 (0)