xref: /PHP-5.6/ext/odbc/tests/bug69354.phpt (revision 7eda1851)
1--TEST--
2Bug #69354 Incorrect use of SQLColAttributes with ODBC 3.0
3--SKIPIF--
4<?php include 'skipif.inc'; ?>
5--FILE--
6<?php
7
8include 'config.inc';
9
10$conn = odbc_connect($dsn, $user, $pass);
11
12@odbc_exec($conn, 'CREATE DATABASE odbcTEST');
13
14odbc_exec($conn, 'CREATE TABLE FOO (ID INT, VARCHAR_COL VARCHAR(100))');
15
16odbc_exec($conn, "INSERT INTO FOO(ID, VARCHAR_COL) VALUES (1, '" . str_repeat("a", 100) . "')");
17
18$res = odbc_exec($conn,"select VARCHAR_COL from FOO");
19if ($res) {
20	if (odbc_fetch_row($res)) {
21		$ret = odbc_result($res,'varchar_col');
22		echo strlen($ret), "\n";
23		echo $ret[0], "\n";
24		echo $ret[strlen($ret)-1], "\n";
25	}
26}
27?>
28==DONE==
29--EXPECT--
30100
31a
32a
33==DONE==
34--CLEAN--
35<?php
36include 'config.inc';
37
38$conn = odbc_connect($dsn, $user, $pass);
39
40odbc_exec($conn, 'DROP TABLE FOO');
41odbc_exec($conn, 'DROP DATABASE odbcTEST');
42
43?>
44