diff options
author | Timm Friebe <thekid@php.net> | 2004-02-09 00:32:39 +0000 |
---|---|---|
committer | Timm Friebe <thekid@php.net> | 2004-02-09 00:32:39 +0000 |
commit | fbc3eda353bc07845ae89526a51534973bae83e4 (patch) | |
tree | 9a970fac7856c03bba7a5d6695be1f6948d154d0 /ext | |
parent | a8bd293005a91811033671a0ff01c8080050e2c1 (diff) | |
download | php-git-fbc3eda353bc07845ae89526a51534973bae83e4.tar.gz |
- Initial release
Diffstat (limited to 'ext')
-rw-r--r-- | ext/sybase_ct/tests/test_unbuffered_query.phpt | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/ext/sybase_ct/tests/test_unbuffered_query.phpt b/ext/sybase_ct/tests/test_unbuffered_query.phpt new file mode 100644 index 0000000000..9e22fc3183 --- /dev/null +++ b/ext/sybase_ct/tests/test_unbuffered_query.phpt @@ -0,0 +1,70 @@ +--TEST-- +Sybase-CT unbuffered query +--SKIPIF-- +<?php require('skipif.inc'); ?> +--FILE-- +<?php +/* This file is part of PHP test framework for ext/sybase_ct + * + * $Id$ + */ + + require('test.inc'); + + $db= sybase_connect_ex(); + var_dump($db); + + // Test #1: num_rows + $q= sybase_unbuffered_query('select name from master..systypes', $db); + var_dump($q); + $i= 0; + while ($r= sybase_fetch_assoc($q)) { + $i++; + } + var_dump($i, sybase_num_rows($q), $i == sybase_num_rows($q), $q); + sybase_free_result($q); + var_dump($q); + + // Test #2: after sybase_free_result, this should be an invalid resource + var_dump(sybase_num_rows($q)); + + // Test #3: Seeking + $q= sybase_unbuffered_query('select name from master..systypes', $db); + var_dump($q); + $j= 0; + sybase_data_seek($q, 4); + while ($r= sybase_fetch_assoc($q)) { + $j++; + } + var_dump($i, $j, $i - $j); + + // Test #4: Auto-cancel + $q= sybase_unbuffered_query('select name from master..systypes', $db); + var_dump($q); + sybase_fetch_assoc($q); + $q= sybase_unbuffered_query('select name from master..systypes', $db); + var_dump($q); + sybase_fetch_assoc($q); + sybase_free_result($q); + + sybase_close($db); +?> +--EXPECTF-- +resource(%d) of type (sybase-ct link) +resource(%d) of type (sybase-ct result) +int(%d) +int(%d) +bool(true) +resource(%d) of type (sybase-ct result) +resource(%d) of type (Unknown) + +Warning: sybase_num_rows(): %d is not a valid Sybase result resource in %s/test_unbuffered_query.php on line %d +NULL +resource(%d) of type (sybase-ct result) +int(%d) +int(%d) +int(4) +resource(%d) of type (sybase-ct result) + +Notice: sybase_unbuffered_query(): called without first fetching all rows from a previous unbuffered query in %s/test_unbuffered_query.php on line %d +resource(%d) of type (sybase-ct result) |