1--TEST--
2odbc_fetch_object(): Getting data from query
3--EXTENSIONS--
4odbc
5--SKIPIF--
6<?php include 'skipif.inc'; ?>
7--FILE--
8<?php
9
10include 'config.inc';
11
12$conn = odbc_connect($dsn, $user, $pass);
13
14odbc_exec($conn, 'CREATE TABLE fetch_object (foo INT)');
15odbc_exec($conn, 'INSERT INTO fetch_object VALUES (1), (2)');
16
17$res = odbc_exec($conn, 'SELECT * FROM fetch_object');
18
19var_dump(odbc_fetch_object($res));
20var_dump(odbc_fetch_object($res, 0));
21var_dump(odbc_fetch_object($res, 2));
22var_dump(odbc_fetch_object($res, 4));
23
24?>
25--CLEAN--
26<?php
27require 'config.inc';
28$conn = odbc_connect($dsn, $user, $pass);
29odbc_exec($conn, 'DROP TABLE fetch_object');
30?>
31--EXPECTF--
32object(stdClass)#%d (%d) {
33  ["foo"]=>
34  string(1) "1"
35}
36object(stdClass)#%d (%d) {
37  ["foo"]=>
38  string(1) "2"
39}
40object(stdClass)#%d (%d) {
41  ["foo"]=>
42  string(1) "2"
43}
44bool(false)
45