~ubuntu-branches/ubuntu/hardy/php5/hardy-updates

« back to all changes in this revision

Viewing changes to ext/sybase_ct/tests/test_fetch_object.phpt

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad
  • Date: 2005-10-09 03:14:32 UTC
  • Revision ID: james.westby@ubuntu.com-20051009031432-kspik3lobxstafv9
Tags: upstream-5.0.5
ImportĀ upstreamĀ versionĀ 5.0.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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: test_fetch_object.phpt,v 1.1 2004/07/11 16:10:03 thekid Exp $
 
12
 */
 
13
 
 
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
  // }}}
 
31
 
 
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";
 
39
 
 
40
  // Test with object
 
41
  var_export(fetch_object($db, new article())); echo "\n";
 
42
 
 
43
  // Test with non-existant class
 
44
  var_export(fetch_object($db, '***')); echo "\n";
 
45
    
 
46
  sybase_close($db);
 
47
?>
 
48
--EXPECTF--
 
49
class stdClass {
 
50
  %s $id = 1;
 
51
  %s $caption = 'Hello';
 
52
  %s $author = 'timm';
 
53
  %s $lastchange = '%s';
 
54
}
 
55
class article {
 
56
  %s $id = 1;
 
57
  %s $caption = 'Hello';
 
58
  %s $author = 'timm';
 
59
  %s $lastchange = '%s';
 
60
}
 
61
class article {
 
62
  %s $id = 1;
 
63
  %s $caption = 'Hello';
 
64
  %s $author = 'timm';
 
65
  %s $lastchange = '%s';
 
66
}
 
67
 
 
68
Notice: sybase_fetch_object(): Sybase:  Class *** has not been declared in %s/test_fetch_object.php on line %d
 
69
class stdClass {
 
70
  %s $id = 1;
 
71
  %s $caption = 'Hello';
 
72
  %s $author = 'timm';
 
73
  %s $lastchange = '%s';
 
74
}