1--TEST--
2odbc_field_type(): Getting the type of the field
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 field_type (foo INT, bar TEXT, baz VARBINARY(50))');
15
16$res = odbc_exec($conn, 'SELECT * FROM field_type');
17try {
18    odbc_field_type($res, 0);
19} catch (ValueError $error) {
20    echo $error->getMessage() . "\n";
21}
22var_dump(odbc_field_type($res, 1));
23var_dump(odbc_field_type($res, 2));
24var_dump(odbc_field_type($res, 3));
25var_dump(odbc_field_type($res, 4));
26
27?>
28--CLEAN--
29<?php
30require 'config.inc';
31$conn = odbc_connect($dsn, $user, $pass);
32odbc_exec($conn, 'DROP TABLE field_type');
33?>
34--EXPECTF--
35odbc_field_type(): Argument #2 ($field) must be greater than 0
36string(3) "int"
37string(4) "text"
38string(9) "varbinary"
39
40Warning: odbc_field_type(): Field index larger than number of fields in %s on line %d
41bool(false)
42