1--TEST--
2Sybase-CT unbuffered query
3--SKIPIF--
4<?php require('skipif.inc'); ?>
5--FILE--
6<?php
7/* This file is part of PHP test framework for ext/sybase_ct
8 *
9 * $Id$
10 */
11
12  require('test.inc');
13
14  $db= sybase_connect_ex();
15  var_dump($db);
16
17  // Test #1: num_rows
18  $q= sybase_unbuffered_query('select name from master..systypes', $db);
19  var_dump($q);
20  $i= 0;
21  while ($r= sybase_fetch_assoc($q)) {
22    $i++;
23  }
24  var_dump($i, sybase_num_rows($q), $i == sybase_num_rows($q), $q);
25  sybase_free_result($q);
26  var_dump($q);
27
28  // Test #2: after sybase_free_result, this should be an invalid resource
29  var_dump(FALSE == sybase_num_rows($q));
30
31  // Test #3: Seeking
32  $q= sybase_unbuffered_query('select name from master..systypes', $db);
33  var_dump($q);
34  $j= 0;
35  sybase_data_seek($q, 4);
36  while ($r= sybase_fetch_assoc($q)) {
37    $j++;
38  }
39  var_dump($i, $j, $i - $j);
40
41  sybase_close($db);
42?>
43--EXPECTF--
44resource(%d) of type (sybase-ct link)
45resource(%d) of type (sybase-ct result)
46int(%d)
47int(%d)
48bool(true)
49resource(%d) of type (sybase-ct result)
50resource(%d) of type (Unknown)
51
52Warning: sybase_num_rows(): %d is not a valid Sybase result resource in %stest_unbuffered_query.php on line %d
53bool(true)
54resource(%d) of type (sybase-ct result)
55int(%d)
56int(%d)
57int(4)
58