xref: /PHP-8.0/ext/odbc/tests/bug69354.phpt (revision f8d79582)
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--EXPECT--
29100
30a
31a
32--CLEAN--
33<?php
34include 'config.inc';
35
36$conn = odbc_connect($dsn, $user, $pass);
37
38odbc_exec($conn, 'DROP TABLE FOO');
39odbc_exec($conn, 'DROP DATABASE odbcTEST');
40
41?>
42