Skip to content

Commit

Permalink
Fix closestmt test
Browse files Browse the repository at this point in the history
- Inserts correctly many rows as designed;
- do not attempt to free statement twice;
- only 4 rows are returned from first select.

Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
  • Loading branch information
freddy77 committed May 20, 2015
1 parent 347e8d4 commit 7dc792f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/odbc/unittests/closestmt.c
Expand Up @@ -22,8 +22,8 @@ main(int argc, char *argv[])
/* create a table with some rows */
odbc_command("create table #tmp (i int, c varchar(100))");
odbc_command("insert into #tmp values(1, 'some data')");
for (i = 1; i <= 8; ++i) {
sprintf(sql, "insert into #tmp select i+%d, c from #tmp where i <= %d", i, i);
for (i = 0; i < 8; ++i) {
sprintf(sql, "insert into #tmp select i+%d, c from #tmp where i <= %d", 1 << i, 1 << i);
odbc_command(sql);
}

Expand All @@ -35,7 +35,7 @@ main(int argc, char *argv[])

CHKExecute("S");

for (i = 0; i < 5; ++i)
for (i = 1; i < 5; ++i)
CHKFetch("S");
CHKFetch("No");
CHKMoreResults("No");
Expand All @@ -50,6 +50,7 @@ main(int argc, char *argv[])
SWAP_STMT(stmt);
CHKFreeStmt(SQL_DROP, "S");

SWAP_STMT(stmt);
odbc_disconnect();
return 0;
}

0 comments on commit 7dc792f

Please sign in to comment.