Skip to content

Commit

Permalink
don't print FETCH results on no-data-found
Browse files Browse the repository at this point in the history
  • Loading branch information
gsauthof committed Jul 3, 2013
1 parent 67bed6e commit 8e35206
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 45 deletions.
34 changes: 0 additions & 34 deletions modtest/ref/gory
Original file line number Diff line number Diff line change
Expand Up @@ -778,15 +778,6 @@ Iterations: 1 (of 1)
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
SQL-Code: 1403, ORA-01403: no data found (select str ,n from example_tbl where n<:b0 order by n )

Iterations: 1 (of 1)
Iteration: 0
OUT paramter (a=0)
Type: STRING (97), Length: 6, Size: 0, Ind -1
Value: |NULL|
OUT paramter (a=1)
Type: INT (3), Length: 4, Size: 0, Ind -1
Value: |NULL|
---------------------------------------------------------------------------
===========================================================================
stmt # 25, type CLOSE (15), line 320, #para 0 (in 0) (offset 579) (foff: 0)
---------------------------------------------------------------------------
Expand Down Expand Up @@ -1060,22 +1051,6 @@ Iterations: 1 (of 4)
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
SQL-Code: 1403, ORA-01403: no data found (select str ,n from example_tbl where n<:b0 order by n )

Iterations: 2 (of 4)
Iteration: 0
OUT paramter (a=0)
Type: STRING0 (5), Length: 32, Size: 36, Ind -1
Value: |NULL|
OUT paramter (a=1)
Type: INT (3), Length: 4, Size: 36, Ind -1
Value: |NULL|
Iteration: 1
OUT paramter (a=0)
Type: STRING0 (5), Length: 32, Size: 36, Ind -1
Value: |NULL|
OUT paramter (a=1)
Type: INT (3), Length: 4, Size: 36, Ind -1
Value: |NULL|
---------------------------------------------------------------------------
===========================================================================
stmt # 28, type CLOSE (15), line 419, #para 0 (in 0) (offset 858) (foff: 0)
---------------------------------------------------------------------------
Expand Down Expand Up @@ -1210,15 +1185,6 @@ Iterations: 1 (of 4)
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
SQL-Code: 1403, ORA-01403: no data found (SELECT str, n FROM example_tbl WHERE n < :x ORDER BY n)

Iterations: 1 (of 4)
Iteration: 0
OUT paramter (a=0)
Type: STRING0 (5), Length: 32, Size: 36, Ind -1
Value: |NULL|
OUT paramter (a=1)
Type: INT (3), Length: 4, Size: 36, Ind -1
Value: |NULL|
---------------------------------------------------------------------------
===========================================================================
stmt # 31, type CLOSE (15), line 482, #para 0 (in 0) (offset 991) (foff: 0)
---------------------------------------------------------------------------
Expand Down
7 changes: 0 additions & 7 deletions modtest/ref/sql
Original file line number Diff line number Diff line change
Expand Up @@ -449,8 +449,6 @@ select str ,n from example_tbl where n<5 order by n ;
-- example/main.pc:314
-- Pseudo-SQL: FETCH
-- PREFETCH=1 (# of prefetched rows)
( NULL, NULL );
-- ---------------------------------------------------------------------------


-- ###########################################################################
Expand Down Expand Up @@ -608,9 +606,6 @@ select str ,n from example_tbl where n<6 order by n ;
-- example/main.pc:406
-- Pseudo-SQL: FETCH
-- PREFETCH=1 (# of prefetched rows)
( NULL, NULL );
( NULL, NULL );
-- ---------------------------------------------------------------------------


-- ###########################################################################
Expand Down Expand Up @@ -726,8 +721,6 @@ DELETE FROM example_tbl WHERE n = 4;
-- example/main.pc:468
-- Pseudo-SQL: FETCH
-- PREFETCH=1 (# of prefetched rows)
( NULL, NULL );
-- ---------------------------------------------------------------------------


-- ###########################################################################
Expand Down
5 changes: 5 additions & 0 deletions prettyprint.c
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,11 @@ int pp_sql(const Statement *stmt, void *user_ptr)
}
s->tokens_pos = 0;
SQL_Token *i = s->tokens + s->tokens_pos;

// don't print (possibly) tons of NULL fetch results
if (stmt->type == FETCH && (stmt->errorcode == 1403 || stmt->errorcode == 100))
return 0;

if (s->tokens_pos < s->tokens_size && i->begin && !i->host_var) {
tprintf("%.*s", (int) (i->end - i->begin), i->begin);
++s->tokens_pos;
Expand Down
9 changes: 5 additions & 4 deletions wrap.c
Original file line number Diff line number Diff line change
Expand Up @@ -1649,10 +1649,11 @@ static int pp_sql_after(const sqlexd *d, Statement *stmt,
state.callbacks[callback_nr].user_ptr);
}

// now done in pp_para
//if (!stmt->errorcode || stmt->errorcode == 1403 || stmt->errorcode == 100) {
pp_para(d, false, stmt, callback_nr);
//}
// don't print (possibly) tons of NULL fetch results
if (stmt->type == FETCH && (stmt->errorcode == 1403 || stmt->errorcode == 100))
return 0;

pp_para(d, false, stmt, callback_nr);

if (state.callbacks[callback_nr].after_end_fn) {
int ret = state.callbacks[callback_nr]
Expand Down

0 comments on commit 8e35206

Please sign in to comment.