Busybox: Upgrade to 1.21.1 (stable). lsof active.
[tomato.git] / release / src / router / php / ext / sybase_ct / tests / test_fetch_object.phpt
blobc23658fa35d37a5ee94e0942b836dfa8a2ba7882
1 --TEST--
2 Sybase-CT sybase_fetch_object
3 --SKIPIF--
4 <?php 
5   require('skipif.inc');
6 ?>
7 --FILE--
8 <?php
9 /* This file is part of PHP test framework for ext/sybase_ct
10  *
11  * $Id$
12  */
14   require('test.inc');
15   
16   // {{{ class article
17   class article { }
18   // }}}
19   
20   // {{{ resource fetch_object(resource db, [mixed arg= NULL])
21   //     Fetches a resultset and returns it as an object
22   function fetch_object($db, $arg= NULL) {
23     return sybase_fetch_object(sybase_query('select
24       1 as "id",
25       "Hello" as "caption",
26       "timm" as "author",
27       getdate() as "lastchange"
28     ', $db), $arg);
29   }
30   // }}}
32   $db= sybase_connect_ex();
33   
34   // Test with stdClass
35   var_export(fetch_object($db)); echo "\n";
36   
37   // Test with userland class
38   var_export(fetch_object($db, 'article')); echo "\n";
40   // Test with object
41   var_export(fetch_object($db, new article())); echo "\n";
43   // Test with non-existant class
44   var_export(fetch_object($db, '***')); echo "\n";
45     
46   sybase_close($db);
48 --EXPECTF--
49 stdClass::__set_state(array(
50    'id' => 1,
51    'caption' => 'Hello',
52    'author' => 'timm',
53    'lastchange' => '%s',
55 article::__set_state(array(
56    'id' => 1,
57    'caption' => 'Hello',
58    'author' => 'timm',
59    'lastchange' => '%s',
61 article::__set_state(array(
62    'id' => 1,
63    'caption' => 'Hello',
64    'author' => 'timm',
65    'lastchange' => '%s',
68 Notice: sybase_fetch_object(): Sybase:  Class *** has not been declared in %stest_fetch_object.php on line %d
69 stdClass::__set_state(array(
70    'id' => 1,
71    'caption' => 'Hello',
72    'author' => 'timm',
73    'lastchange' => '%s',