;-*-Mode: text;-*- -[Tue Oct 13 09:53:45 1992 by cxh]-

- SQLfetchCursor does not work if one fetches from two different
cursors one after another.  The work around is to do an
SQLprepareCursor and SQLdescribeCursor between fetches to different cursors.

# This code fails
proc test_mult_curs {} {
  echo "	Test out fetching from two cursors concurrently.";
  opendb;

  # Get the first header.
  SQLdeclareCursor curs;
  SQLdeclareCursor curs2;
  SQLprepareCursor curs "select * from tables";
  SQLdescribeCursor curs header 0;
  pheader header
  set rowlen [array size header];

  # Get the second header.
  SQLprepareCursor curs2 "select * from columns";
  SQLdescribeCursor curs2 header2 0;
  pheader header2;
  set rowlen2 [array size header2];
  SQLopenCursor -readonly curs;

  # Fetch from the first cursor
  for {set i 0} {1} {set i [expr $i+1]} {
    SQLfetchCursor curs row $i;
    if {[SQLmoreRows]} {
      prow row $i $rowlen;
    } else {
      break;
    }
  }
  #fetch_curs;
  #fetch_curs2;
}


