xref: /PHP-8.3/ext/odbc/tests/bug69354.phpt (revision 8726ae06)
1--TEST--
2Bug #69354 Incorrect use of SQLColAttributes with ODBC 3.0
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 bug69354 (ID INT, VARCHAR_COL VARCHAR(100))');
15
16odbc_exec($conn, "INSERT INTO bug69354(ID, VARCHAR_COL) VALUES (1, '" . str_repeat("a", 100) . "')");
17
18$res = odbc_exec($conn,"SELECT VARCHAR_COL FROM bug69354");
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--CLEAN--
29<?php
30include 'config.inc';
31
32$conn = odbc_connect($dsn, $user, $pass);
33
34odbc_exec($conn, 'DROP TABLE bug69354');
35
36?>
37--EXPECT--
38100
39a
40a
41